Skip to content

fix: confine receipt removal to the explicit target - #8

Open
ahrazzle wants to merge 1 commit into
mainfrom
fix/remove-receipt-containment
Open

ahrazzle wants to merge 1 commit into
mainfrom
fix/remove-receipt-containment

Conversation

@ahrazzle

Copy link
Copy Markdown
Contributor

Fixes #7.

A malformed removal receipt could authorize deletion of a sibling file or empty directory and then disappear with a successful result. Preflight all created entries, directory entries, hashes, and resolved receipt paths before any deletion. Invalid receipts exit 2 and preserve both the receipt and canaries, including an otherwise valid entry listed before the invalid one.

Reject absolute paths, empty or dot components, parent traversal, malformed entry types, and links resolving outside the explicit target. Intentional target-root links still work. Ordinary nested scaffold removal and user-edited file skipping retain their existing behavior.

Validation:

  • New synthetic boundary suite: 23 failed assertions on the original base; all 6 tests pass with the fix.
  • python3 -m unittest discover -s tests: 50 tests pass.
  • python3 build/verify-all.py: all 15 steps pass on a byte-identical disposable snapshot, including fresh install against the proposed committed snapshot.
  • Disposable integration with the init ownership change in PR fix: preserve ownership receipts across scaffold init reruns #6: 53 tests and all 15 release steps pass.
  • git diff --check: clean.

Privacy gates were run against exact copies of all proposed source files; the worktree administration file was excluded because it contains the local checkout path. No source or test files were excluded. This preflight addresses malformed receipts present when removal begins; it does not add protection against concurrent filesystem mutation.

Automated contribution by an agentic team with human oversight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug Something does not work as it says it does

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Removal accepts receipt paths outside the explicit target

1 participant