Repository navigation
fix: keep the values of a SAML message from starting a line of the log - #16
Merged
Merged
Conversation
The assertion consumer service of a service provider is anonymous, and the schema check, the algorithm check and the parser quote what the sender wrote. Util#validateXML logged the schema errors as they are, so a line break in an attribute or in an element value (for example Audience, Destination, Recipient or the Algorithm of a signature) ended the log record and let the sender write another one. The signature is checked after the schema, so the message does not have to be signed. - add Util#sanitizeForLog, which replaces control characters and the Unicode line and paragraph separators with a space and bounds the length - use it for the warnings that quote the message: the schema errors, the XML load and validateXML failures, the deprecated algorithm notice and the signature check failure - log a failed decryption as one line at warn and keep the stack trace at debug, as Util#loadXML already does: a malformed EncryptedAssertion wrote about a hundred lines per request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The warnings that quote a SAML message could be made to start a new log record by a caller that is not logged in, because a line break in a value the sender controls was written to the log as it is.
Util#validateXMLlogged the schema errors unchanged. The XML parser quotes the offending value, so a line break in ananyURIorNCNamevalue (Audience,Destination,Recipient,InResponseTo, theAlgorithmof a signature, ...) ended the record. The schema check runs before the signature check, so the message does not have to be signed; a caller only needs a pending AuthnRequest of its own session.Util#sanitizeForLogis new. It replaces control characters and the Unicode line and paragraph separators with a space and bounds the length. It is applied to the schema errors, the XML load andvalidateXMLfailures, the deprecated algorithm notice and the signature check failure.warnand the stack trace moves todebug, asUtil#loadXMLalready does. A malformedEncryptedAssertionwrote about a hundred lines per request.Test
UtilsTestcoverssanitizeForLogand the errors the schema check quotes.mvn -pl core test: 423 tests, 0 failures.EncryptedAssertionwrote 98 lines before and 3 after.