From b8336332719f95d392cbd93f417a762a9f82220c Mon Sep 17 00:00:00 2001 From: jdalton Date: Mon, 27 Apr 2026 10:59:01 -0400 Subject: [PATCH 1/3] chore: env allowlist + .cache exclude + CLAUDE.md fleet rules Doc/config-only updates split out from PR #620. CLAUDE.md - Sync sorting + open-PR + paths + inclusive-language + Set constructor sort + don't-revert-untouched rules from the fleet - Replace whitelist/blacklist with allowlist/denylist - Document workflow-dispatch rule .config/tsconfig.check.json - Restore .cache/** exclude (was previously dropped) .gitignore - Add **/.cache/ .claude/agents/security-reviewer.md .claude/skills/security-scan/SKILL.md - Sync from socket-repo-template canonical No runtime behavior changes. --- .claude/agents/security-reviewer.md | 4 +- .claude/skills/security-scan/SKILL.md | 1 + .config/tsconfig.check.json | 2 +- .gitignore | 3 ++ CLAUDE.md | 73 +++++++++++++++++++++++++++ 5 files changed, 80 insertions(+), 3 deletions(-) diff --git a/.claude/agents/security-reviewer.md b/.claude/agents/security-reviewer.md index a5625045..6ae10889 100644 --- a/.claude/agents/security-reviewer.md +++ b/.claude/agents/security-reviewer.md @@ -4,7 +4,7 @@ Apply these rules from CLAUDE.md exactly: **Safe File Operations**: Use safeDelete()/safeDeleteSync() from @socketsecurity/lib/fs. NEVER fs.rm(), fs.rmSync(), or rm -rf. Use os.tmpdir() + fs.mkdtemp() for temp dirs. NEVER use fetch() — use httpJson/httpText/httpRequest from @socketsecurity/lib/http-request. -**Absolute Rules**: NEVER use npx, pnpm dlx, or yarn dlx. Use pnpm exec or pnpm run with pinned devDeps. +**Absolute Rules**: NEVER use npx, pnpm dlx, or yarn dlx. Use pnpm exec or pnpm run with pinned devDeps. # zizmor: documentation-prohibition **Work Safeguards**: Scripts modifying multiple files must have backup/rollback. Git operations that rewrite history require explicit confirmation. @@ -12,7 +12,7 @@ Apply these rules from CLAUDE.md exactly: 1. **Secrets**: Hardcoded API keys, passwords, tokens, private keys in code or config 2. **Injection**: Command injection via shell: true or string interpolation in spawn/exec. Path traversal in file operations. -3. **Dependencies**: npx/dlx usage. Unpinned versions (^ or ~). Missing minimumReleaseAge bypass justification. +3. **Dependencies**: npx/dlx usage. Unpinned versions (^ or ~). Missing minimumReleaseAge bypass justification. # zizmor: documentation-checklist 4. **File operations**: fs.rm without safeDelete. process.chdir usage. fetch() usage (must use lib's httpRequest). 5. **GitHub Actions**: Unpinned action versions (must use full SHA). Secrets outside env blocks. Template injection from untrusted inputs. 6. **Error handling**: Sensitive data in error messages. Stack traces exposed to users. diff --git a/.claude/skills/security-scan/SKILL.md b/.claude/skills/security-scan/SKILL.md index 7f2fd77e..0c2cf12e 100644 --- a/.claude/skills/security-scan/SKILL.md +++ b/.claude/skills/security-scan/SKILL.md @@ -2,6 +2,7 @@ name: security-scan description: Runs a multi-tool security scan — AgentShield for Claude config, zizmor for GitHub Actions, and optionally Socket CLI for dependency scanning. Produces an A-F graded security report. Use after modifying `.claude/` config, hooks, agents, or GitHub Actions workflows, and before releases. user-invocable: true +allowed-tools: Task, Bash, Read, Grep, Glob --- # Security Scan diff --git a/.config/tsconfig.check.json b/.config/tsconfig.check.json index 92fbca1e..02e43cd6 100644 --- a/.config/tsconfig.check.json +++ b/.config/tsconfig.check.json @@ -11,5 +11,5 @@ "verbatimModuleSyntax": false }, "include": ["../**/*.ts", "../**/*.mts"], - "exclude": ["../**/node_modules/**/*"] + "exclude": ["../**/.cache/**", "../**/node_modules/**/*"] } diff --git a/.gitignore b/.gitignore index bdcf878e..0aac7108 100644 --- a/.gitignore +++ b/.gitignore @@ -59,6 +59,9 @@ desktop.ini # store scratch dirs — cleared by pnpm install automatically). node_modules **/node_modules +# Defensive cache ignore — Node compile-cache, corepack, and other +# tools occasionally drop scratch dirs into a project-local .cache/. +**/.cache/ # Misc temporary/generated files Do diff --git a/CLAUDE.md b/CLAUDE.md index 550a72dd..a59e46aa 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -29,21 +29,72 @@ - **REQUIRED for staging**: surgical `git add […]` with explicit paths. Never `-A` / `.`. - **If you need a quick WIP save**: commit on a new branch from inside a worktree, not a stash. +- **NEVER revert files you didn't touch.** If `git status` shows files you didn't modify, those belong to another session, an upstream pull, or a hook side-effect — leave them alone. Specifically: do not run `git checkout -- ` to "clean up" the diff before committing, and do not include unrelated paths in `git add`. Stage only the explicit files you edited. The umbrella rule: never run a git command that mutates state belonging to a path other than the file you just edited. ## 📚 SHARED STANDARDS - Commits: [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) `(): ` — NO AI attribution +- **Open PRs:** when adding commits to an OPEN PR, ALWAYS update the PR title and description to match the new scope. A title like `chore: foo` after you've added security-fix and docs commits to it is now a lie. Use `gh pr edit --title "..." --body "..."` (or `--body-file`) and rewrite the body so it reflects every commit on the branch, grouped by theme. The reviewer should be able to read the PR description and know what's in it without scrolling commits. - Scripts: Prefer `pnpm run foo --flag` over `foo:bar` scripts - Dependencies: After `package.json` edits, run `pnpm install` - Backward Compatibility: 🚨 FORBIDDEN to maintain — actively remove when encountered - 🚨 **NEVER use `npx`, `pnpm dlx`, or `yarn dlx`** — use `pnpm exec ` or `pnpm run