Skip to content

Metadata-only CopyObject can stamp compression metadata without rewriting data #67

Closed

Description

@Vonng

Problem

An in-place metadata-only CopyObject can apply destination compression metadata even though the object data was not recompressed.

The clearest reproducer is SSE-C key rotation:

  1. Store an SSE-C object while compression is disabled, so the data is uncompressed.
  2. Enable compression for the object extension with allow_encryption enabled.
  3. Copy the object onto itself with the old SSE-C source key and a new destination key.
  4. The key-rotation branch updates metadata only.
  5. The resulting object is marked as S2-compressed even though its data remains uncompressed; subsequent GET attempts to decode it as S2 and fails.

This was independently reproduced on the current main baseline and on the proposed #63 checksum fix. It is not introduced by #63.

Root cause

CopyObjectHandler derives compressMetadata from configuration before it knows whether the operation will rewrite object data. Later, maps.Copy applies that metadata unconditionally. The SSE-C key-rotation branch sets metadataOnly and rotates only the sealed object key, so no compression reader is consumed.

The condition is broader than key rotation: any accepted metadata-only self-copy must not change the compression marker unless it also rewrites the data.

Proposed minimal direction

  • Apply compression metadata only when CopyObject will actually consume the compression reader and rewrite data.
  • Base the decision on the final rewrite state, including server-side checksum recomputation that intentionally forces metadataOnly to false.
  • Do not special-case only SSE-C if the same invariant can be stated once: compression metadata describes the bytes that were actually written.

Acceptance criteria

  • SSE-C metadata-only key rotation keeps an originally uncompressed object uncompressed and readable after compression is enabled.
  • A metadata-only self-copy of an object with an existing full-object checksum cannot stamp a false compression marker.
  • A real CopyObject rewrite still stores compression metadata, compression index, correct ETag, and correct logical checksum.
  • Cover unversioned and versioned buckets.
  • No on-disk format change.

Relationship to other work

Activity

  1. moved this from Backlog to In progress in Siloon Aug 24, 2026
  2. moved this from In progress to Done in Siloon Aug 24, 2026
  3. Vonng commented on Aug 25, 2026

    @Vonng
    MemberAuthor

    Resolved by #69 in 05df6e70d. Metadata and reference-only CopyObject paths now preserve the existing transform state unless object bytes are actually rewritten, preventing compression metadata from being stamped onto unchanged data. Regression coverage includes versioned SSE-C key rotation and related reference-copy paths. The latest main CI is green; this fix has not yet shipped in a tagged release.

  4. added
    bug
    on Sep 15, 2026
  5. self-assigned this
    on Sep 15, 2026
  6. added theissue type on Sep 15, 2026
  7. 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