Commit 2febd42
committed
backup: reject leading-slash S3 object keys (PR #718, round 5)
Codex P1 round 5 (commit 2f87b84):
`safeJoinUnderRoot` permitted an empty first segment so leading-slash
keys like `/a` were accepted and then normalised by `filepath.Join`
to the same output path as `a`. S3 treats `/a` and `a` as two
distinct keys (the literal byte '/' is part of the key), so a
bucket containing both produced last-flush-wins corruption with no
KEYMAP record. The "absolute path collapses safely under bucket
dir" comfort the previous behaviour leaned on was false comfort:
the collapse silently merged distinct user data.
Now empty segments are refused everywhere — leading, mid-path, and
trailing — with ErrS3MalformedKey. Operators with leading-slash
keys must rename them in S3 first.
The previous test `TestS3_AbsolutePathObjectKeyConfinedUnderBucket`
(which asserted the wrong behaviour) is replaced by
`TestS3_LeadingSlashObjectKeyRejected`.1 parent 2f87b84 commit 2febd42
2 files changed
Lines changed: 24 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
672 | 672 | | |
673 | 673 | | |
674 | 674 | | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
675 | 682 | | |
676 | | - | |
| 683 | + | |
677 | 684 | | |
678 | 685 | | |
679 | 686 | | |
680 | 687 | | |
681 | 688 | | |
682 | | - | |
683 | | - | |
684 | | - | |
685 | | - | |
686 | | - | |
687 | | - | |
688 | | - | |
689 | | - | |
690 | | - | |
691 | | - | |
| 689 | + | |
| 690 | + | |
692 | 691 | | |
693 | 692 | | |
694 | 693 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
287 | | - | |
| 287 | + | |
288 | 288 | | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
307 | 302 | | |
308 | 303 | | |
309 | 304 | | |
| |||
0 commit comments