Skip to content

fix(bitrot): reject trailing shard data - #5358

Merged
cxymds merged 2 commits into
mainfrom
cxymds/fix-1518-bitrot-trailing
Jul 28, 2026
Merged

fix(bitrot): reject trailing shard data#5358
cxymds merged 2 commits into
mainfrom
cxymds/fix-1518-bitrot-trailing

Conversation

@cxymds

@cxymds cxymds commented Jul 28, 2026

Copy link
Copy Markdown
Member

Related Issues

Fixes rustfs/backlog#1518.

Summary of Changes

  • Probe one byte past the expected streaming bitrot payload after all existing length and hash checks.
  • Reject a valid encoded prefix followed by any trailing data.
  • Add regressions for one-byte and multi-byte suffixes in the core verifier and PUT self-verification through inline and disk readers.
  • Preserve valid, short-read, size-mismatch, hash-mismatch, streaming HighwayHash, and legacy whole-file behavior.

Verification

  • rustfmt --edition 2024 --check crates/ecstore/src/erasure/coding/bitrot.rs crates/ecstore/src/set_disk/ops/bitrot_self_verify.rs
  • git diff --check
  • High-risk seven-role adversarial review completed with no unresolved findings.
  • Full repository CI is required before this draft is marked ready.

Impact

PUT post-write verification now validates the complete reader rather than only the expected-length prefix. Each verification adds one single-byte EOF probe and no second full scan.

Additional Notes

The MinIO streaming layout, encoded-size formula, legacy format, and on-disk representation are unchanged.


Thank you for your contribution! Please ensure your PR follows the community standards (CODE_OF_CONDUCT.md). If this is your first contribution, review the CLA document and sign it by commenting I have read and agree to the CLA. on the PR.

@github-actions

Copy link
Copy Markdown
Contributor

CLA requirements are satisfied for this pull request.

@cxymds
cxymds marked this pull request as ready for review July 28, 2026 09:23
@cxymds
cxymds merged commit 45c3386 into main Jul 28, 2026
33 of 35 checks passed
@cxymds
cxymds deleted the cxymds/fix-1518-bitrot-trailing branch July 28, 2026 09:23
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.

1 participant