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:textAn error occurred (InvalidKey) when calling the PutObject operation: The specified key is invalid.Reproduction
bashprintf '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
I'll trace how Floci validates S3 object keys and handles dot-dot path segments so we can match AWS's 400 with an empty body.
- Assistant
Implementing empty 400 responses for dot-dot URI segments: extending
AwsExceptionwith an empty-body flag, updating validation, and fixing tests. - Assistant
Updating integration tests to expect an empty 400 body for dot-dot URI traversal.
- Assistant
Fixed. S3 object requests with a
..path segment in the URI now return HTTP 400 with an empty body, matching AWS.Root cause
validateRawUri()already detected dot-dot segments in the request path, but:- It was not called for object operations (
PutObject,DeleteObject,GetObject, etc.) — only bucket-level routes used it. - When it did fire, it threw an
InvalidKeyerror that became an XML error body instead of an empty 400.
Changes
AwsException.emptyResponse(400)— new factory for HTTP errors with no response body.validateRawUri()— throwsAwsException.emptyResponse(400)when a..segment would escape above the bucket prefix.extractObjectKey()— callsvalidateRawUri()so all object operations get the check.
- It was not called for object operations (
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.