Commit 3611381
committed
admin: nosniff header + drop dead nil-check (Claude review)
Two minor items from Claude's review on PR #633:
- Add X-Content-Type-Options: nosniff to both writeJSONError and
writeAdminJSON. The admin surface is JSON-only, so MIME sniffing
is never useful and the header guards against XSS-via-sniffing on
any payload that ever reaches the response writer through an
unexpected path. Cookie-gated admin endpoints already constrain
attack surface, but this is cheap defence in depth.
- Remove the dead `if resp.Tables == nil { resp.Tables = []string{} }`
guard from handleList. paginateDynamoTableNames is total over its
input — the "cursor past end" branch returns []string{} and every
other branch returns a real sub-slice, both non-nil. Replace the
guard with a comment that documents the producer-side invariant
so future readers don't assume the function can return nil.1 parent 455ad39 commit 3611381
2 files changed
Lines changed: 18 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
171 | 172 | | |
172 | 173 | | |
173 | 174 | | |
| |||
288 | 289 | | |
289 | 290 | | |
290 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
291 | 299 | | |
292 | 300 | | |
293 | 301 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
280 | 285 | | |
281 | 286 | | |
282 | 287 | | |
| |||
0 commit comments