Lasso fail to properly escape single quotes in RelayState
lasso uses libxml2's xmlURIEscapeStr() to URL-encode parameters in query strings. This function implements RFC 2396 URL encoding, which does not mandates escaping the single quote. As a result, lasso produces RelayState parameters with single quotes unescaped in the query string.
Unfortunately, browers automatically replace single quotes in query string by %27. The IdP gets a RelayState where the single quote was replaced by %27, while the signature is based on a RelayState containing an unescaped single quote. This causes the IdP to reject the request because the signature does not match.
The proposed fix in attached patch is to implement RFC 3986 compliant URL encoding, where all characters except the unreserved class [A-Za-z0-9._~-] are escaped. This is done in a lasso_xmlURIEscapeStr() function which is a drop-in replacement for xmlURIEscapeStr()