rm, dd, chmod, package managers, privilege escalation tools, or system administration commands.
This is different from giving a command a restricted command sandbox. A command with a command sandbox policy is allowed to run with specific grants. A deny-only command is resolved and controlled, but every matching invocation is denied.
Recommended Shape
Put blocked commands undercommand_policies.commands and deny the session caller:
rmthroughPATHis denied by the command-mediation shim;- direct canonical-path invocation, such as
/bin/rm, is denied as a direct-exec bypass of a controlled command; - no command sandbox is launched for the denied command.
Blocking Child Tools
Use caller-specific denies when one allowed tool must not launch another tool:npm may launch node, but an attempted npm lifecycle escape through sh is denied.
Inherited Dangerous Groups
The default profile includesdangerous_commands, dangerous_commands_macos, and dangerous_commands_linux. These groups still populate the older blocked-command list.
When command_policies.commands is non-empty, command mediation folds inherited blocked commands into deny-only command-policy entries. That gives dangerous commands shim coverage and direct-path bypass protection while command mediation is active.
Inherited blocked commands do not activate command mediation by themselves. A profile that only inherits dangerous_commands still uses the older startup-command warning path. Add at least one command_policies.commands entry when you want command-policy behavior.
Allowing One Dangerous Command
If a profile inheritsdangerous_commands but intentionally needs one command, use the profile’s commands.allow compatibility field to remove that inherited blocked-command entry before command-policy resolution:
rm globally.
Direct Exec Bypass
Policy-controlled and deny-only commands are meant to be reached through command-mediation shims. Direct paths are denied unless explicitly allowed byallow_direct_exec_bypass on a policy-controlled command.
Deny-only commands are never eligible for allow_direct_exec_bypass. The profile-wide deny_direct_exec_bypass list can also name canonical executable paths that must not be bypassed by any command policy.
Deprecated Surfaces
These older command-blocking surfaces are still parsed for compatibility, but they are startup-only and are not the preferred authoring path:- CLI
--block-command; - profile
commands.deny; - capability manifest
process.blocked_commands.
command_policies. Use Sandboxed Tool Execution when a command should be allowed with a specific command sandbox, and use this page when a command should not run.