SocketDev / SocketDev/decmpfs

fix(safety): verify in-place writes against full content, not a 4-byte prefix

Open
#3 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.