Skip to content

Remove 32-byte minimum keyLength restriction in Base64StringKeyGenerator #17091

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

Merged
merged 1 commit into from
May 14, 2025

Conversation

therepanic
Copy link
Contributor

@therepanic therepanic commented May 12, 2025

The main purpose of this change is to essentially remove the strict 32 byte key length limit to allow developers to generate shorter Base64 strings if needed. Now, when trying to pass keyLength < DEFAULT_KEY_LENGTH (32) into the constructor, an exception is thrown, which is not always justified for less critical token generation tasks.

I believe that we don't need such a strict condition and we can soften the condition and just check that the key length is not less than or equal to 0.

Fix: #17012

…ator` (spring-projects#17012)

Signed-off-by: Andrey Litvitski <[email protected]>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 12, 2025
@jzheaux jzheaux modified the milestones: 7.0.x, 7.0.0-M1 May 13, 2025
@rwinch rwinch self-assigned this May 14, 2025
@rwinch rwinch added in: crypto An issue in spring-security-crypto type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels May 14, 2025
@rwinch rwinch added this to the 7.0.0-M1 milestone May 14, 2025
@rwinch rwinch enabled auto-merge (rebase) May 14, 2025 16:28
@rwinch
Copy link
Member

rwinch commented May 14, 2025

Thanks for the PR @therepanic! I've scheduled this for merge as soon as the build passes

@rwinch rwinch merged commit 3b492a9 into spring-projects:main May 14, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: crypto An issue in spring-security-crypto type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Base64StringKeyGenerator should not have a minimum length
4 participants