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

Ensure OIDC login works in combination with SameSite strict settings of open-api-framework #116

Assignees
Labels
bug Something isn't working

Comments

@alextreme
Copy link
Member

alextreme commented Sep 17, 2024

open-api-framework issue, raised by @sergei-maertens

SESSION_COOKIE_SAMESITE = config(
    "SESSION_COOKIE_SAMESITE",
    "Strict",
    help_text=(
        "The value of the SameSite flag on the session cookie. This flag prevents the "
        "cookie from being sent in cross-site requests thus preventing CSRF attacks and "
        "making some methods of stealing session cookie impossible."
    ),
)

This doesn't work well with Google OIDC (and likely Azure since someone else was running into similar issues). It needs to be set to "Lax". Note that this probably not a problem as soon as you are logged in to google, keycloak can then re-use the existing google session, but for the first login, shit breaks

Suggested workaround: set the session cookie to 'lax' during the oidc login-flow using a custom middleware in mozilla-django-oidc-db, and revert it back to 'strict' afterwards

@sergei-maertens
Copy link
Member

Workaround being tested/applied here: GeneriekPublicatiePlatformWoo/registratie-component#29

@alextreme alextreme added the bug Something isn't working label Sep 17, 2024
@alextreme
Copy link
Member Author

@Coperh discussed with Sergei and please set the default to Lax for now, this should be sufficient for the AMS issue (as the complaint was that SameSite wasn't set)

@joeribekker
Copy link
Member

joeribekker commented Sep 24, 2024

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