Repository navigation
Conversation
…6934) The OidcAuthVerifier initializer stripped a trailing slash from the configured KEEP_OIDC_ISSUER, but that same value is compared verbatim against the token's iss claim. Providers whose issuer ends with a slash (e.g. Authentik) therefore failed every login with 'Invalid token: Invalid issuer'. The issuer now reaches jwt.decode unaltered; the trailing-slash normalization moves to the one place that needs it, the discovery URL join in _discover_jwks_uri, so {issuer}/.well-known/openid-configuration never gets a double slash. Regression coverage: an issuer with a trailing slash verifies a token whose iss carries that slash (previously a 401), and the discovery URL is single-slash-joined with and without a trailing slash. Both tests fail without this change. Fixes keephq#6934
This branch has not been deployed
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.
Fixes #6934.
What
OidcAuthVerifier.__init__stripped a trailing slash from the configuredKEEP_OIDC_ISSUER, but the same value is then passed tojwt.decode(..., issuer=self.oidc_issuer)for an exactisscomparison. With an IdP whose issuer ends with a slash (e.g. Authentik), every login failed withInvalid token: Invalid issuer.jwt.decodeunaltered._discover_jwks_urinow joins{issuer.rstrip('/')}/.well-known/openid-configuration, so discovery never produces a double slash. This is the same split the reporter verified in the issue.Tests
Two regression tests in
tests/test_oidc_auth.py:test_oidc_issuer_trailing_slash_preserved- issuer configured with a trailing slash, tokenisscarries the slash, verification succeeds (previously a 401).test_oidc_discovery_url_normalizes_trailing_slash- the discovery URL is single-slash-joined with and without a trailing slash on the configured issuer.Both tests fail on main and pass with this change. Full
tests/test_oidc_auth.py: 15 passed.black --checkandisort --check-onlyclean on the touched files.