Skip to content

Auto-Approve

Auto-approve lets safe queries bypass the approval step while still recording them in the audit log. It uses risk scoring to determine what qualifies as “safe.”

Request arrives
Workflow matched → has steps?
│ │
No Yes
▼ ▼
AutoApproved Check auto_approve config
Risk ≤ threshold?
┌────┼────┐
Yes No
▼ ▼
AutoApproved Pending (needs human)
[[auto_approve]]
database = "*"
environment = "staging"
risk = "low" # Maximum risk level to auto-approve
allow_read_only = true # SELECT always counts as Low
allow_safe_ddl = true # CREATE TABLE/INDEX counts as Low
max_estimated_rows = 1000 # Row threshold for large-table risk
FieldTypeDefaultDescription
databaseString"*"Database scope
environmentString"*"Environment scope
riskString"none"Max risk to auto-approve: low, medium, high, or none (disabled)
allow_read_onlyBooleantrueIf true, SELECT is always Low risk
allow_safe_ddlBooleantrueIf true, CREATE TABLE/VIEW/INDEX is always Low risk
max_estimated_rowsInteger1000Tables above this row count trigger higher risk
LevelMeaning
LowSafe operation (SELECT, safe DDL, small tables)
MediumModerate concern (1 warning, large table without cascade)
HighSignificant risk (DROP/TRUNCATE, multi-DML, cascade FK + large table, ≥3 warnings)
CriticalReserved for future use
UnknownSchema not synced — cannot assess risk
UnavailableParse failure — cannot classify

Important: Unknown and Unavailable are never auto-approved regardless of the risk threshold.

FactorTriggersResult
Read-onlySELECT + allow_read_only = trueLow
Safe DDLCREATE TABLE/VIEW/INDEX + allow_safe_ddl = trueLow
Schema not syncedAgent hasn’t synced schema yetUnknown
Multi-statement DML>1 DML statements in one requestHigh
DROP / TRUNCATEDestructive operations detectedHigh
≥3 SQL review warningsMultiple issues foundHigh
Cascade FK + large tableFK with CASCADE on table > max_estimated_rowsHigh
Cascade FK + small tableFK with CASCADE on table ≤ max_estimated_rowsMedium
Large tableTable > max_estimated_rows (without cascade)Medium
1-2 SQL review warningsMinor issues foundMedium
[[auto_approve]]
environment = "staging"
risk = "low"
allow_read_only = true

Result: All SELECT queries on staging auto-approve. DML still needs human approval.

Auto-approve reads + small writes on development

Section titled “Auto-approve reads + small writes on development”
[[auto_approve]]
environment = "development"
risk = "high"

Result: Everything except DROP/TRUNCATE/multi-DML auto-approves on development.

# Simply don't add an [[auto_approve]] entry for production.
# Or explicitly:
[[auto_approve]]
environment = "production"
risk = "none"

Use dbward policy resolve to see why a query was or wasn’t auto-approved:

Terminal window
dbward policy resolve --database app --environment production \
--sql "DELETE FROM sessions WHERE expired_at < now()"

The MCP tool dbward_explain_policy_failure provides the same information for AI assistants.