Commit cafac05
committed
admin: address PR #673 review (slog key, validation parity, 501 sweep)
Three findings from claude + Gemini review on 70213e0:
1) **Issue 1 — `logUnexpectedSourceError` slog key was "table"**
When called for bucket operations the field key was `"table"` but
the value was a bucket name. Log queries on `table=` would find
spurious bucket-error entries; queries on `bucket=` would miss
the audit lines entirely. Renamed the parameter and the slog
key to `resource` so the same forensic query works for both
resource families.
2) **Gemini security-high + Claude Issue 2 — validation divergence**
`handleCreateBucket` only checked `strings.TrimSpace(name) == ""`
while the HTTP path's `validateCreateBucketRequest` also rejects
whitespace-padded names like `" bucket "`. The forward path
would have accepted them, then hit the adapter's
`validateS3BucketName` with a less actionable error message —
different SPA behaviour depending on whether the request was
leader-direct or follower-forwarded. Fix: call
`validateCreateBucketRequest(body)` in `handleCreateBucket`
exactly like `decodeCreateTableRequest` is shared between the
table-side handlers.
3) **Issue 3 — only CREATE_BUCKET tested for nil-BucketsSource → 501**
`DELETE_BUCKET` and `PUT_BUCKET_ACL` had identical
`if s.buckets == nil` guards but no coverage. Replaced
`TestForwardServer_CreateBucket_NoBucketsSourceReturns501` with
a table-driven `TestForwardServer_BucketOps_NoBucketsSourceReturns501`
sweeping all three operations. A future op added without the
nil guard fails CI immediately.
Plus a new `TestForwardServer_CreateBucket_RejectsWhitespacePaddedName`
that pins the validation-parity fix from #2.
Rebased onto the latest `feat/admin-s3-writes` (which now carries
the slice 2a review fixes) so the stack stays clean.1 parent ce4c6ee commit cafac05
2 files changed
Lines changed: 70 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | | - | |
265 | | - | |
266 | | - | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
267 | 273 | | |
268 | 274 | | |
269 | 275 | | |
| |||
503 | 509 | | |
504 | 510 | | |
505 | 511 | | |
506 | | - | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
507 | 519 | | |
508 | 520 | | |
509 | 521 | | |
510 | 522 | | |
511 | | - | |
| 523 | + | |
512 | 524 | | |
513 | 525 | | |
514 | 526 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
477 | | - | |
| 477 | + | |
478 | 478 | | |
479 | | - | |
480 | | - | |
481 | | - | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
482 | 528 | | |
483 | 529 | | |
484 | 530 | | |
485 | | - | |
| 531 | + | |
486 | 532 | | |
487 | 533 | | |
488 | | - | |
489 | | - | |
| 534 | + | |
| 535 | + | |
490 | 536 | | |
491 | 537 | | |
492 | 538 | | |
| |||
0 commit comments