fix(platform-wallet): reject trailing bytes in persisted asset-lock proof blobs - #4346
Conversation
…roof blobs decode_from_slice stops at the value's end without rejecting trailing bytes; the lifecycle blob holds exactly one proof, so a longer payload is corruption, not a valid encoding. Regression test tampers a byte onto the proof bytes and asserts the decode fails. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAsset-lock proof deserialization now rejects payloads with trailing bytes. Tests verify valid round-trips and failure for appended data. ChangesAsset-lock proof validation
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
🕓 Ready for review — 2 ahead in queue (commit 0eddfbd) |
…eam asset-lock substrate: dashpay#4342 restore-time reconstruction, dashpay#4346 proof-blob validation, dashpay#4347 RecoveredFromChain finalization) Ports three merged upstream commits that rework the asset-lock substrate, plus the call-site adaptation qa5's richer 7-arg builder signature needs. Verified green on this branch: platform-wallet 635 passed, 0 failed. dashpay#4342's only conflict was changeset/core_bridge.rs, where qa5 carried the watermark-fault logic inline and upstream had extracted it into commit_batch + BatchDiagnostics. Resolved toward upstream: it preserves the freeze guard, the is_empty_no_records skip and the SYNC WATERMARK FROZEN marker, and additionally fixes an accounting bug qa5 had — a height was counted persisted before store() rather than only in the Ok arm. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Follow-up to #4342, addressing the last CodeRabbit finding there (it was posted just before the merge):
decode_from_slicestops at the value's end without rejecting trailing bytes, and thelifecycle_blobholds exactly one proof — so a longer payload is corruption, not a valid encoding. The serde adapter now compares the consumed-byte count against the blob length and fails the decode with a typed serde error, with a regression test that appends a byte to the proof bytes and asserts rejection.🤖 Generated with Claude Code
Summary by CodeRabbit