samlify icon indicating copy to clipboard operation
samlify copied to clipboard

fix: escapeTag correctly works with booleans

Open DamianCSpendesk opened this issue 1 year ago • 2 comments

In relation to https://github.com/tngan/samlify/issues/538, the issue boils down to the code in escapeTag, where we call

xmlEscape(text || "")

This fails for "falsey" values, in our case for AllowCreate being false. Even passing true, we end up with an error as the xml-escape lib used actually expects a string.

This PR tests for undefined and null, where it'll pass an empty string. For all other values, it will convert to a string. As a result, our AllowCreate gets correctly set

...
<samlp:NameIDPolicy Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress" AllowCreate="false"/></samlp:AuthnRequest>

DamianCSpendesk avatar Jul 08 '24 11:07 DamianCSpendesk

@tngan Sorry for the ping - for whatever reason, I can't add you as a reviewer

DamianCSpendesk avatar Jul 08 '24 12:07 DamianCSpendesk

@tngan can this be merged?

adrai avatar Aug 07 '24 10:08 adrai