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
Now let me look at how object handlers get the key and where
extractObjectKeyis used, plus the controller's class-level setup: - Assistant
Now compile and run the focused tests:
- Assistant
The reproduction is fixed. Now stop the dev server and run the broader S3 test suite:
- Assistant
All 549 S3-related tests pass except the single pre-existing test that asserts the buggy behavior. Final verification of the diff:
- Assistant
The fix is complete. Summary:
Root cause
When a client sends an object request with a literal dot-dot in the URI (e.g.
PUT /raw-path-bucket/../bad.txtfromaws s3api put-object --key ../bad.txt), Vert.x normalizes the path before JAX-RS routing, so the request lands in a bucket-level handler wherevalidateRawUri()threwAwsException("InvalidKey", ...)— producing an S3 XML error body. Real AWS rejects such URIs at the HTTP front end with a plain 400 Bad Request and an empty body, before any S3 error XML is generated.Change (
src/main/java/io/github/hectorvent/floci/services/s3/S3Controller.java)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.