Commit 8b7e3c6
feat: add SkipAuthHandler for local dev authentication bypass (#2181)
## Summary
- Adds `SkipAuthHandler` as the first handler in the auth middleware
chain
- When `SKIP_AUTH=true` (local dev `.env`), injects a mock admin
identity and short-circuits auth
- When `SKIP_AUTH` is absent or not `'true'` (all deployed
environments), returns `null` and the chain falls through to the real
handlers — zero production impact
- Fixes 401 errors when running the API service locally via `make
run-api` in the mysticat-workspace local dev environment
## Context
The local dev environment sets `SKIP_AUTH=true` in `.env`, but
previously no auth handler recognized this variable. All four real
handlers (JWT, IMS, ScopedApiKey, LegacyApiKey) would fail and return
401 because the UI sends no credentials in local dev mode.
## Test plan
- [x] Unit tests pass (7791 passing, 1 pre-existing flaky timeout)
- [ ] `make run-api` in mysticat-workspace local dev → API responds 200
without auth headers
- [ ] Deployed environments unaffected (`SKIP_AUTH` is never set)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent e71ddcd commit 8b7e3c6
1 file changed
Lines changed: 34 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
136 | 137 | | |
137 | 138 | | |
138 | 139 | | |
| 140 | + | |
139 | 141 | | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
| 142 | + | |
| 143 | + | |
144 | 144 | | |
145 | | - | |
146 | | - | |
147 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
148 | 149 | | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
154 | 154 | | |
155 | | - | |
156 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
157 | 162 | | |
158 | 163 | | |
159 | 164 | | |
160 | 165 | | |
161 | 166 | | |
162 | | - | |
163 | 167 | | |
164 | 168 | | |
165 | 169 | | |
166 | 170 | | |
167 | 171 | | |
168 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
169 | 184 | | |
170 | 185 | | |
171 | 186 | | |
| |||
329 | 344 | | |
330 | 345 | | |
331 | 346 | | |
332 | | - | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
333 | 350 | | |
334 | 351 | | |
335 | 352 | | |
| |||
0 commit comments