Skip to content

fix: return 500 for unreadable objects instead of 206 - #121

Merged
Vonng merged 1 commit into
mainfrom
fix/issue-110-tampered-status
Sep 6, 2026
Merged

Vonng merged 1 commit into
mainfrom
fix/issue-110-tampered-status

Conversation

@Vonng

@Vonng Vonng commented Sep 5, 2026

Copy link
Copy Markdown
Member

Contribution Licensing (no CLA, inbound=outbound, DCO required)

This project does not use a CLA; contributions are accepted inbound=outbound.
By submitting this pull request I represent that I have the right to contribute
the changes, which are licensed under this repository's
GNU Affero General Public License v3.0 or later
and remain my copyright. Every commit carries a DCO Signed-off-by trailer.

Description

ErrObjectTampered was mapped to HTTP 206 Partial Content, so a GET or HEAD of an object the server cannot decode answered with a success status and an XML error document that SDKs handed back as object content (boto3 returned the XML as Body, and a zero-length HEAD as success). This maps the entry to 500 Internal Server Error, keeping the XMinioObjectTampered code and message, and adds a signed GET/HEAD regression test on both object-layer backends.

Fixes #110. Fix plan agreed with the Codex reviewer: #110 (comment). Adversarial Codex review of this implementation: round 1 FAIL (the plan's live acceptance check had not been run), round 2 PASS with no findings after the live replay below.

Motivation and Context

Every origin of errObjectTampered (cmd/encryption-v1.go size validation, cmd/object-api-utils.go actual-size metadata, the multipart ETag shape check) is a stored-state defect, not caller input, so a 5xx is the honest class and lets clients raise an error instead of saving an error document as data. The 206 entry is inherited unchanged from upstream ca6b4773e (2017), which added nine SSE entries at once with the other eight at 400; upstream master still carries 206, so this is a deliberate divergence, recorded in the code comment and to be noted in the release fix note on silo.pgsty.com.

How to test this PR?

GOWORK=off go test -tags kqueue,dev ./cmd -run '^(TestObjectTamperedGETHEADStatus|TestAPIErrCode|TestAPIErrCodeDefinition|TestAPIHeadObjectHandler|TestAPIHeadObjectHandlerWithEncryption|TestAPIGetObjectHandler)$' -count=1 -v

With the product hunk reverted, TestObjectTamperedGETHEADStatus fails with GET of a damaged object returned HTTP 206, want 500 (and HEAD) on ErasureSD and Erasure; with the fix all six tests pass. gofmt -l cmd is empty; golangci-lint run --build-tags kqueue --config ./.golangci.yml ./cmd/... reports 0 issues.

Live replay (the plan's acceptance check): the destination data directory of the 2026-09-05 review lab, which holds the original unreadable SSE-C replica (review-ssec-plain-cbebf0/ssec-size-131072.txt, compressed ciphertext), was copied and served over loopback TLS by two binaries in turn; boto3 1.43.89 issued HEAD and GET with the original customer key.

Binary HEAD GET
This branch (5703426) ClientError 500 ClientError 500 XMinioObjectTampered
Published RELEASE.2026-09-03T13-18-01Z returned normally, 206, Content-Length: 0 returned normally, 206, 429-byte error XML as Body

Controls were identical on both binaries: the default-SSE-S3 bucket's replica still answers 400 InvalidRequest, and a healthy object answers 200 with its bytes. Script, result files and server logs are archived on the maintainer's machine under /Users/vonng/pgsty/silo-codex-triage-20260905/silo-110/live-replay/.

Compatibility impact

Only the HTTP status of one MinIO-specific error code changes; response body, headers and every healthy-object path are unchanged. No client in pgsty/mc, pgsty/silo-console or pgsty/silo-pkg special-cases XMinioObjectTampered. Clients now treat damaged-object reads as retryable 5xx (minio-go and boto3 standard mode retry 500), bounded by their retry configuration. Damaged-object reads count as 5xx in metrics and audit logs from now on. Diverges from upstream minio/minio master, which still returns 206.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Optimization (provides speedup with no functional changes)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • All commits are signed off (git commit -s) per the DCO
  • Fixes a regression (inherited from upstream ca6b4773e, not a SILO regression)
  • Unit tests added/updated
  • make verifiers equivalent: gofmt clean, golangci-lint 0 issues on ./cmd/...
  • Relevant package tests pass
  • Compatibility and rollback impact documented
  • Internal documentation updated (code comment records the upstream divergence)
  • Public documentation update opened in pgsty/silo.pgsty.com (release fix note, to follow with the release)

🤖 Generated with Claude Code

https://claude.ai/code/session_01L7qJqWwy8oFA6aCXWRzXQe

ErrObjectTampered was mapped to http.StatusPartialContent since upstream
ca6b477 (2017), so a GET or HEAD of an object the server cannot decode
(invalid encrypted size, malformed actual-size, bad multipart ETag shape)
answered with a success status and an XML error document that SDKs handed
back as object content; boto3 returned the XML as Body and a zero-length
HEAD as success. Every origin of errObjectTampered is a stored-state
defect, not caller input, so map the entry to 500 Internal Server Error
and keep the XMinioObjectTampered code and message. The comment records
the deliberate divergence from upstream.

Tests: TestObjectTamperedGETHEADStatus (signed GET and HEAD, ErasureSD and
Erasure) fails with 206 on main and passes with 500; TestAPIErrCode,
TestAPIErrCodeDefinition, TestAPIHeadObjectHandler,
TestAPIHeadObjectHandlerWithEncryption and TestAPIGetObjectHandler stay
green. Compatibility: only the status line of one MinIO-specific error
changes; clients now retry damaged-object reads per their 5xx policy.

Fixes #110

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L7qJqWwy8oFA6aCXWRzXQe
Signed-off-by: Feng Ruohang <[email protected]>
@Vonng
Vonng merged commit 62cce2b into main Sep 6, 2026
8 checks passed
@Vonng
Vonng deleted the fix/issue-110-tampered-status branch September 9, 2026 11:42
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.

[P1] Unreadable-object errors return HTTP 206 and are accepted as successful reads

1 participant