Skip to content

UploadPart requires a per-part checksum header that AWS S3 computes server-side #46

Closed

Description

@Vonng

Expected Behavior

UploadPart on a multipart upload that declared a checksum algorithm should succeed even
when the request carries no x-amz-checksum-* header. AWS S3 computes the part checksum
server-side using the algorithm recorded at CreateMultipartUpload; supplying it is a
client-side integrity option, not a requirement.

Current Behavior

If CreateMultipartUpload declared x-amz-checksum-algorithm, every subsequent
UploadPart must carry a matching x-amz-checksum-* header, or the request is rejected:

400 InvalidArgument: Invalid arguments provided for <path>: (checksum missing, want "CRC32", got "")

This happens for both FULL_OBJECT and COMPOSITE uploads, on the single-drive and
erasure backends.

Source: cmd/erasure-multipart.go, erasureObjects.PutObjectPart

if cs := fi.Metadata[hash.MinIOMultipartChecksum]; cs != "" {
    if r.ContentCRCType().String() != cs {
        return pi, InvalidArgument{
            ...
            Err: fmt.Errorf("checksum missing, want %q, got %q", cs, r.ContentCRCType().String()),
        }
    }
}

Impact

Clients that do not attach per-part checksums cannot use checksum-enabled multipart uploads
at all. Most notably this includes any AWS SDK configured with
request_checksum_calculation = when_required (the default is when_supported, which does
attach them), and any SDK or hand-rolled client that only sets the algorithm at initiation.

Note this is not the same defect as #31. #31 was about the completion body and is
fixed; this one is about upload. A client hitting this gets InvalidArgument rather than
InvalidPart, but is equally unable to upload.

Possible Solution

Have the server compute the part checksum with the upload's declared algorithm when the
client does not supply one, and keep validating the client-supplied value when it is
present. This requires wiring the multipart upload's checksum type into the part reader in
PutObjectPartHandler rather than relying on hash.Reader.AddChecksum picking it up from
request headers.

Context

Found while root-causing #31. Verified by an API-level probe issuing UploadPart with no
checksum header against both backends.

Activity

  1. Vonng commented on Jul 29, 2026

    @Vonng
    MemberAuthor

    Follow-up after an independent audit of this report. Two corrections/additions.

    1. UploadPartCopy is broken the same way — this widens the issue

    upload_part_copy fails on any checksum-enabled multipart upload, not just UploadPart.
    Verified against a running server with boto3 1.43.58:

    upload_part_copy (ChecksumType=FULL_OBJECT) -> InvalidArgument: Invalid arguments provided for ...
    upload_part_copy (ChecksumType=COMPOSITE)   -> InvalidArgument: Invalid arguments provided for ...
    upload_part_copy (no checksum algorithm)    -> OK  etag="618ed206b40cee1b1d9f9a0cd9b9889a"
    

    Same root cause, one layer up: CopyObjectPartHandler builds its reader with

    srcInfo.Reader, err = hash.NewReader(ctx, reader, length, "", "", actualPartSize)

    and never calls AddChecksum, so r.ContentCRCType() is ChecksumNone by the time
    PutObjectPart performs its checksum missing, want %q, got %q check. There is no request
    header a client could add to satisfy it — UploadPartCopy has no request body to checksum —
    so for a copy-based part this is unconditionally fatal, whereas UploadPart at least has a
    workaround (send the header).

    Any fix here has to cover both handlers.

    2. The fix is not the same for both checksum types

    The observation in the issue body holds for both types — AWS's
    UploadPart reference
    documents x-amz-checksum-* as "This header can be used as a data integrity check",
    its sample request carries no checksum header at all, and the response header is documented
    as "only be present if the checksum was provided in the request". So AWS does not reject a
    part that omits it, for either type.

    But the remedy differs, and a naive relaxation would break composite uploads:

    • FULL_OBJECT — the server can compute the part checksum with the upload's algorithm and
      merge it; nothing else needs to change.
    • COMPOSITE — the completion body must still carry a checksum for every part
      (InvalidRequest on AWS if one is missing), so simply dropping the UploadPart check
      would move the failure to completion time rather than fix it. The server has to record the
      computed part checksum so ListParts can hand it back and completion can validate it.

    Whoever picks this up should treat them as two cases, not one flag.

  2. added this to Siloand Siloon Aug 4, 2026
  3. Vonng commented on Aug 6, 2026

    @Vonng
    MemberAuthor

    Triage note: this report and the related multipart-checksum conformance issues (#47, #48, #50) are batched as one work item, targeted at an early follow-up release after RELEASE.2026-08-06. The rebrand release intentionally froze S3-visible behavior at its acceptance-tested baseline, so none of these changes ride along with it. Given the UploadPartCopy finding above affects default SDK checksum flows, this batch sits at the top of the post-release queue.

  4. cbornet commented on Aug 19, 2026

    @cbornet

    FULL_OBJECT — the server can compute the part checksum with the upload's algorithm and
    merge it; nothing else needs to change.

    When FULL_OBJECT is used, is the full-object checksum currently computed from the parts checksum ? Or is it computed on the assembled part data ? If it's the latter, a quick fix would be to not check the part checksums if the mode is FULL_OBJECT. Computing and storing the part checksums server-side and combining them could be done as a second step.
    At least this would make FULL_OBJECT work correctly without part checksum client computation.

  5. Vonng commented on Aug 24, 2026

    @Vonng
    MemberAuthor

    @cbornet Thank you for raising this point. The full-object checksum is computed from the stored part checksums; completion does not re-read the assembled object data.

    CompleteMultipartUpload requires the checksum stored in each ObjectPartInfo. For FULL_OBJECT, it combines those values with Checksum.AddPart; if a part checksum is absent, completion fails with InvalidPart.

    Therefore, skipping only the upload-time check would defer the failure to completion. The selected fix computes and persists the missing part checksum during UploadPart and UploadPartCopy, while client-supplied checksums remain authoritative and continue to be validated.

  6. Vonng commented on Aug 24, 2026

    @Vonng
    MemberAuthor

    Implementation status:

    The fix has been implemented locally in 7fea6d5a5 and is pending push and remote CI.

    • Client-supplied part checksums are validated and stored as before.
    • When the client omits the checksum, SILO computes it over the logical plaintext stream before compression or encryption and stores it in the existing part metadata.
    • A normal UploadPart returns a checksum only when the client supplied one.
    • UploadPartCopy returns the server-computed checksum in CopyPartResult.
    • FULL_OBJECT CRC checksums and COMPOSITE CRC/SHA checksums are covered.
    • No on-disk format change or completion-time second read is required.

    The implementation has been verified on the single-drive and erasure backends, including compression, encryption, SSE-C, SSE-S3, ranged copies, multipart merging, zero-length parts, and part replacement. The full test suite, race tests, vet, lint, and compatibility guard pass.

    Related but independent paths remain tracked in #63 and #64.

    Conclusion: the implementation addresses the compatibility defect reported here. This issue will remain open until the commit is pushed and remote CI completes successfully.

  7. added
    bug
    on Aug 24, 2026
  8. self-assigned this
    on Aug 24, 2026
  9. moved this from Backlog to In progress in Siloon Aug 24, 2026
  10. added theissue type on Aug 24, 2026
  11. Vonng commented on Aug 25, 2026

    @Vonng
    MemberAuthor

    Resolved on main by 7fea6d5a5. UploadPart and UploadPartCopy now accept omitted optional per-part checksum headers, compute and persist the checksum server-side, and continue to validate client-supplied values. The latest main Go CI and VulnCheck runs are green. Federation-specific behavior remains tracked in #64, and this fix has not yet shipped in a tagged release. Closing as completed.

  12. moved this from In progress to Done in Siloon Aug 25, 2026
  13. cbornet commented on Aug 25, 2026

    @cbornet

    Awesome! Can't wait to test that on a release !

  14. added this to the 20260903 milestone on Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

Projects

  • Status
    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions