Skip to content
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

Sign AUTH_SESSION_ID cookie #35297

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

graziang
Copy link
Contributor

@graziang graziang commented Nov 25, 2024

Closes #34027

This PR signs and encodes the value of the AUTH_SESSION_ID cookie.

  • The new format for the cookie will be:
    base64({auth_session_id}.base64(HS512({auth_session_id}))).

  • The cookie is signed using the HS512 algorithm.

  • The old format (which contains only the auth_session_id) will no longer be supported. This could lead the loss of auth sessions, during migration in clustered environments. To prevent this, we could validate both formats of the cookie in an initial release (the signature would be useless) and remove support for the old format in a subsequent release. WDYT?

  • This PR should not affect existing user sessions.

  • The signature is stored as an attribute in the Keycloak Session to avoid re-validating it for each request.

  • I tested this PR locally using the MultipleTabsLoginTest and measured the request times before and after the PR changes. No noticeable performance issues were observed in the requests that sign the cookie and validate the signature.

Closes keycloak#34027

Signed-off-by: Giuseppe Graziano <[email protected]>
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.

Sign the AUTH_SESSION_ID cookie value
2 participants