SIGN IN SIGN UP
tw93 / Mole UNCLAIMED

🐹 Deep clean and optimize your Mac.

0 0 83 Shell

feat(safety): add SECURITY_DESIGN doc and path-validation fuzz tests

Mole performs three classes of destructive ops (cleanup, uninstall, trash
routing) but the safety mechanisms guarding them were only readable as
prose comments scattered across lib/. Two changes make them auditable
end-to-end.

docs/SECURITY_DESIGN.md (230 lines) documents the five-layer model:
validate_path_for_deletion, the # SAFE annotation contract enforced by
CI, the FAST-vs-CRITICAL bundle list split, Trash routing default with
osascript escaping, and the test mode / dry run / property test
guarantees. Includes "what this design intentionally does not do" so
future reviewers don't repeat past audit conclusions.

Fuzz: two harnesses, one per validator language. The Go fuzz target
(cmd/analyze/delete_fuzz_test.go) asserts the invariant that anything
validatePath accepts is absolute, free of null bytes, and free of
".." components. The bats property test (tests/path_validation_fuzz.bats)
walks tests/fuzz_corpus/dangerous_paths.txt (79 adversarial paths today)
and asserts validate_path_for_deletion rejects every one. The corpus
includes the line that exposed a real escape-stripper bug during this
work, kept as a regression seed.

scripts/test.sh now sweeps orphan tests/tmp-* dirs at session start with
a "# SAFE: confined to tests/tmp-*" annotation, and tests/.gitignore
ignores tmp-*/.
T
Tw93 committed
076b52135cb9d9f0d3899457cb09b27bb58e47e0
Parent: 37c04af