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
Now let me look at the object-level handlers and how they extract keys:
- Assistant
All tests pass (115 integration + 41 service). Final verification:
- Assistant
Done. Summary of the fix:
Problem
For object requests whose key puts a literal dot-dot segment in the request URI (e.g.
PUT /raw-path-bucket/../bad.txtfromaws s3api put-object --key ../bad.txt), Floci returned anInvalidKeyXML error body. Real AWS drops these at the HTTP layer — before S3 request processing — with a bare 400 Bad Request and an empty body.Change (
S3Controller.java)- Extracted the existing dot-dot depth-tracking logic from
validateRawUri()into a reusablepathEscapesWithDotDot(String path)helper (internal..that stays inside the bucket is still allowed, matching prior behavior).
- Extracted the existing dot-dot depth-tracking logic from
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.