2025-11-19 · Authensor

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:

Allow-by-default forces defenders to enumerate everything that is dangerous. Deny-by-default forces attackers to find something that is permitted. The asymmetry strongly favors the defender.

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:

  1. An agent with an empty policy file can do nothing
  2. Each capability must be explicitly granted
  3. New tools added to the agent are automatically blocked until policy is updated
  4. 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:

  1. Start locked down -- Deploy with defaultAction: deny and observe what the agent attempts
  2. Review audit logs -- SafeClaw's hash-chained audit trail shows every denied action with full context
  3. Add targeted rules -- Grant specific permissions for actions the agent legitimately needs
  4. Use escalation -- For sensitive operations, use decision: escalate to 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:

SafeClaw's 446-test suite includes comprehensive validation that the deny-by-default behavior is maintained across all action types, edge cases, and policy configurations.

Cross-References

Try SafeClaw

Action-level gating for AI agents. Set it up in your browser in 60 seconds.

$ npx @authensor/safeclaw