GitHub sign-in fails when the OAuth App has more than one redirect URI
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- github, rust
- Ambito
- authentication
Direzione di ricerca
Read login_handler and callback_response in src/web/auth.rs, then trace how the OAuth redirect URI and state cookie are built and validated. Reproduce the flow with two registered callback URIs and compare the callback address with the sign-in origin. Done when sign-in returns to the originating address and the callback accepts its state.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Observed behavior
GitHub sign-in fails with {"error":"Login state is missing or expired."} when the server is reached at an address other than the first redirect URI registered on the OAuth App. With http://127.0.0.1:3000/api/callback registered first and a tunnel's https://<name>.trycloudflare.com/api/callback added second, signing in from the tunnel address failed this way. Signing in from the tunnel worked once the tunnel's callback was the only redirect URI on the app.
Expected behavior
Signing in returns to the address the sign-in started from, as long as that address's callback is registered on the OAuth App.
Reproduction
- Register a GitHub OAuth App with two redirect URIs,
http://127.0.0.1:3000/api/callbackfirst and a second origin's/api/callbackafter it. GitHub's OAuth App settings now accept up to ten. - Set
GITHUB_CLIENT_ID,GITHUB_CLIENT_SECRETandSESSION_SECRET, runcargo run -- web, and expose port 3000 on the second origin (I usedcloudflared tunnel --url http://127.0.0.1:3000). - Open
/peer-lobbyon the second origin and press Sign in with GitHub, then Authorize. - The page shows
{"error":"Login state is missing or expired."}.
CodeTrial version
codetrial 0.1.0 (5e00eab), built from source on Windows 11. The working tree had uncommitted changes in desktop/, src/config.rs, src/launch.rs and src/web/setup_edit.rs, none of them in the sign-in path.
Initial analysis
- Path:
login_handlerinsrc/web/auth.rs:127(at 5e00eab) builds the authorize URL as{oauth_base}/login/oauth/authorize?client_id=...&state=...&scope=...with noredirect_uri. The state cookie it sets belongs to the origin the request came in on. - Evidence: the authorize URL in the browser carried only
client_id,stateandscope. Withoutredirect_uri, GitHub redirects to the app's default callback, which for an app with several redirect URIs is the first one.callback_response(src/web/auth.rs:292) then runs on127.0.0.1, which never received the state cookie, and returns the 401 above. - Hypothesis: the redirect landed on
http://127.0.0.1:3000/api/callback. I did not capture the address bar after the failure; repeating step 3 and reading it would confirm or refute this.
Two directions, not yet compared against the code: send redirect_uri built from the request's origin, which needs the Host the server already accepts through CODETRIAL_ALLOWED_HOSTS and the proxy settings; or keep the single-callback design and say in the docs and in the error that the app must have exactly one redirect URI, for the origin users sign in from.
Sanitized evidence
{"error":"Login state is missing or expired."}
- I removed credentials, session tokens, candidate recordings, and personal interview content from this public report.
- Lingua principale
- Rust
- Stelle
- 228
- Fork
- 150
- Merge medio
- 1g 3h
- PR unite (30g)
- 230
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di sysprog21/codetrial
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
sysprog21/codetrial#646 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
sysprog21/codetrial#645 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Show recorded scores in past attempt rowsForse già presa @liehcheng l’ha presa 3 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
sysprog21/codetrial#604 · 4 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Calibration can pass invalid assessability dataForse già presa @Jonathas2127 l’ha presa oggi. Aperta
sysprog21/codetrial#649 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
A failed GitHub sign-in shows only a JSON errorForse già presa @Ray891220 l’ha presa oggi. Aperta
sysprog21/codetrial#644 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di sysprog21/codetrial
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
software-mansion/pathfinder#3620 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
bug priority: low
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
storytold/wordcraft#6211 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
backlog multiple issues priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
storytold/pdfcraft#6911 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
DGNIMPORT: "The DGN model has nothing that can be imported" when the first element streams are emptyAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
HakanSeven12/OpenCADStudio#2820 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno