fix(S3): enforce presigned POST policy conditions#1211
Open
TylerHillery wants to merge 2 commits into
Open
Conversation
fenos
reviewed
Jul 7, 2026
fenos
reviewed
Jul 7, 2026
fenos
reviewed
Jul 7, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens S3 presigned POST handling by validating POST policy conditions (not just the policy HMAC), preventing policy replay/misuse and enforcing constraint-driven uploads.
Changes:
- Adds POST policy condition validation (e.g.,
eq,starts-with,content-length-range) and rejection of unconstrained submitted fields. - Propagates
content-length-rangemax into the upload pipeline to enforce an effective maximum upload size. - Expands S3 protocol tests to cover key/bucket replay and policy condition enforcement scenarios.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/test/s3-protocol.test.ts | Adds multipart/form-data POST policy enforcement tests (bucket/key replay, expiration, field coverage, content-length-range). |
| src/storage/protocols/s3/signature-v4.ts | Implements policy condition parsing/normalization and validation, plus tracks submitted POST fields for coverage checks. |
| src/http/routes/s3/commands/put-object.ts | Applies policy-derived content-length-range max by tightening the stream byte limit. |
| src/http/plugins/signature-v4.ts | Runs POST policy condition validation after signature verification and stores derived max size on the request. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fenos
reviewed
Jul 7, 2026
fenos
reviewed
Jul 7, 2026
Coverage Report for CI Build 28885889609Coverage increased (+0.1%) to 79.199%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
c96f999 to
fa82c4d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Bug fix to enforce policy conditions in S3 presigned POST url.
What is the current behavior?
Currently only verifies the HMAC over the Policy blob
What is the new behavior?
Properly validates the conditions
Additional context