S3 object keys can escape above the bucket root during path normalization Reject keys…
- User
S3 object keys can escape above the bucket root during path normalization
Reject keys whose normalized path escapes above the bucket root with HTTP 400 and the S3 error code
InvalidKey, without creating, deleting, or modifying object storage.Interface
No new interfaces are introduced.
- Assistant
Now let me look at the multipart initiate and check imports in S3Service:
- Assistant
Now I'll check for any places that build store keys without going through
objectKey/versionedKey: - Assistant
Now compile and run the S3 service tests:
- Assistant
All 41 pass. Now let me verify the critical properties directly — rejection happens before any storage mutation, and in-memory mode also rejects — with a temporary test:
- Assistant
The Write embedded a literal NUL byte and the API signatures differ. Rewriting the scratch test:
- Assistant
All 7 pass. Now let me remove the scratch file and fold the important regressions into the existing test class:
- Assistant
All 546 S3 tests pass. Now let me run the full test suite in the background to make sure nothing else (CloudFormation, Lambda, etc. use S3Service) regressed:
- Assistant
While that runs, let me review the final state of the changes:
- Assistant
The background test run will notify on completion — I'll report the final result then.
- Assistant
The suite is still running (output is buffered until completion). I'll report as soon as it finishes.
- Assistant
The background test task will re-invoke me when it exits — ending my turn here; I'll confirm the full-suite result in the follow-up.
- Assistant
The full suite shows 85 failures — I need to determine whether these are caused by my change or pre-existing. Let me look:
- Assistant
The log only kept the tail. Let me rerun with a full log to identify the failures:
- Assistant
I'll report the failure analysis when it completes.
- Assistant
Confirmed: the ECR/Neptune failures reproduce identically on the unmodified baseline (
94a8bdac), so all 85 full-suite failures are pre-existing environmental issues (WebSocket/Lambda/ECR/Neptune — unrelated to S3). My changes are restored in the working tree.Summary
The vulnerability: Object-key traversal was only guarded at the disk-write layer (
resolveObjectPath), which left three gaps:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.