VS-17: full XML-DSig SAML signature verification #50
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/saml-signature-verification-vs-17"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
VS-17: SAML signature verification (full XML-c14n)
Implements full inbound XML-DSig verification for signed SAML responses, replacing the previous whole-document digest shortcut in
verify_signature.What changed
The old verifier extracted the first
ds:SignedInfoand digested the entire signature-stripped document. That does not match how Okta and Azure AD actually sign: they sign the Assertion and reference it by#id, so real responses would not verify. The new verifier:ds:SignedInfostructure: CanonicalizationMethod, SignatureMethod, eachds:Reference(URI, transforms, DigestMethod, DigestValue) and anyec:InclusiveNamespacesPrefixList.UnsupportedAlgorithm.ds:SignatureValueagainst the IdP certificate's RSA public key (or a directly supplied SPKI via the newverify_signature_with_pubkey).ds:Reference: resolves the target element by ID (or the whole document forURI=""), applies the enveloped-signature transform and exclusive c14n, SHA-256s it, and compares the claimed DigestValue. A missing Reference, a bad digest, or a bad signature each yield a distinct error.To canonicalize a referenced subtree correctly,
saml_c14nnow separates the in-scope namespace stack from the rendered-output stack, so an element lifted out of its document inherits its ancestors' namespace context and the visibly-utilized rule re-emits only what the subtree actually uses. New helpers:canonicalize_referenced_element(with enveloped-signature stripping) andcanonicalize_signed_info_in_context.Acceptance criteria
InclusiveNamespacesPrefixList and an inheritedxmlns:dson the Response root), signed with a freshly generated key, verify end to end through the production path.DigestMismatch), tampered SignatureValue and wrong-key signature (SignatureNotVerified), downgraded algorithm (UnsupportedAlgorithm), reference-less SignedInfo (NoReferences).xmllint --exc-c14nreference canonicalizer (the de-facto W3C reference), plus subtree-context tests for the new helpers.Notes
cargo test -p meshcentral-auth(120 passing),cargo clippy, andcargo fmt --checkare clean.Closes VS-17 once merged.
🤖 Generated with Claude Code