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
I'll locate S3 key normalization and where object operations are handled so we can reject paths that escape the bucket root.
- Assistant
Verifying whether traversal keys can mutate storage before validation runs.
- Assistant
Implementing centralized key validation in
S3Servicebefore any storage operations, and updating the controller to use it. - Assistant
S3 object keys that normalize above the bucket root are now rejected with HTTP 400 and
InvalidKeybefore any storage is touched.Changes
S3Service.validateObjectKey()— Centralized validation using path normalization against a sandbox root. Keys like../outside.txtordir/../../../etc/passwdthrowInvalidKey; keys likedocs/../file.txtthat stay within the bucket are still allowed.Early validation — Called before any object store or filesystem access in:
storeObject(put/copy/multipart complete)getStoredObject(get/head/metadata)deleteObject- Tagging, retention, and legal-hold operations
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.