Skip to content

Fix Flaky Crypto Tests#18841

Merged
rwinch merged 1 commit intospring-projects:6.5.xfrom
rwinch:6.5.x-gh-18795-responsewrapper-header-overrides
Mar 3, 2026
Merged

Fix Flaky Crypto Tests#18841
rwinch merged 1 commit intospring-projects:6.5.xfrom
rwinch:6.5.x-gh-18795-responsewrapper-header-overrides

Conversation

@rwinch
Copy link
Member

@rwinch rwinch commented Mar 3, 2026

Previously the RsaSecretEncryptorTests were flaky because the assumed that a BadPaddigException would be thrown when using things like different salt. However, given that the tests had random inputs (e.g. keys) there is the possibility that, despite the fact that it can never be properly decrypted, the final bytes look like a valid encrypted value.

This updates the tests to ensure that decrypt either throws an Exception or is not equal to the original plaintext.

Previously the RsaSecretEncryptorTests were flaky because the assumed that a BadPaddigException would be thrown
when using things like different salt. However, given that the tests had random inputs (e.g. keys) there is the
possibility that, despite the fact that it can never be properly decrypted, the final bytes look like a valid
encrypted value.

This updates the tests to ensure that decrypt either throws an Exception or is not equal to the original
plaintext.
@rwinch rwinch added this to the 6.5.9 milestone Mar 3, 2026
@rwinch rwinch self-assigned this Mar 3, 2026
@rwinch rwinch added in: build An issue in the build in: crypto An issue in spring-security-crypto type: bug A general bug labels Mar 3, 2026
@rwinch rwinch enabled auto-merge March 3, 2026 21:46
@rwinch rwinch mentioned this pull request Mar 3, 2026
@rwinch rwinch merged commit ea3b112 into spring-projects:6.5.x Mar 3, 2026
6 checks passed
@rwinch rwinch mentioned this pull request Mar 3, 2026
rwinch added a commit that referenced this pull request Mar 3, 2026
@rwinch rwinch deleted the 6.5.x-gh-18795-responsewrapper-header-overrides branch March 3, 2026 22:03
rwinch added a commit that referenced this pull request Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: build An issue in the build in: crypto An issue in spring-security-crypto type: bug A general bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant