Start with the highest-risk runtime actions: shell commands that can move data, access credentials, or alter repositories. In practice, block or gate commands such as sudo, git push, scp, rsync, curl, and wget first, then expand toward files, network access, and MCP connections once the baseline is stable.
Which actions belong at the top of the blocklist?
The first policy choices should target runtime actions that can immediately move data, reach credentials, or change source code. That means blocking or tightly gating high-impact commands before you spend time on lower-risk convenience controls. If Claude Code can execute them without review, the policy is too permissive for a first pass.
The practical order is to start with destructive or exfiltration-capable commands, then broaden the policy once the baseline is stable. Commands such as sudo, git push, scp, rsync, curl, and wget matter because they can cross trust boundaries, stage data movement, or alter repositories in ways that are hard to unwind.
For teams using AI coding assistants, the safest first boundary is the one that limits the model’s ability to turn suggestions into side effects. NHIMG’s AI Coding Agents Security Guide covers that broader pattern: constrain the toolchain before you expand what the assistant may touch.
Why these commands rise to the top
These commands are not merely “powerful”, they are operationally consequential. sudo can expand privileges, git push can publish malicious or mistaken changes, and file transfer or retrieval tools can move secrets or source material outside approved paths. In an agentic workflow, that makes them the shortest route from prompt to impact.
curl and wget deserve early attention because they can fetch payloads, exfiltrate data, or create hidden dependencies on remote content. Even when the intent is benign, they let the assistant reach beyond the repository and into the network, which is often where policy drift begins.
If your environment already uses code assistants in terminals, the trust boundary is especially important. NHIMG’s Analysis of Claude Code Security is useful background on why terminal-native coding agents need tighter guardrails than chat-only assistants.
How to expand the policy without overblocking
After the highest-risk commands are contained, extend the policy toward files, network access, and MCP connections. That sequence keeps the initial rollout focused on actions with the biggest blast radius while leaving room to learn what the assistant actually needs in your workflow.
A good policy first captures what the model may do with broad side effects, then narrows by context. For example, repository write access, outbound network access, and tool connections should usually be treated as separate control points, not one all-or-nothing rule. That gives security teams a way to tighten one path without breaking every task.
Use a staged rollout rather than a blanket shutdown. NHIMG’s Authorisation Models Guide is a useful companion when you need to decide whether the next step should be role-based, attribute-based, or request-context based control.
Risk and Threat Considerations
Claude Code policies fail when they focus on convenience first and side effects second. The main risk is that a coding assistant can be steered into privilege escalation, repository tampering, or credential exposure before a human notices, especially when shell access and outbound network access are both open.
Failure mechanism: A permissive policy lets the assistant chain a prompt, a shell command, and a network or repository action into a single compromise path. Once a secret is read, a change is pushed, or a remote payload is fetched, the boundary between suggestion and execution disappears.
Impact: The result can be source-code compromise, secret leakage, unauthorized deployment activity, or wider supply-chain exposure. In practice, the first blocked command is often the one that prevents the first irreversible action.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10 and OWASP Agentic AI Top 10 address the attack and risk surface, while NIST SP 800-53 Rev 5 sets the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-02 — Secret Leakage | Blocking data-moving commands reduces secret exposure from coding assistants. |
| NHI-05 — Overprivileged NHI | Claude Code policy is about limiting excessive runtime authority in assistant workflows. | |
| Recommendation — Restrict runtime paths that can read or transmit secrets before widening assistant access. Constrain assistant permissions to the minimum actions needed for the task. | ||
| OWASP Agentic AI Top 10 | ASI02 — Tool Misuse | The question is about which agent actions should be gated first to prevent harmful tool use. |
| Recommendation — Gate high-impact tools and commands before allowing broader agent execution. | ||
| NIST SP 800-53 Rev 5 | AC-6 — Least Privilege | Early command blocking is a least-privilege decision for assistant execution paths. |
| IA-5 — Authenticator Management | Credential-moving commands raise immediate secret-handling concerns in assistant workflows. | |
| Recommendation — Limit assistant authority to the smallest set of commands and access paths. Protect and rotate any credentials exposed to assistant-accessible workflows. | ||
Practitioner Guidance
What to prioritise: Put the first controls on commands that can move data or modify systems outside the current workspace. If a command can reach production credentials, publish code, or fetch unvetted remote content, it belongs in the initial blocklist or approval gate.
What to verify: Test the policy against real developer tasks, not just obvious abuse cases. Confirm that legitimate workflows still function through approved paths, and that exceptions are narrow enough to review without slowing every interaction.
Practitioner takeaway: The first Claude Code policy should reduce blast radius, not just nuisance risk, so block the commands that turn an assistant’s suggestion into an external side effect.
Related resources from NHI Mgmt Group
- How should security teams authenticate AI agents in enterprise environments?
- How should security teams implement Client ID Metadata Documents?
- How should security teams manage backup policies in Infrastructure as Code environments?
- How do teams decide whether to block code on security findings or just attach advisory feedback?
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on October 22, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org