Add SHA1 support to Fingerprint.certificate_digest#247
Open
pelted wants to merge 1 commit into
Open
Conversation
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
Add
:sha1support toSamlIdp::Fingerprint.certificate_digestso the helper can generate fingerprints that match the verification logic already used inSignedDocument#validate.Problem
Before this change,
Fingerprint.certificate_digestsupported only:sha256and:sha512.That did not match the behavior in
SignedDocument#validate, which compares:<ds:DigestMethod>In practice, this meant SHA1 fingerprints were already accepted during validation, but the helper could not generate them.
This was especially inconsistent because
Fingerprint.certificate_digest(cert)falls back toSamlIdp.config.algorithm, and the default configured algorithm is already:sha1.As a result, the helper's default path could raise
ArgumentErroreven though SHA1 fingerprints are valid inputs for request validation.Fix
Add
:sha1toFingerprint.digest_sha_class, mapped toDigest::SHA1.This aligns the fingerprint helper with the existing validation behavior in
xml_security.rb, which already uses SHA1 as a supported fingerprint comparison path.Testing
Expand
Fingerprintspecs to cover:ArgumentErrorNotes
Using SHA1 here is for certificate identity matching, not for signature security. Signature verification still happens separately in
validate_docusing the algorithm declared by the XML signature.