-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[meta] update samael to 0.0.14 (#4878)
Required to unblock a bunch of other updates. The behavior of a test changed, but in a way that to my understanding based on [the Duo article](https://duo.com/blog/duo-finds-saml-vulnerabilities-affecting-multiple-implementations) is still safe. See the comment included in the PR for more.
- Loading branch information
1 parent
cc64304
commit e261a96
Showing
4 changed files
with
38 additions
and
17 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -964,12 +964,33 @@ fn test_reject_unsigned_saml_response() { | |
assert!(result.is_err()); | ||
} | ||
|
||
// Test rejecting a correct SAML response that contains a XML comment in | ||
// saml:NameID. | ||
// Test accepting a correct SAML response that contains a XML comment in | ||
// saml:NameID, and ensuring that the full text node is extracted (and not a | ||
// substring). | ||
// | ||
// See: https://duo.com/blog/duo-finds-saml-vulnerabilities-affecting-multiple-implementations | ||
// This used to be a test that _rejected_ such responses, but a change to an | ||
// upstream dependency (quick-xml) caused the behavior around text nodes with | ||
// embedded comments to change. Specifically, consider: | ||
// | ||
// <saml:NameId>[email protected]<!--comment-->.evil.com</saml:NameId> | ||
// | ||
// What should the text node for this element be? | ||
// | ||
// * Some XML parsing libraries just return "[email protected]". That leads to a | ||
// vulnerability, where an attacker can get a response signed with a | ||
// different email address than intended. | ||
// * Some XML libraries return "[email protected]". This is safe, | ||
// because the text after the comment hasn't been dropped. This is the behavior | ||
// with quick-xml 0.30, and the one that we're testing here. | ||
// * Some XML libraries are unable to deserialize the document. This is also | ||
// safe (and not particularly problematic because typically SAML responses | ||
// aren't going to contain comments), and was the behavior with quick-xml | ||
// 0.23. | ||
// | ||
// See: | ||
// https://duo.com/blog/duo-finds-saml-vulnerabilities-affecting-multiple-implementations | ||
#[test] | ||
fn test_reject_saml_response_with_xml_comment() { | ||
fn test_handle_saml_response_with_xml_comment() { | ||
let silo_saml_identity_provider = SamlIdentityProvider { | ||
idp_metadata_document_string: SAML_RESPONSE_IDP_DESCRIPTOR.to_string(), | ||
|
||
|
@@ -1004,7 +1025,9 @@ fn test_reject_saml_response_with_xml_comment() { | |
), | ||
); | ||
|
||
assert!(result.is_err()); | ||
let (authenticated_subject, _) = | ||
result.expect("expected validation to succeed"); | ||
assert_eq!(authenticated_subject.external_id, "[email protected]"); | ||
} | ||
|
||
// Test receiving a correct SAML response that has group attributes | ||
|
This file contains 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