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

feat: Use unique name for csrf cookie #35

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

Conversation

ajhfok
Copy link
Collaborator

@ajhfok ajhfok commented Nov 8, 2024

If multiple tabs attempt to follow an auth flow, they will override eachother's oidc_csrf cookie. This extends beyond a mild annoyance since the client loses all context of the original URL of that tab, and is instead left with a useless error url from oidc-authservice.

This PR aims to make the name of the oidc_csrf dynamic by adding a random suffix to it. This functionality is controlled via an application setting. When enabled, each tab will be able to complete an auth flow, since they will all have a unique oidc_csrf cookie.

common/settings.go Outdated Show resolved Hide resolved
@ajhfok ajhfok force-pushed the ajhfok/csrf-check-failed-message branch 4 times, most recently from aecd897 to 410a58a Compare November 8, 2024 03:54
server.go Outdated Show resolved Hide resolved
@ajhfok ajhfok force-pushed the ajhfok/csrf-check-failed-message branch 2 times, most recently from ed54814 to 24630c4 Compare November 8, 2024 09:26
@ajhfok ajhfok changed the title feat: Show First Visited URL on CSRF Error feat: Use unique name for csrf cookie Nov 8, 2024
@ajhfok ajhfok force-pushed the ajhfok/csrf-check-failed-message branch from 24630c4 to 81a177b Compare November 13, 2024 03:15
@ajhfok ajhfok marked this pull request as ready for review November 13, 2024 03:27
@ajhfok ajhfok requested review from kellyma2, kthommandra and a team as code owners November 13, 2024 03:27
Copy link

@devoxel devoxel left a comment

Choose a reason for hiding this comment

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

LGTM - missing gofmt in one file.

sessions/state.go Outdated Show resolved Hide resolved
When multiple tabs attempt an oidc auth flow, they will
the oidc_state_csrf cookie will get overriden, causing
a race condition where one tab will succeed and all others
will fail horribly.

This feature aims to create a unique oidc_state_csrf cookie
per tab. This means each tab will complete its auth flow.

the authservice_session cookie may be overriden, but that
should be ok.
@ajhfok ajhfok force-pushed the ajhfok/csrf-check-failed-message branch from 81a177b to bb0c5c0 Compare November 20, 2024 00:40
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.

4 participants