Memproof supports a deny-by-default security posture where any memory operation that doesn’t match an explicit policy rule is automatically denied. This is the recommended configuration for production deployments.
Configuration
Set on_policy_miss: deny in the defaults section of your policy YAML:
How It Works
When the policy engine evaluates an operation:
- Rules are evaluated in priority order (lowest number first)
- The first matching rule determines the decision
- If no rules match, the
on_policy_miss setting is used
- With
deny, unmatched operations receive a PolicyDeniedError
Allow-by-Default (Alternative)
For development or less restrictive environments, you can use on_policy_miss: allow:
Using on_policy_miss: allow means any operation that doesn’t match a deny
rule will be permitted. This is suitable for development but not recommended
for production.
Testing Your Policy
Use the CLI to verify which operations are allowed or denied:
The Memproof example policy at examples/memproof.yaml ships with
on_policy_miss: deny as the recommended default.