Make device codes single-use
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 56/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- api, authentication, database
Direzione di ricerca
Read the device_access_token_fetch documentation and trace the POST /device/token handler to the query that fetches the token from device_access_token. Add a nullable time_device_code_used column and make token retrieval set it only when it is still null, so concurrent polls cannot both succeed. Check the repository’s migration and endpoint test patterns; done when the first exchange succeeds and a second or concurrent use returns invalid_grant.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Followup to #11872. With that PR, POST /device/token returns expired_token once a device_code is more than 5 minutes old, but within those 5 minutes it returns the bearer token on every call. Anyone who gets the device_code in that window (from a log or a terminal recording, say) can fetch the token too. Not a huge deal given the 5 minute window, but ideally we would delete or invalidate the code the first time it's used.
RFC 8628 doesn't require single use. It only gives the code a lifetime (expires_in, §3.2). RFC 6749 requires it for authorization codes in the authorization code grant (§4.1.2). Our doc comment on device_access_token_fetch also calls the device code "a single-use high-entropy random token".
The token and the device_code are in one device_access_token row, so we can't delete the row after the exchange. The simplest design I can see is a nullable time_device_code_used column that POST /device/token sets in the query that fetches the token (UPDATE ... WHERE time_device_code_used IS NULL ... RETURNING), so two concurrent polls can't both get it. A second attempt to use the code could return invalid_grant (RFC 6749 §5.2).
Existing rows don't need the column backfilled because their codes expire in 5 minutes anyway (and a system upgrade takes longer than that).
- Lingua principale
- Rust
- Stelle
- 630
- Fork
- 110
- Merge medio
- 2g 2h
- PR unite (30g)
- 160
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun 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 oxidecomputer/omicron
-
Debugging fault-management
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
oxidecomputer/omicron#11831 ·
I maintainer di solito rispondono entro 2 giorni
-
fault-management
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
oxidecomputer/omicron#11444 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
oxidecomputer/omicron#11397 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
oxidecomputer/omicron#11390 ·
I maintainer di solito rispondono entro 2 giorni
-
non-important non-blocker Testing & Analysis
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
oxidecomputer/omicron#11374 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di oxidecomputer/omicron
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
anomalyco/rune#2432 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
[Bug]: Add Data's question says "Link to the file" for a GeoPackage where small tables are copiedApertaunconfirmed possible issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
jerney-nexus/epikrise#364 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
Yeachan-Heo/gajae-code#8058 ·
I maintainer di solito rispondono entro 1 giorno