Conversation
- Fix broken provider_logout (was referencing non-existent auth.backend module) - Enable PKCE (RFC 7636) for authorization code flow - Validate and sanitize OIDC claim values before writing to user fields - Replace direct claims["groups"] key access with .get() + type check - Validate group names from OIDC provider before creating/assigning - Restrict ALLOWED_HOSTS from wildcard to explicit Shariant hostnames - Log OIDC exceptions before swallowing them in error handler middleware - Document API/AJAX session refresh exclusion policy
ddc78fe to
97a35d9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses SACGF/variantgrid_private#3823.
Changes
oidc_auth/backend.pyprovider_logoutfunction soOIDC_OP_LOGOUT_URL_METHODcorrectly terminates Keycloak sessions on logoutemail,username,given_name,family_name) before writing to user fields — validates email format, strips control characters, enforces field max lengthsclaims["groups"]direct key access with.get("groups", [])plus anisinstancetype check to handle absent or malformed claims gracefullyoidc_auth/oidc_error_handler.pylogger.exception()before redirecting, so OIDC errors produce an audit trailoidc_auth/session_refresh.pyvariantgrid/settings/env/shariantcommon.pyOIDC_USE_PKCE,OIDC_PKCE_CODE_CHALLENGE_METHOD = 'S256')OIDC_OP_LOGOUT_URL_METHODmodule path (auth.backend→oidc_auth.backend)ALLOWED_HOSTS = ['*']with explicit Shariant hostnamesTest plan
"groups": "not-a-list") is rejected cleanlyALLOWED_HOSTScorrectly rejects requests with an unrecognisedHost:header