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

CSS-8386 Use oauth state #1208

Merged
merged 3 commits into from
May 8, 2024

Conversation

kian99
Copy link
Contributor

@kian99 kian99 commented May 8, 2024

Description

Hydra enforces the use of state when performing the browser flow. This PR adds secure generation of the state parameter with crypto/rand and persists the state as a cookie on the user's browser. We set the path parameter on the cookie to ensure it is only sent to the auth/callback endpoint. This required a bit of refactoring of the tests and I also removed the use of magic strings in favour of constants.

Fixes CSS-8386

Engineering checklist

Check only items that apply

  • Documentation updated
  • Covered by unit tests
  • Covered by integration tests

Copy link
Contributor

@ale8k ale8k left a comment

Choose a reason for hiding this comment

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

lgtm ty

@kian99 kian99 force-pushed the CSS-8386-use-oauth-state branch from 63ec24c to 1b9841f Compare May 8, 2024 08:41
@kian99 kian99 force-pushed the CSS-8386-use-oauth-state branch from 1b9841f to 923011b Compare May 8, 2024 09:23
Copy link
Member

@babakks babakks left a comment

Choose a reason for hiding this comment

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

With a few comments.

internal/auth/oauth2.go Show resolved Hide resolved
internal/auth/oauth2.go Outdated Show resolved Hide resolved
internal/jimmhttp/auth_handler.go Outdated Show resolved Hide resolved
internal/auth/oauth2.go Outdated Show resolved Hide resolved
internal/jimmhttp/auth_handler.go Outdated Show resolved Hide resolved
@kian99 kian99 merged commit 2246386 into canonical:feature-oidc May 8, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants