Skip to content

Commit 5d3da0c

Browse files
committed
docs(claude): close unlinkSync loophole in Safe Deletion rule
The prior rule only named fs.rm/rmSync/rm -rf, which left fs.unlink/unlinkSync as an unintentional escape hatch. Expand the rule to cover every sync + async delete primitive, and surface safeDeleteSync as the sync variant so contributors don't invent their own direct-node-fs workarounds when the surrounding code is sync.
1 parent 89c1b43 commit 5d3da0c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Example — validator on `walkthrough.json`:
122122
- Dependencies: After `package.json` edits, run `pnpm install`
123123
- Backward Compatibility: 🚨 FORBIDDEN to maintain — actively remove when encountered
124124
- Work Safeguards: MANDATORY commit + backup branch before bulk changes
125-
- Safe Deletion: Use `safeDelete()` from `@socketsecurity/lib/fs` (NEVER `fs.rm/rmSync` or `rm -rf`)
125+
- Safe Deletion: Route **every** filesystem delete through `safeDelete()` (async) or `safeDeleteSync()` (sync) from `@socketsecurity/lib/fs`. NEVER reach for `fs.rm` / `fs.rmSync` / `fs.unlink` / `fs.unlinkSync` / `fs.rmdir` / `fs.rmdirSync` / `rm -rf` — even for a single known file. The rule is "all deletes go through the safe helpers," not "except when the blast radius is small"; uniform routing is what keeps audit + retry + signal-abort behavior consistent.
126126
- HTTP Requests: NEVER use `fetch()` — use `httpJson`/`httpText`/`httpRequest` from `@socketsecurity/lib/http-request`
127127
- File existence: ALWAYS `existsSync` from `node:fs`. NEVER `fs.access`, `fs.stat`-for-existence, or an async `fileExists` wrapper. Import form: `import { existsSync, promises as fs } from 'node:fs'`.
128128

0 commit comments

Comments
 (0)