fix(s3): Evaluate S3 CORS against incoming HTTP Requests#131
fix(s3): Evaluate S3 CORS against incoming HTTP Requests#131hectorvent merged 10 commits intohectorvent:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds S3 CORS enforcement to Floci by evaluating stored bucket CORS rules against incoming HTTP requests, enabling AWS-like preflight handling and CORS headers on actual S3 responses (fixes #72).
Changes:
- Added
@OPTIONShandlers inS3Controllerto respond to CORS preflight requests with appropriateAccess-Control-*headers. - Implemented CORS rule evaluation in
S3Serviceand applied it to non-preflight responses via a JAX-RSContainerResponseFilter. - Added an integration test suite covering preflight and actual-request CORS behaviors (including delete/reset scenarios).
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/io/github/hectorvent/floci/services/s3/S3Controller.java | Adds OPTIONS preflight endpoints and constructs CORS preflight responses |
| src/main/java/io/github/hectorvent/floci/services/s3/S3Service.java | Introduces CORS rule parsing/evaluation logic used by controller/filter |
| src/main/java/io/github/hectorvent/floci/services/s3/S3CorsFilter.java | Adds CORS headers to non-OPTIONS S3 responses when a rule matches |
| src/test/java/io/github/hectorvent/floci/services/s3/S3CorsIntegrationTest.java | New integration tests for S3 CORS behavior across multiple scenarios |
| .gitignore | Ignores Zed settings and fixes the posts entry formatting |
src/main/java/io/github/hectorvent/floci/services/s3/S3Controller.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/hectorvent/floci/services/s3/S3Controller.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/hectorvent/floci/services/s3/S3Controller.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/hectorvent/floci/services/s3/S3Service.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/hectorvent/floci/services/s3/S3Service.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/hectorvent/floci/services/s3/S3CorsFilter.java
Outdated
Show resolved
Hide resolved
…ler.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Julian Bruder <94740838+bruderj15@users.noreply.github.com>
…ler.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Julian Bruder <94740838+bruderj15@users.noreply.github.com>
…ler.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Julian Bruder <94740838+bruderj15@users.noreply.github.com>
….java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Julian Bruder <94740838+bruderj15@users.noreply.github.com>
|
Hi @bruderj15, Thanks for taking the time to contribute! We've seen your PR and will take a look soon. To ensure this implementation stays robust, could you also open a PR in our compatibility suite at https://github.com/hectorvent/floci-compatibility-tests? This helps us validate that your changes keep working perfectly as the project evolves. |
Signed-off-by: Julian Bruder <94740838+bruderj15@users.noreply.github.com>
|
Here we go @hectorvent: hectorvent/floci-compatibility-tests#36 |
|
Thanks @bruderj15 |
Summary
Closes #72
The S3 CORS configuration was stored and retrievable, but there was no mechanism to evaluate it against incoming HTTP requests. Specifically:
@OPTIONSendpoint existed → JAX-RS generated a generic200 OKwith no CORS headersContainerResponseFilterexisted → actualGET/PUT/etc. responses with anOriginheader also got no CORS headersAdded mentioned endpoints and filter.
Type of change
fix:)feat:)feat!:orfix!:)AWS Compatibility
Checklist
./mvnw testpasses locally