What Is Deny-by-Default for AI Agent Safety?
Deny-by-default is a security posture in which an AI agent is permitted to perform zero actions until explicit policy rules grant specific permissions. Any action not covered by an allow rule is automatically blocked. SafeClaw by Authensor implements deny-by-default as its foundational security model, ensuring that AI agents operating with Claude, OpenAI, or any other provider start with no permissions and must be granted access to each action type through declarative YAML policies.
The Problem with Allow-by-Default
Most AI agent frameworks ship with an allow-by-default model: the agent can do anything the underlying system permits, and safety is bolted on afterward through prompt instructions or ad-hoc checks. This creates a dangerous inversion where:
- New tool integrations are immediately accessible without review
- Prompt injection attacks can leverage any available tool
- Developers must anticipate and block every dangerous action rather than permitting only safe ones
- A single oversight in the blocklist exposes the entire system
How Deny-by-Default Works in Practice
Under a deny-by-default model, the policy engine evaluates every action request against an ordered list of rules. If no rule matches, the default verdict is deny. This means:
- An agent with an empty policy file can do nothing
- Each capability must be explicitly granted
- New tools added to the agent are automatically blocked until policy is updated
- The attack surface is exactly the set of allow rules, which is auditable and reviewable
Implementing Deny-by-Default with SafeClaw
Install SafeClaw to enforce deny-by-default on any AI agent:
npx @authensor/safeclaw
A minimal deny-by-default policy looks like this:
# safeclaw.yaml
version: 1
defaultAction: deny
rules:
- action: file_read
path: "./docs/**"
decision: allow
reason: "Agent may read documentation"
- action: file_read
path: "./src/**"
decision: allow
reason: "Agent may read source code"
In this configuration, the agent can read files in docs/ and src/, and nothing else. It cannot write files, execute commands, make network requests, or read files in any other directory. Every attempted action outside these two rules is denied and logged.
Deny-by-Default vs. Blocklist Approaches
A blocklist approach tries to enumerate dangerous actions:
# Anti-pattern: blocklist approach
defaultAction: allow
rules:
- action: shell_execute
command: "rm -rf *"
decision: deny
- action: file_write
path: ".env"
decision: deny
# ... hundreds more deny rules needed
This is fundamentally flawed because you cannot anticipate every dangerous action an AI agent might attempt. The model might use find . -delete instead of rm -rf, or read .env.local instead of .env. Deny-by-default eliminates this arms race entirely.
Progressive Permission Expansion
Deny-by-default does not mean the agent is permanently restricted. Teams adopt a progressive approach:
- Start locked down -- Deploy with
defaultAction: denyand observe what the agent attempts - Review audit logs -- SafeClaw's hash-chained audit trail shows every denied action with full context
- Add targeted rules -- Grant specific permissions for actions the agent legitimately needs
- Use escalation -- For sensitive operations, use
decision: escalateto require human approval rather than blanket allow
rules:
- action: file_write
path: "./output/**"
decision: allow
reason: "Agent may write to output directory"
- action: file_write
path: "./config/**"
decision: escalate
reason: "Config changes require human review"
This pattern lets teams expand agent capabilities incrementally while maintaining a clear, auditable record of what is permitted and why.
Deny-by-Default in Security Standards
Deny-by-default aligns with established security frameworks:
- NIST Zero Trust Architecture (SP 800-207) requires that access is denied by default and granted per-session based on policy
- OWASP recommends deny-by-default for access control in all application architectures
- ISO 27001 Annex A.9 specifies that access should be restricted to what is explicitly authorized
- EU AI Act high-risk system requirements call for appropriate levels of human oversight, which deny-by-default enables by design
Cross-References
- What Is Action Gating for AI Agents?
- What Is the Principle of Least Privilege for AI Agents?
- What Does Fail-Closed Mean for AI Agent Safety?
- What Are AI Agent Autonomy Levels?
Try SafeClaw
Action-level gating for AI agents. Set it up in your browser in 60 seconds.
$ npx @authensor/safeclaw