Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[meta] update samael to 0.0.14 #4878

Merged
merged 4 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ rustfmt-wrapper = "0.2"
rustls = "0.22.2"
rustls-pemfile = "2.0.0"
rustyline = "12.0.0"
samael = { git = "https://github.com/njaremko/samael", features = ["xmlsec"], branch = "master" }
samael = { version = "0.0.14", features = ["xmlsec"] }
schemars = "0.8.16"
secrecy = "0.8.0"
semver = { version = "1.0.21", features = ["std", "serde"] }
Expand Down
31 changes: 26 additions & 5 deletions nexus/tests/integration_tests/saml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -964,12 +964,31 @@ 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 reject the XML document as invalid. This is also safe,
// 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(),

Expand Down Expand Up @@ -1004,7 +1023,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
Expand Down
2 changes: 0 additions & 2 deletions workspace-hack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ serde_json = { version = "1.0.111", features = ["raw_value", "unbounded_depth"]
sha2 = { version = "0.10.8", features = ["oid"] }
similar = { version = "2.3.0", features = ["inline", "unicode"] }
slog = { version = "2.7.0", features = ["dynamic-keys", "max_level_trace", "release_max_level_debug", "release_max_level_trace"] }
snafu = { version = "0.7.5", features = ["futures"] }
socket2 = { version = "0.5.5", default-features = false, features = ["all"] }
spin = { version = "0.9.8" }
string_cache = { version = "0.8.7" }
Expand Down Expand Up @@ -200,7 +199,6 @@ serde_json = { version = "1.0.111", features = ["raw_value", "unbounded_depth"]
sha2 = { version = "0.10.8", features = ["oid"] }
similar = { version = "2.3.0", features = ["inline", "unicode"] }
slog = { version = "2.7.0", features = ["dynamic-keys", "max_level_trace", "release_max_level_debug", "release_max_level_trace"] }
snafu = { version = "0.7.5", features = ["futures"] }
socket2 = { version = "0.5.5", default-features = false, features = ["all"] }
spin = { version = "0.9.8" }
string_cache = { version = "0.8.7" }
Expand Down
Loading