From 943e151a56586b9af6b695022cf5b48c91d6a48d Mon Sep 17 00:00:00 2001 From: jdalton Date: Mon, 27 Apr 2026 11:09:56 -0400 Subject: [PATCH 1/6] chore: env allowlist + .cache exclude + CLAUDE.md fleet rules + NODE_COMPILE_CACHE removal Doc/config-only updates split out from PR #1279. 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 + tsconfig.json + packages/cli/.config/tsconfig.check.json - Restore .cache/** exclude .gitignore - Add **/.cache/ .env.example, .env.precommit, packages/cli/.env.test - Drop NODE_COMPILE_CACHE convention scripts/babel/babel-plugin-inline-process-env.mts - Remove NODE_COMPILE_CACHE handling packages/cli/test/unit/utils/validation/check-input.test.mts - Drop NODE_COMPILE_CACHE assertion .claude/agents/security-reviewer.md .claude/skills/security-scan/SKILL.md - Sync from socket-repo-template canonical No runtime behavior changes outside the dropped NODE_COMPILE_CACHE convention. --- .claude/agents/security-reviewer.md | 4 +- .claude/skills/security-scan/SKILL.md | 1 + .config/tsconfig.check.json | 2 + .env.example | 1 - .env.precommit | 1 - .gitignore | 3 + CLAUDE.md | 73 ++++++++++++++++++- packages/cli/.config/tsconfig.check.json | 1 + packages/cli/.env.test | 1 - .../utils/validation/check-input.test.mts | 2 +- .../babel/babel-plugin-inline-process-env.mts | 6 +- tsconfig.json | 4 +- 12 files changed, 87 insertions(+), 12 deletions(-) diff --git a/.claude/agents/security-reviewer.md b/.claude/agents/security-reviewer.md index a56250453..6ae108892 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 7f2fd77e8..0c2cf12ed 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 e19788a4f..2f0e97d1b 100644 --- a/.config/tsconfig.check.json +++ b/.config/tsconfig.check.json @@ -12,6 +12,8 @@ "../packages/cli/.config/*.mts" ], "exclude": [ + "../.cache/**", + "../packages/cli/.cache/**", "../packages/cli/**/*.tsx", "../packages/cli/**/*.d.mts", "../packages/cli/src/commands/analytics/output-analytics.mts", diff --git a/.env.example b/.env.example index 691c00890..de9adb650 100644 --- a/.env.example +++ b/.env.example @@ -2,7 +2,6 @@ # Copy this file to .env.local and customize for your local environment. # Node.js Configuration (optional overrides). -NODE_COMPILE_CACHE="./.cache" NODE_OPTIONS="--max-old-space-size=8192 --max-semi-space-size=1024" # Socket API Configuration (for e2e testing). diff --git a/.env.precommit b/.env.precommit index 1ee9eda75..75db740a8 100644 --- a/.env.precommit +++ b/.env.precommit @@ -8,5 +8,4 @@ SOCKET_CLI_NO_API_TOKEN=1 VITEST=1 # Node.js optimization for test performance. -NODE_COMPILE_CACHE="./.cache" NODE_OPTIONS="--max-old-space-size=8192" diff --git a/.gitignore b/.gitignore index 7e31376b4..00cca54ed 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,8 @@ Thumbs.db .env .env.* !.env.example +!.env.precommit +!.env.test /.env.local # ============================================================================ @@ -34,6 +36,7 @@ yarn-error.log* # ============================================================================ **/.build-checkpoints **/*.build-signature +**/.cache/ /.rollup.cache **/.type-coverage/ **/build/ diff --git a/CLAUDE.md b/CLAUDE.md index cf06225ff..119d838db 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -29,6 +29,7 @@ - **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. @@ -101,6 +102,8 @@ The umbrella rule: never run a git command that mutates state belonging to a pat - 🚨 **NEVER use `npx`, `pnpm dlx`, or `yarn dlx`** — use `pnpm exec ` or `pnpm run