Repository navigation
fix: return 500 for unreadable objects instead of 206 - #121
Merged
Merged
Conversation
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]>
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.
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-bytrailer.Description
ErrObjectTamperedwas 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 asBody, and a zero-length HEAD as success). This maps the entry to 500 Internal Server Error, keeping theXMinioObjectTamperedcode 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.gosize validation,cmd/object-api-utils.goactual-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 upstreamca6b4773e(2017), which added nine SSE entries at once with the other eight at 400; upstreammasterstill 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?
With the product hunk reverted,
TestObjectTamperedGETHEADStatusfails withGET of a damaged object returned HTTP 206, want 500(and HEAD) on ErasureSD and Erasure; with the fix all six tests pass.gofmt -l cmdis 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.ClientError500ClientError500XMinioObjectTamperedRELEASE.2026-09-03T13-18-01ZContent-Length: 0BodyControls 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 upstreamminio/miniomaster, which still returns 206.Types of changes
Checklist:
git commit -s) per the DCOca6b4773e, not a SILO regression)make verifiersequivalent: gofmt clean, golangci-lint 0 issues on./cmd/...pgsty/silo.pgsty.com(release fix note, to follow with the release)🤖 Generated with Claude Code
https://claude.ai/code/session_01L7qJqWwy8oFA6aCXWRzXQe