Untitled conversation
- User
[BUG] S3 dot-dot object requests return InvalidKey
Service
AWS API Action
Expected behavior
AWS behavior rejects object requests whose key causes a dot-dot path segment to appear in the request URI with HTTP 400 Bad Request and an empty response body.
Actual behavior
Floci returns an
InvalidKeyerror body:An error occurred (InvalidKey) when calling the PutObject operation: The specified key is invalid.Reproduction
printf 'safe-data' > body.txt aws --endpoint-url http://localhost:4566 s3api create-bucket \ --bucket raw-path-bucket aws --endpoint-url http://localhost:4566 s3api put-object \ --bucket raw-path-bucket \ --key ../bad.txt \ --body body.txtEnvironment
- Floci version / image tag: local Docker image built from main commit
a7b0826c - Java SDK version (if applicable): N/A; verified with AWS CLI
- How you're running Floci (Docker / native /
mvn quarkus:dev): Docker
Interface
No new interfaces are introduced.
- Floci version / image tag: local Docker image built from main commit
- Assistant
Investigating how Floci handles S3 object keys with dot-dot segments and comparing that to AWS's expected 400 Bad Request behavior.
- Assistant
Checking object endpoint structure and whether a dedicated exception mapper pattern exists.
- Assistant
Implementing the fix: AWS returns HTTP 400 with an empty body for dot-dot URI segments, but Floci throws
InvalidKeybecausevalidateRawUri()isn't called on object operations and returns XML errors when it is. - Assistant
Updating tests to expect an empty 400 response for dot-dot URI traversal.
- Assistant
Running the relevant S3 tests:
- Assistant
Dot-dot tests passed. The internal-traversal failure is from running an ordered test in isolation. Running the full S3 integration test suite:
- Assistant
Fixed the S3 dot-dot URI handling to match AWS behavior.
Root cause: Object operations (
PutObject,DeleteObject, etc.) never calledvalidateRawUri(), so requests likePUT /bucket/../bad.txtfell through tovalidateKeyNoTraversal()and returned anInvalidKeyXML error instead of HTTP 400 with an empty body.Changes:
-
validateRawUri()inextractObjectKey()— All object operations now check the raw request URI for..path segments before key extraction. -
S3InvalidRequestUriException+ mapper — When a..segment would escape the bucket prefix (depth 0), Floci throws this exception and the mapper returns HTTP 400 with no body, matching AWS. -
Tests updated — Dot-dot URI traversal tests now assert
statusCode(400)andbody(equalTo("")). Added coverage for the reported reproduction case (PUT /bucket/../bad.txt) andDeleteObjectwith the same URI pattern.
Internal traversal like still works (the is nested under a real path segment). Service-layer checks for keys like passed directly to are unchanged — that path doesn't go through HTTP URI validation.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.