Commit df0da68
sec(api): renderAuthError Cache-Control: no-store + lang="en" (BUG-API-257/404)
The OAuth / magic-link callback HTML is per-request session-bound state
(the underlying magic-link / OAuth code has been consumed or expired by
the time the error page renders). Two compounding gaps shipped:
1. BUG-API-404 — no Cache-Control. A back-button, service-worker
re-fetch, or intermediate proxy could replay the body, leaking the
"you tried this link" UX state across sessions. Stamp
Cache-Control: no-store (RFC 9111 §5.2.2.5) which is the strongest
stop-cache directive and matches the contract every other
auth-result surface in the api already follows.
2. BUG-API-257 — <html> shipped with no `lang` attribute. WCAG 3.1.1
("Language of Page") requires a programmatically determinable
primary language; assistive tech (VoiceOver, NVDA) falls back to
the OS locale otherwise, mispronouncing English copy in non-English
locales. Pin lang="en" to match the static English-only copy.
Both fix at the single renderAuthError sink — fanning out across every
OAuth / magic-link callback error path (~20 call sites in auth.go +
magic_link.go) without scattering c.Set / template edits.
Coverage block:
Symptom: OAuth/magic-link error HTML missing Cache-Control: no-store
(BUG-API-404) and lang attribute (BUG-API-257)
Enumeration: rg -F 'renderAuthError' internal/handlers/ (~25 sites)
All flow through a single emit point in auth.go:1113
Sites found: 1 emit function (~25 callers)
Sites touched: 1 (single sink fix)
Coverage test: TestAuth_RenderAuthError_StatusAndContentType now pins
- Cache-Control: no-store
- body contains `<html lang="en">`
so a future revert of either fails before merge.
Live verified: pending auto-deploy + curl -sI
'https://api.instanode.dev/auth/email/callback?token=invalid'
| grep -i cache-control
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent bc7cc64 commit df0da68
2 files changed
Lines changed: 31 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1112 | 1112 | | |
1113 | 1113 | | |
1114 | 1114 | | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
1115 | 1133 | | |
1116 | | - | |
| 1134 | + | |
1117 | 1135 | | |
1118 | 1136 | | |
1119 | 1137 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
266 | 272 | | |
267 | 273 | | |
268 | 274 | | |
269 | 275 | | |
270 | 276 | | |
271 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
272 | 284 | | |
273 | 285 | | |
274 | 286 | | |
| |||
0 commit comments