Make device codes single-use
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 56/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 領域
- api, authentication, database
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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).
- 主要言語
- Rust
- スター
- 630
- フォーク
- 110
- 平均マージ
- 2日 2時間
- マージ済み PR(30日)
- 160
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
oxidecomputer/omicron のほかの issue
-
Debugging fault-management
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
oxidecomputer/omicron#11831 ·
メンテナーはふだん 2 日以内に返信
-
fault-management
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
oxidecomputer/omicron#11444 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
oxidecomputer/omicron#11397 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
oxidecomputer/omicron#11390 ·
メンテナーはふだん 2 日以内に返信
-
non-important non-blocker Testing & Analysis
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
oxidecomputer/omicron#11374 ·
メンテナーはふだん 2 日以内に返信
oxidecomputer/omicron の issue をすべて見る
似ている issue
-
[Bug]: Add Data's question says "Link to the file" for a GeoPackage where small tables are copiedオープンunconfirmed possible issue
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
jerney-nexus/epikrise#364 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Yeachan-Heo/gajae-code#8058 ·
メンテナーはふだん 1 日以内に返信
-
bug daemon
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信