server: fail login fast when the configured issuer is not the proxy-advertised one - #314
Closed
qu0b wants to merge 1 commit into
Closed
server: fail login fast when the configured issuer is not the proxy-advertised one#314qu0b wants to merge 1 commit into
qu0b wants to merge 1 commit into
Conversation
…sed one
/auth/metadata advertises a coherent login contract: issuer plus the scope
set that issuer understands. BeginLogin mixed halves of two contracts by
applying the advertised scopes to whatever issuer the local config pinned.
A config from before the Authentik switch pointed at the legacy Dex issuer,
so login requested the Authentik-only "workflows" scope from Dex, which
rejects unknown scopes: the device flow died in the browser with
invalid_scope ("Bad Request - request was missing parameters") after the
user had already entered the code.
Refuse to start the device flow when the advertised issuer differs from the
configured one, and say how to migrate (re-run panda init, restart the
server). Issuer comparison ignores a trailing slash: Authentik's issuer
requires it while other layers may carry it trimmed. Older proxies that
advertise no issuer keep today's behavior.
Contributor
🐼 Smoke eval —
|
| question | result | tokens | tools |
|---|---|---|---|
forky_node_coverage |
✅ | 17,082 | 6 |
tracoor_node_coverage |
✅ | 19,000 | 9 |
mainnet_block_arrival_p50 |
✅ | 16,816 | 9 |
list_datasources |
✅ | 13,009 | 2 |
block_count_24h |
✅ | 16,207 | 7 |
missed_slots_24h |
✅ | 21,225 | 15 |
chartkit_default_arrival_distribution |
✅ | 32,778 | 15 |
storage_upload_session_scoped |
✅ | 23,630 | 19 |
🔭 Langfuse traces (8 runs; ⚠️ = failed)
The report walks this branch's commits against the master baseline and the most recent release. A self-contained copy is in the run's eval-smoke-* artifact.
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.
Problem
panda auth loginfrom a config that predates the Authentik switch dies in the browser with Dex's "Bad Request — request was missing parameters" page:Root cause:
/auth/metadataadvertises a coherent login contract — issuer plus the scope set that issuer understands — butBeginLoginmixed halves of two contracts. It adopted the advertised scopes while keeping the configured issuer. Since the production proxy started advertising theworkflowsscope (wagie passthrough, Authentik-only — Authentik cross-grants the audience; Dex rejects unknown scopes outright), every client still configured for the legacy Dex issuer mints a device code that is guaranteed to fail after the user has already entered it in the browser.There is no outcome where a Dex-configured client gets full functionality — Dex physically cannot mint the
workflowsaudience — so degrading silently (dropping the scope) would just recreate the opaque-401 problem this discovery mechanism was built to prevent.Fix
Treat issuer + scopes as one contract at login:
The trailing-slash normalization matters: Authentik's issuer requires the slash while other layers may carry it trimmed — a naive comparison would have broken logins for every correctly configured client.
Refresh flows are untouched: Dex stays a trusted issuer for existing tokens; only interactive login becomes the migration point, which matches the platform's dual-issuer intent.
Testing
TestBeginLoginIssuerGate: mismatch refuses with actionable error and no client built; trailing-slash difference is not a mismatch; absent advertised issuer skips the gate.TestBeginLoginScopeSelection/TestFetchProxyLoginAuthupdated for the widened discovery contract (issuer + scopes).go test -race ./pkg/server/,go vet,golangci-lint: clean.