Commit 6e2d0f4
fix: APIトークンの定数時間比較とCSPRNG生成に変更
timing attackを防止するため、auth_middlewareのBearer Token比較を
subtle::ConstantTimeEqによる定数時間実装に変更。
トークン生成もUUID v4 (122-bit)からCSPRNG 256-bit hexに強化。
- auth_middleware: == → ct_eq (subtle クレート)
- main.rs: uuid::Uuid::new_v4() → rand::random::<[u8; 32]>()
- 認証失敗時のtracing::warnログを追加
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent a60f821 commit 6e2d0f4
4 files changed
Lines changed: 16 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
201 | 202 | | |
202 | 203 | | |
203 | 204 | | |
204 | | - | |
205 | | - | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
206 | 212 | | |
207 | 213 | | |
208 | 214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
| |||
0 commit comments