ISSUE DESCRIPTION [BUG] S3 dot-dot object requests return InvalidKey Service Amazon S3…
- User
ISSUE DESCRIPTION
[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.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call ) using or commands. However you don't need to use or before submitting your changes. In fact, only submits currently unstaged changes because it uses to get the changes that need to be submitted. - Floci version / image tag: local Docker image built from main commit
- Assistant
I'll start by exploring the repository structure and searching for how InvalidKey and path validation are handled for S3 object keys.
- Assistant
Let me search with grep for InvalidKey and S3 key validation related code.
- Assistant
I'll inspect the key-validation logic and related tests in the S3 controller and service.
- Assistant
I'll trace where validateRawUri is called and how path traversal errors are returned.
- Assistant
Let me look at more context about what AWS actually returns - maybe there's documentation in the repo or CHANGELOG. Also check AGENTS.md and git history related to this.
- Assistant
I'll inspect how errors are mapped and search for any existing empty-body 400 handling.
- Assistant
There's a recent fix for relative S3 keys — I'll inspect that commit.
- Assistant
I'll check put/delete object handlers and how errors are currently built.
- Assistant
I'll look for more control-flow details and any notes about empty 400 responses.
- Assistant
I'll check how empty-body responses and special exceptions are handled elsewhere.
- Assistant
I'll re-check how listObjects and other endpoints invoke validateRawUri.
- Assistant
I'll change dot-dot validation to return HTTP 400 with an empty body, matching AWS behavior.
- Assistant
I'll add a helper that returns an empty 400 and use it for dot-dot traversal rejection.
- Assistant
I'll check virtual-host routing and whether object ops always run key validation.
- Assistant
I'll compile and run the relevant S3 tests to verify the change.
- Assistant
HOME not set - need to set it.
- Assistant
The empty-body 400 behavior looks correct; I'll verify setup and status codes with a focused temp test.
- Assistant
I'll write a short Quarkus or unit-level check for empty 400 vs InvalidKey for null bytes.
- Assistant
I'll start the packaged app and reproduce the issue with curl.
- Assistant
I'll reproduce PutObject with a
../key and confirm the empty 400 response. - Assistant
I'll try reproducing with the AWS CLI the same way the issue does.
- Assistant
Need to install aws cli
- Assistant
I'll use curl --path-as-is to preserve
..segments like a raw client would. - Assistant
Confirmed: raw and encoded
..keys return empty 400. Stopping the server and reviewing the diff.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.