AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 27 Bitcoin

qa: Remove all instances of `remove_all` except test cleanup

Public commit record

What the developer wrote

Authored by David Gumberg

83/100 · Strong
qa: Remove all instances of `remove_all` except test cleanup

Adds a lint check for `remove_all()`

`fs::remove_all()`/`std::filesystem::remove_all()` is extremely
dangerous, all user-facing instances of it have been removed, and it
also deserves to be removed from the places in our test code where it is
being used unnecessarily.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit is a defensive cleanup: it removes almost all uses of a filesystem function called remove_all() that can wipe out entire directory trees, and adds an automated lint check to prevent it from being reintroduced. The changes only affect benchmark and test code, not the live Bitcoin wallet or node software that ordinary users run. It reduces the risk of accidental data loss during testing, but does not fix an active security bug.

Recommended action

No urgent action needed. Reviewers should verify the remaining excluded remove_all() uses in src/test/kernel/test_kernel.cpp and src/test/util/setup_common.cpp are truly constrained to test cleanup and cannot be replaced with safer alternatives. Monitor future PRs for lint bypasses or new remove_all() introductions.

Security signals we found

01

Commit message labels fs::remove_all()/std::filesystem::remove_all() as 'extremely dangerous'

02

Replaces recursive directory deletion with single-file/directory deletion in tests/benchmarks

03

Adds a CI lint to block future remove_all() usage in src/

04

No changes to production wallet/node code paths

05

Two test cleanup locations remain excluded from the lint as 'likely not avoidable'

Risk score

Why this scored 27/100

Our methodology →
Potential impact 5/30
Exploitability 3/25
Stealth signal 4/15
Affected reach 3/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.