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 validates S3 object keys and handles dot-dot path segments.
- Assistant
Implementing empty 400 responses for dot-dot URI segments to match AWS behavior.
- Assistant
Updating integration tests to expect an empty 400 response body.
- Assistant
The encoded-slash case also produces a
..URI segment after decoding, so it should return an empty 400. Updating that test and running the full integration suite. - Assistant
Fixed. When an S3 object request URI contains a
..path segment that would escape the bucket prefix (e.g.PUT /bucket/../bad.txt), Floci now returns HTTP 400 with an empty body, matching AWS. Previously it returned an XMLInvalidKeyerror.Cause
validateRawUri()already detected dot-dot segments in the request path, but threwAwsException("InvalidKey", ...), which was serialized as XML. Object operations (PutObject,DeleteObject, etc.) also skipped this check and relied only onvalidateKeyNoTraversal(), which produced the sameInvalidKeyresponse.Fix
S3UriDotDotException— marker exception for dot-dot URI rejectionS3UriDotDotExceptionMapper— maps it to400with no bodyvalidateRawUri()— throwsS3UriDotDotExceptioninstead ofInvalidKeywhen..would escape the bucket- — calls so all object operations get this check
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.