fix(safety): verify in-place writes against full content, not a 4-byte prefix
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
The in-place compression path verifies its readback against a 4-byte magic prefix, while compress_bytes compares full content. Any corruption past the first four bytes passes verification.
safety.rs builds a magic_prefix snapshot and checks that on readback. compress_bytes uses readback_matches against a full pre-apply snapshot. The two paths make different guarantees, and the weaker one is the one that mutates a file in place.
A fork of this engine in abitious used the full-content oracle on both paths. That fork is now deleted in favor of depending on this crate, which is why the difference matters: consumers moving onto the published crate get the weaker check.
Suggested fix: use readback_matches against the full pre-apply snapshot on the in-place path too, or document why a prefix check is sufficient there.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in safety.rs and compare the in-place compression readback check with compress_bytes, focusing on magic_prefix and readback_matches. Trace how the full pre-apply snapshot is created and used; the work is done when both paths verify the complete original content rather than only a four-byte prefix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100