Skip to content

Create client passwords calculating the entropy size for JWT with cli… - #39637

Merged
mposolda merged 1 commit into
keycloak:mainfrom
rmartinc:issue-38621
May 27, 2025
Merged

mposolda merged 1 commit into
keycloak:mainfrom
rmartinc:issue-38621

Conversation

@rmartinc

Copy link
Copy Markdown
Contributor

Closes #38621

The idea of the PR is that the password calculates the needed length using the selected alphabet (ALPHANUM, 62 characters) to have the same entropy bits. This way the password is created larger with the correct entropy (for example 32bit, 8 bytes are 43 length now).

Other things we can think about:

  • Use another alphabet that has more symbols (for example ASCII85) to reduce the password length (but it's just a bit, for example 43 to 40 for 256bits entropy).
  • Create the password using random bytes and then encode them into a printable password (it can be using base64url for example or any other encoding). But it generates the same length than alphanum (just two more characters, 64 instead of 62 for base64).
  • The PR just generates longer passwords when JWT with Client Secret is selected. I hesitated to do this for all the passwords but finally I decided to only do this when the JWT authentication is used.

…ent secret

Closes keycloak#38621

Signed-off-by: rmartinc <rmartinc@redhat.com>

@mposolda mposolda left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rmartinc Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Client secret generation provides lower than expected entropy

2 participants