Skip to content

fix: enforce S3 limits and reject negative/fractionals - #1237

Merged
ferhatelmas merged 1 commit into
masterfrom
ferhat/s3-amend
Jul 16, 2026
Merged

fix: enforce S3 limits and reject negative/fractionals#1237
ferhatelmas merged 1 commit into
masterfrom
ferhat/s3-amend

Conversation

@ferhatelmas

Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

Part number caps or default didn't honor S3 expectations.
Validator is using number, not integer so it can accept floats.

What is the new behavior?

Align them with S3.
Change number type to integer where applicable.

Additional context

List objects has an old behavior to change 0 to 1000 but kept old behavior.
Get/Head object doesn't support part at the moment. Would be nice to add separately.

Copilot AI review requested due to automatic review settings July 16, 2026 10:03
@ferhatelmas
ferhatelmas requested a review from a team as a code owner July 16, 2026 10:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aligns the S3-compatible API with S3 limits by defaulting/capping list-multipart-uploads behavior and tightening request validation to reject negative and fractional values (and enforce known S3 ranges for multipart part numbers and paging parameters).

Changes:

  • Default ListMultipartUploads MaxUploads to 1000 and add a handler-level unit test for the default.
  • Update S3 route JSON schemas from number to integer and add min/max bounds for multipart-related parameters.
  • Add router validation tests covering integer-only constraints and S3 ranges across multipart/list operations.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/storage/protocols/s3/s3-handler.ts Updates ListMultipartUploads default limit behavior.
src/storage/protocols/s3/s3-handler.test.ts Adds coverage for the 1000 default behavior.
src/http/routes/s3/router.test.ts Adds validation tests for integer-only and S3-range constraints.
src/http/routes/s3/commands/upload-part.ts Enforces partNumber as integer within 1–10000.
src/http/routes/s3/commands/upload-part-copy.ts Enforces partNumber as integer within 1–10000.
src/http/routes/s3/commands/list-parts.ts Enforces max-parts as integer within 1–1000.
src/http/routes/s3/commands/list-objects.ts Enforces max-keys as a non-negative integer.
src/http/routes/s3/commands/list-multipart-uploads.ts Enforces max-uploads as integer within 1–1000.
src/http/routes/s3/commands/complete-multipart-upload.ts Enforces completed part numbers within 1–10000.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/storage/protocols/s3/s3-handler.ts Outdated
@coveralls

coveralls commented Jul 16, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 29491592036

Coverage decreased (-0.1%) to 79.48%

Details

  • Coverage decreased (-0.1%) from the base build.
  • Patch coverage: 4 of 4 lines across 2 files are fully covered (100%).
  • 20 coverage regressions across 3 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

20 previously-covered lines in 3 files lost coverage.

File Lines Losing Coverage Coverage
src/internal/http/agent.ts 17 32.56%
src/http/routes/s3/index.ts 2 82.99%
src/http/plugins/db.ts 1 82.47%

Coverage Stats

Coverage Status
Relevant Lines: 12730
Covered Lines: 10565
Line Coverage: 82.99%
Relevant Branches: 7421
Covered Branches: 5451
Branch Coverage: 73.45%
Branches in Coverage %: Yes
Coverage Strength: 425.28 hits per line

💛 - Coveralls

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comment thread src/http/routes/s3/commands/list-multipart-uploads.ts
Comment thread src/http/routes/s3/commands/list-multipart-uploads.ts
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

@ferhatelmas
ferhatelmas merged commit fca6e88 into master Jul 16, 2026
25 of 27 checks passed
@ferhatelmas
ferhatelmas deleted the ferhat/s3-amend branch July 16, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants