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
I’ll trace S3’s raw URI/key parsing and error mapping, then add focused coverage for both PutObject and DeleteObject before running the relevant tests.
- Assistant
rgisn’t installed in this workspace, so I’m switching to repository-localfind/grepsearches and keeping the scope on S3. - Assistant
The current code deliberately allows balanced relative segments but maps traversal above the bucket to
InvalidKey. I’m narrowing the fix to literal..URI segments that cross above the key root: Put/Delete will return a bare 400, while encoded-key validation and other S3 error shapes remain unchanged. - Assistant
The implementation compiles. The focused test run has reached Quarkus test startup; I’m checking the raw and encoded traversal cases together to guard the existing encoded-error behavior.
- Assistant
The first test exposed an important routing detail: Quarkus normalizes the path before JAX-RS dispatch, so
/bucket/../keylands on the bucket route even though Vert.x retains the original URI. I’m handling the retained raw URI at both possible dispatch points so the wire response is correct regardless of router normalization. - Assistant
A follow-up run caught an overgeneralization in virtual-host detection: after normalization, the route’s
bucketparameter is no longer the original bucket name. I’m reverting that inference and using the raw path’s path-style layout, which exactly matches the reported AWS CLI request and preserves the passing behavior. - Assistant
The corrected focused suite now passes, including raw Put/Delete empty-body responses, encoded traversal retaining
InvalidKey, and allowed balanced traversal. I’m running the full S3 integration class as the final regression check.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.