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: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.
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 callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto 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 locating how S3 object keys and InvalidKey errors are handled.
- Assistant
Let me search more specifically for InvalidKey and S3 key validation.
- Assistant
rg is not available, let me use grep instead.
- Assistant
Inspecting the key-validation logic and related tests in the S3 controller.
- Assistant
Based on the issue description:
- Assistant
Let me look at git history related to this and how Response is returned for empty 400. Also look at AwsExceptionMapper.
- Assistant
Looking at the recent fix for relative S3 keys and how PutObject handles errors.
- Assistant
Checking AwsException and any existing empty-body error patterns.
- Assistant
Checking imports and deleteObject handling so we can return an empty 400 for URI gram-dot traversal.
- Assistant
Updating traversal validation so it returns HTTP 400 with an empty body, matching AWS behavior.
- Assistant
I'll update path-traversal validation to throw
WebApplicationExceptionwith an empty 400 response. - Assistant
Checking the other
validateKeyNoTraversalcall site and whether exception handling might swallowWebApplicationException. - Assistant
Looking at postObject form at line 2242 which might catch Exception and convert WAE incorrectly.
- Assistant
Running the relevant S3 tests to verify the fix.
- Assistant
HOME not set - let me set it.
- Assistant
Internal-traversal 404s look like missing test setup when running filtered tests. Verifying with the full integration class setup.
- Assistant
Yes' - tests need createBucket first. Let me run createBucket + the one that needed internal traversal + the path covered tests.
- Assistant
Confirmed: 400 responses now have empty bodies; internal traversal still works. Running the service-layer tests next.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.