You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .claude/agents/security-reviewer.md
+8-2Lines changed: 8 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,24 @@
1
+
---
2
+
name: security-reviewer
3
+
description: Reviews findings from AgentShield + zizmor against the project's CLAUDE.md security rules and grades the result A-F. Spawned by the security-scan skill after the static scans run.
You are a security reviewer for Socket Security Node.js repositories.
2
8
3
9
Apply these rules from CLAUDE.md exactly:
4
10
5
11
**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.
6
12
7
-
**Absolute Rules**: NEVER use npx, pnpm dlx, or yarn dlx. Use pnpm exec or pnpm run with pinned devDeps.
13
+
**Absolute Rules**: NEVER use npx, pnpm dlx, or yarn dlx. Use pnpm exec or pnpm run with pinned devDeps. # zizmor: documentation-prohibition
8
14
9
15
**Work Safeguards**: Scripts modifying multiple files must have backup/rollback. Git operations that rewrite history require explicit confirmation.
10
16
11
17
**Review checklist:**
12
18
13
19
1.**Secrets**: Hardcoded API keys, passwords, tokens, private keys in code or config
14
20
2.**Injection**: Command injection via shell: true or string interpolation in spawn/exec. Path traversal in file operations.
Copy file name to clipboardExpand all lines: .claude/skills/path-guard/SKILL.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
name: path-guard
3
3
description: Audit and fix path duplication in this Socket repo. Apply the strict "1 path, 1 reference" rule — every build/test/runtime/config path is constructed exactly once; everywhere else references the constructed value. Default mode finds and fixes; `check` mode reports only; `install` mode drops the gate + hook + rule into a fresh repo.
description: Reference for locking down programmatic Claude invocations (the `claude` CLI in workflows/scripts, the `@anthropic-ai/claude-agent-sdk` `query()` in code). Loads on demand when writing or reviewing any callsite that runs Claude programmatically. Source: https://code.claude.com/docs/en/agent-sdk/permissions.
4
+
user-invocable: false
5
+
allowed-tools: Read, Grep, Glob
6
+
---
7
+
8
+
# Programmatic Claude lockdown
9
+
10
+
**Rule:** every programmatic Claude callsite sets four flags. Skip any one and a future edit silently widens the surface.
11
+
12
+
## The four flags
13
+
14
+
| Layer | SDK option | CLI flag | What it does |
15
+
|---|---|---|---|
16
+
| Definition |`tools`|`--tools`| Base set the model is told about. Tools not listed are invisible — no `tool_use` block possible. |
17
+
| Auto-approve |`allowedTools`|`--allowedTools`| Step 4. Listed tools run without invoking `canUseTool`. |
18
+
| Deny |`disallowedTools`|`--disallowedTools`| Step 2. Wins even against `bypassPermissions`. Defense-in-depth. |
19
+
| Mode |`permissionMode: 'dontAsk'`|`--permission-mode dontAsk`| Step 3. Unmatched tools denied without falling through to a missing `canUseTool`. |
20
+
21
+
The official permission flow (1) hooks → (2) deny rules → (3) permission mode → (4) allow rules → (5) `canUseTool`. In `dontAsk` mode step 5 is skipped — denied. The doc states verbatim: *"`allowedTools` and `disallowedTools` ... control whether a tool call is approved, not whether the tool is available."* Availability is `tools`.
Narrow `Bash(...)` patterns surgically. Block dangerous Bash patterns explicitly. Fleet rules: no `npx`/`pnpm dlx`/`yarn dlx`; no `curl`/`wget` exfil; no destructive `rm -rf`; no `sudo`. Build the deny list as shell vars so the npx/dlx denials can carry the `# zizmor:` exemption marker (the pre-commit `scanNpxDlx` hook treats those literal strings as the prohibited tools, not as exemptions, unless the line is tagged):
- ❌ Omitting `tools` — SDK default is the full claude_code preset.
73
+
- ❌ `Agent` / `Task` permitted — sub-agents inherit modes and can escape per-subagent restrictions when the parent is `bypassPermissions`/`acceptEdits`/`auto`.
74
+
75
+
## Reference implementation
76
+
77
+
`socket-lib/tools/prim/src/disambiguate.mts` — canonical SDK-form callsite. The file header documents each flag against the eval-flow step it enforces.
78
+
79
+
`socket-lib/tools/prim/test/disambiguate.test.mts` — source-text guards that fail the build if `BASE_TOOLS` widens, if `tools: BASE_TOOLS` is unwired, if `permissionMode` drifts from `'dontAsk'`, or if `bypassPermissions` / `allowDangerouslySkipPermissions: true` ever appears. Mirror this pattern in any new callsite.
80
+
81
+
## Existing fleet callsites
82
+
83
+
-`socket-registry/.github/workflows/weekly-update.yml` — two `claude --print` invocations (run `/updating` skill, fix test failures). Bash recipe above.
Copy file name to clipboardExpand all lines: .claude/skills/security-scan/SKILL.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@
2
2
name: security-scan
3
3
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.
0 commit comments