Commit e9d5272
authored
[CRCR] Use standard checkAuthWithApiToken for HUD API auth (#8144)
## Summary
After #8143, the CRCR relay Lambda sends the standard
`x-hud-internal-bot` header (with `HUD_BOT_KEY`) instead of the custom
`X-OOT-Relay-Token` header.
This PR uses the standard `checkAuthWithApiToken()` from
`lib/auth/auth.ts` — the same function used by other HUD internal APIs
(e.g. `/api/benchmark/get_time_series`).
**What changes:**
- **`results.ts`**: Replaces the custom 10-line auth block (crypto
import, `timingSafeEqual`, manual env var check) with a 3-line call to
`checkAuthWithApiToken()`
- **`ootResults.test.ts`**: Mocks `checkAuthWithApiToken` instead of
manually setting env vars and headers for each auth test case
**Why this works:**
- `checkAuthWithApiToken()` checks the `x-hud-internal-bot` header
against `process.env.INTERNAL_API_TOKEN` — exactly what the relay now
sends
- `INTERNAL_API_TOKEN` is already provisioned on Vercel (no new secrets
needed)
- `OOT_RELAY_TOKEN` was never provisioned — this eliminates a dead env
var dependency
## Test plan
- [ ] Confirm relay Lambda's `HUD_BOT_KEY` (in Secrets Manager) matches
Vercel's `INTERNAL_API_TOKEN`
- [ ] Trigger a CRCR dispatch from `pytorch/crcr-test` and verify the
callback reaches HUD without 401
CC @groenenboomj @jewelkm891 parent d45eb38 commit e9d5272
2 files changed
Lines changed: 13 additions & 48 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 27 | + | |
| 28 | + | |
39 | 29 | | |
40 | 30 | | |
41 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
14 | 19 | | |
15 | 20 | | |
16 | 21 | | |
17 | 22 | | |
18 | | - | |
| 23 | + | |
19 | 24 | | |
20 | 25 | | |
21 | 26 | | |
| |||
64 | 69 | | |
65 | 70 | | |
66 | 71 | | |
67 | | - | |
68 | | - | |
69 | 72 | | |
70 | | - | |
71 | 73 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
| 74 | + | |
76 | 75 | | |
77 | 76 | | |
78 | 77 | | |
| |||
82 | 81 | | |
83 | 82 | | |
84 | 83 | | |
85 | | - | |
86 | | - | |
| 84 | + | |
| 85 | + | |
87 | 86 | | |
88 | 87 | | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | 88 | | |
114 | 89 | | |
115 | 90 | | |
| |||
0 commit comments