forgejo: signing in via OIDC always lands on the root page, discarding redirect_to #291
Etiketter
Inga etiketter
area/backups
area/ci
area/control-panel
area/identity
area/infra
area/observability
area/payments
area/security
area/storage
area/web
blocked
needs-info
needs-triage
ready-for-implementation
type
bug
type
chore
type
docs
type
epic
type
feature
type
task
wontfix
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Inget förfallodatum satt.
Beroenden
Inga beroenden satta
Referens
bitborg/bitborg-infra#291
Läser in…
Hänvisa till i nytt ärende
Ingen beskrivning angiven.
Ta bort grenen "%!s()"
Borttagning av en gren är permanent. Även om den borttagna grenen kan fortsätta existera en kort tid innan den faktiskt tas bort, kan det INTE ångras i de flesta fall. Vill du fortsätta?
Signing in through Kanidm always lands the user on the Forgejo root page, discarding any
redirect_todestination. So a deep link like "sign in to comment on this issue" drops them at the dashboard instead of the issue.Observed by walking the journey:
/user/login?redirect_to=%2Fexplore%2Frepos→ Kanidm → signed in → Forgejo root, not/explore/repos.This is pre-existing, not caused by the login redirect (#290)
Worth stating plainly, because the timing invites the wrong conclusion.
Forgejo's own login-page button links to the OIDC start route with no
redirect_to:So in the old flow the parameter was captured by the login page into a
redirect_tocookie, which persisted in the browser; in the new flow the OIDC start route sets the same cookie from the query string that Caddy passes through. Either way aredirect_tocookie exists when the callback runs. The callback ignores it in both cases.The Caddy redirect passes more information than Forgejo's own button did, so it cannot have made this worse.
What is actually happening
The parameter is accepted and stored. Verified:
The control shows the cookie genuinely derives from the parameter. But the callback then discards it:
and the browser ends on
/.A caution recorded for whoever picks this up: the original assessment claimed deep links survived, based on the cookie being set. That was insufficient evidence — "the parameter is accepted" and "the destination is used" are different assertions, and only an actual login distinguishes them. Do not close this issue on header evidence.
Not yet investigated
Whether this is a Forgejo bug worth reporting upstream, or a guard we are tripping.
SignInOAuthCallbackis inrouters/web/auth/oauth.go; reading how it chooses the post-login target would settle it. Candidate explanations, unverified:redirect_tocookie on the OAuth path at all (only for internal sign-in);Consequence for the break-glass hatch
#290's/user/login?local=1bypass is now more valuable than credited when it was added: it is the only way to reach Forgejo's own login page, and it is where any future upstream fix would apply.Done when
Either the behaviour is fixed so a deep link survives OIDC sign-in, or it is confirmed as upstream behaviour with a link to the upstream issue, so nobody re-investigates from scratch.