REF-29: Restrict the algorithms accepted when decrypting assertions - #96
Merged
thomasnymand merged 3 commits intoAug 26, 2026
Merged
Conversation
The Decrypter was built without an algorithm list, so the assertion consumer decrypted whatever the ciphertext named, including RSA-1.5 key transport and block ciphers the profile does not allow. Decryption happens before signature validation and the endpoint takes unauthenticated input, so the accepted set should be no wider than the profile requires. Pass the algorithms of [OIO-ALG-01], identical in the OIOSAML Web SSO profiles 3.0.3 and 4.0.0: RSA-OAEP for key transport, AES-128/256-CBC and AES-128/192/256 -GCM for block encryption. Anything else is refused before decryption is attempted, and the uniform external error message is unchanged. The list also carries the digest and mask generation algorithms RSA-OAEP is parameterised with, SHA-1, SHA-256 and SHA-512, because the Decrypter checks those against the same list. They are not usable as encryption algorithms, and OAEP does not rely on collision resistance, so accepting SHA-1 there does not weaken the key transport. Tests cover decryption with AES-GCM and rejection of RSA-1.5 key transport and Triple DES block encryption. The test IdP can now encrypt with a given algorithm pair.
mthiim
approved these changes
Aug 26, 2026
# Conflicts: # oiosaml/src/test/java/dk/gov/oio/saml/util/IdpUtil.java
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.
Limits the assertion consumer to the encryption algorithms the profile allows.
Problem
The
DecrypterinAssertionServicewas built without an algorithm list, so it decrypted whatever the ciphertext named, including RSA-1.5 key transport and block ciphers outside the profile. Decryption runs before signature validation and the endpoint accepts unauthenticated input, so the accepted set should be no wider than the profile requires.Changes
[OIO-ALG-01], identical in the OIOSAML Web SSO profiles 3.0.3 and 4.0.0: RSA-OAEP (both URIs) for key transport, AES-128/256-CBC and AES-128/192/256-GCM for block encryption. Anything else is refused before decryption is attempted; the uniform external error message is unchanged.Decrypter.validateAlgorithmschecks those against the same list and OpenSAML emitsrsa-oaep-mgf1pwith a SHA-1 digest by default. They are not usable as encryption algorithms, and OAEP does not rely on collision resistance, so SHA-1 there does not weaken key transport. Leaving them out rejects every IdP that emits default-parameter OAEP.The set is hard-coded rather than configurable: the profile prescribes it exactly, and
CLAUDE.mdrecords that it must not be widened.Verification
mvn -pl oiosaml test→ 115 tests, 1 failure: the pre-existingOIOBPPUtilTest(JDK 26 JAXB incompatibility), which also fails onmaster.New tests decrypt an AES-GCM assertion and reject RSA-1.5 key transport and Triple DES block encryption. With
AssertionServicereverted, both rejection tests fail, i.e. those assertions decrypt.IdpUtil.createResponsegained an overload taking the algorithm pair.Follow-up (not in this PR)
Inbound signature algorithms are still unconstrained, so SHA-1 signatures are accepted;
[OIO-ALG-01]allows onlyrsa-sha256/ecdsa-sha256with SHA-256 digests. Separately, the same key pair is still advertised and used for both signing and encryption.