◈
Policies
policy.yaml
Define enforceable rules: permissions, approvals, network policy, data sensitivity.
Policies are the governance layer. They map to runtime guardrails, tool approvals, and network restrictions. Policy enforces "most restrictive wins" — lower scopes cannot broaden permissions. Policies define data sensitivity classifications, approval gates, allow/deny lists for tool operations, network egress controls, and observability settings.
Schema
policy.yamlyaml
# policy.yaml — API Security Policy
name: api-security
version: "2.0"
scope: organization
severity: critical
rules:
- name: no-hardcoded-secrets
description: "Never hardcode API keys, passwords, or tokens"
enforcement: block
check: "No string literals matching secret patterns"
- name: input-validation
description: "All API inputs must be validated"
enforcement: warn
check: "Every endpoint has input validation middleware"
- name: rate-limiting
description: "All public endpoints must have rate limiting"
enforcement: block
check: "Rate limiter middleware present on all routes"
- name: sql-injection
description: "Use parameterized queries only"
enforcement: block
check: "No raw SQL string concatenation"
- name: auth-required
description: "All non-public endpoints require authentication"
enforcement: block
check: "Auth middleware on all protected routes"
approval_gates:
- name: security-review
required_for:
- "Changes to authentication logic"
- "New API endpoints"
- "Database schema changes"
approvers:
- security-team
- tech-leadUsage
# Policies apply at the organization level
# They override all other protocol objects
# A policy can reference specific tools it governs:
applies_to:
tools:
- send-email
- execute-query
- deploy-productionBest Practices
- ✓Scope policies clearly — organization, team, or project level
- ✓Use "block" enforcement for critical security rules
- ✓Use "warn" enforcement for best practices that allow exceptions
- ✓Define approval gates for high-risk operations
- ✓Version policies and maintain a changelog
- ✓Keep rules testable — vague rules cannot be enforced
Anti-Patterns
- ✗Policies so strict that agents cannot complete any work
- ✗Unversioned policies that change without notice
- ✗Rules without clear enforcement levels
- ✗Missing approval gates for destructive operations