Make device codes single-use
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 56/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Área
- api, authentication, database
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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).
- Lenguaje dominante
- Rust
- Estrellas
- 630
- Forks
- 110
- Merge medio
- 2 d 2 h
- PR fusionados (30 d)
- 160
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de oxidecomputer/omicron
-
Debugging fault-management
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
oxidecomputer/omicron#11831 ·
Los mantenedores suelen responder en 2 días
-
fault-management
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
oxidecomputer/omicron#11444 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
oxidecomputer/omicron#11397 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
oxidecomputer/omicron#11390 ·
Los mantenedores suelen responder en 2 días
-
non-important non-blocker Testing & Analysis
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
oxidecomputer/omicron#11374 ·
Los mantenedores suelen responder en 2 días
Todos los issues de oxidecomputer/omicron
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
anomalyco/rune#2432 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
[Bug]: Add Data's question says "Link to the file" for a GeoPackage where small tables are copiedAbiertounconfirmed possible issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 1 día
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
jerney-nexus/epikrise#364 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Yeachan-Heo/gajae-code#8058 ·
Los mantenedores suelen responder en 1 día