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()
Updated by Benjamin Dauvergne about 2 years ago
- Status changed from Solution validée to Résolu (à déployer)
commit 390d306e6e87619bd56f766897332d76f81ddd39 Author: Benjamin Dauvergne <email@example.com> Date: Tue Aug 11 11:30:51 2020 +0200 tools: reimplement xmlURIEscapeStr to respect RFC3986 (#45581) Bugfix by Emmanuel Dreyfus. License: MIT