What kind of regex does the Transform AttributeResolver use?
Peter Schober
peter.schober at univie.ac.at
Sat Jul 28 14:47:49 EDT 2018
* Ferenc Wágner <wferi at niif.hu> [2018-07-28 18:43]:
> While experimenting with transforming attributes under SP 2.6, I found
> that the following two transformations don't behave the same:
>
> <AttributeResolver type="Transform" source="eppn">
> <Regex match=".+" dest="fakeEntitlementPlus">viewers</Regex>
> <Regex match=".*" dest="fakeEntitlementStar">viewers</Regex>
> </AttributeResolver>
>
> When fed by an arbitrary eppn, the .+ rule creates
> fakeEntitlementPlus=viewers as expected, while the .* rule creates an
> empty fakeEntitlementStar and logs the message:
>
> 2018-07-28 17:39:24 ERROR Shibboleth.AttributeResolver.Transform
> [6]: caught error applying regular expression: replace pattern
> cannot match zero-length string
".*" (with zero or more occurances of a single char) could also be a
zero-length string, seems there exists some code that doesn't like
that?
> (I was also got by the operation being applied repeatedly/globally:
> match="." resulted in viewersviewersviewersviewers... to my surprise.)
Always anchor your regexes.
-peter
More information about the users
mailing list