Repository navigation
fix(repo): refuse a commit that would store a protected file as plaintext after its rule was dropped - #364
Merged
Conversation
… rule was dropped upstream Protection rules are repository data. A tip that keeps a path's PROTECTED entry but omits its rule made a recipient's checkout hold the plaintext, and the next ordinary commit stored it unsealed. snapshot_files (commit, amend, completion, ws harvest, sc work) now refuses before writing any object when a working-tree path is PROTECTED on the tip or the merge/pick head and no rule covers it.
…d entry Refuse when any tip entry is PROTECTED and no rule in the new protection covers it (new plain files under the dropped rule, keyless commits dropping absent entries), check the merge/pick head by point lookups for plain paths only so a partial clone never walks an unheld subtree, and refuse plain paths that differ only in ASCII case from a rule prefix or protected tip path. The hint says to abort while a merge, pick or rebase is stopped.
…loaded trees The dropped-rule guard walked the merge/pick head's path with a plain store lookup, so a widened partial-clone merge failed on a tree it never held. It now fetches the missing trees by id on a lazy, online clone (any other clone keeps the gap error with its `sc backfill` hint) and keeps the trees it loaded in a per-guard map, so a flat directory is read once. The case-alias refusal now also requires the protected spelling to be the same file or directory as the plain path in the checkout the commit reads from (device and inode on unix, always assumed elsewhere), so a distinct `docs/private/` beside a rule `Docs/private/` commits on a case-sensitive filesystem. snapshot_files takes that checkout root.
The guard folded and scanned every protected tip path for every plain file. It now builds a folded-spelling map of protected tip paths and rule prefixes once and looks up each plain path and its parent directories, running the device/inode comparison only on a match. The alias tests expect a refusal off unix too, where the identity check always assumes aliasing, and the distinct-path test creates both directories on disk.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
tonibergholm
approved these changes
Nov 20, 2026
tonibergholm
left a comment
Member
There was a problem hiding this comment.
Reviewed: sol-loop (4 rounds, approved) plus a Mythos security review, required checks green, Codex review has no findings.
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.
Protection rules are repository data. A writer could push a commit that keeps a protected file's entry but drops the rule covering it. A recipient who switched to that commit with their key had the decrypted file on disk. Their next ordinary
sc committhen stored it as plaintext, with only the secret scanner in the way. A test reproduced this before the fix.Now
snapshot_files, the builder shared by commit, amend, merge, pick and rebase completion,sc ws harvestandsc work, refuses before writing any object in three cases:sc backfillhint.secret/xinto an existingSecret/directory. Distinct paths on a case-sensitive filesystem pass.No normal flow produces a protected entry without a rule, since merges union rules. The full
scl-reposuite passes unchanged apart from the new tests. While a merge, pick or rebase is stopped, the error says to abort, restore the rule and retry.Proof: new tests in
repo.rsandpartial_merge.rs:a_commit_never_stores_plaintext_of_a_path_whose_rule_was_dropped_upstreamfailed on the old code with the plaintext committed.cargo test -p scl-repopasses: 1087 tests.Reviewed with sol-loop: 4 rounds with gpt-6.2-sol. Sol verdict: approved. A Mythos security review asked for the broader guard and the case-alias check; both are in.
Created with Claude Opus 5.5 and Claude Sonnet 5.5 in Claude Code.