Warden’s policy system is what separates an autonomous security tool from an uncontrolled one. Before any fix is applied and before the process exits, Warden evaluates the scan result and remediation plan against your configured policy rules. The result is aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/DevDonzo/warden/llms.txt
Use this file to discover all available pages before exploring further.
PolicyDecision — a structured object that records exactly which gates fired, whether fixes are blocked, whether the pipeline should fail, and what the exit code will be. Every policy decision is written into agent-run-record.json so the rationale is always auditable after the fact.
The Three Gate Types
Policy gates are configured in thepolicy block of .wardenrc.json. All three gates are evaluated on every run; they are not mutually exclusive.
1. failOnSeverity
Fails the pipeline when the highest-severity finding in the scan result meets or exceeds the configured threshold.
evaluatePolicy() identifies the highest present severity by walking critical → high → medium → low and checking which count in ScanSummary is non-zero. If the highest present severity is at or above failOnSeverity, a reason string is appended:
shouldFailPipeline is set to true only when the --ci flag is active and at least one reason contains "Pipeline gate triggered". In interactive runs, the gate reason is logged but the process exits with code 0.
2. failOnPosture
Fails the pipeline when the computed security posture meets or exceeds the configured posture level.
| Posture | Risk Score Range | Priority | Valid failOnPosture value |
|---|---|---|---|
stable | 0 – 29 | 0 | No — stable cannot be configured as a gate value |
guarded | 30 – 59 | 1 | Yes |
elevated | 60 – 89 | 2 | Yes |
critical | 90 – 100 | 3 | Yes |
failOnPosture accepts "guarded", "elevated", or "critical" only — "stable" is not a valid gate value because it represents the absence of a security concern. The posture priority order means failOnPosture: "guarded" will also trigger on elevated and critical. Setting it to "critical" only fires when the risk score reaches 90 or above.
Mechanics: buildRemediationPlan() derives the posture from riskScore. The risk score is computed as a weighted sum across all vulnerabilities: each finding contributes SEVERITY_PRIORITY × 20 base points, plus up to 30 points from its CVSS score, plus 25 points if a known exploit is available. The total is capped at 100.
3. requireApprovalAboveSeverity
Blocks automated fix application — without failing the pipeline — when the highest finding meets or exceeds the configured severity. A warden-approval-request.json file is written to scan-results/ so a human or downstream system can review and re-authorize the run.
shouldBlockFixes is set to true. The fix loop is skipped entirely and the approval request artifact is written. The pipeline continues to report generation and history/memory updates — it does not halt.
The Approval Flow
Approval is a two-step human-in-the-loop mechanism:Gate fires — approval request written
Warden detects that the highest severity meets
requireApprovalAboveSeverity. Because no approval token was provided, shouldBlockFixes: true and approvalSatisfied: false are set. warden-approval-request.json is written to scan-results/ containing the highest severity, posture, risk score, gate reasons, and the next-step instruction.Human reviews the approval request
A reviewer reads
warden-approval-request.json (or the agent-run-record.json policyDecision block) and decides whether automated remediation should proceed. This is the control point — a team lead, security engineer, or automated review system makes the call.The only accepted approval token value is the literal string
approved. Any other value leaves approvalSatisfied: false and the fix loop remains blocked. This is intentional — the token is a boolean gate, not a passphrase.CI Mode and Exit Codes
Without--ci, Warden always exits with code 0 regardless of what the policy evaluation found. Gate reasons are logged and recorded in artifacts, but they do not affect process exit.
With --ci, shouldFailPipeline is evaluated and the exit code changes:
| Condition | Exit Code |
|---|---|
| No gates fired | 0 |
failOnSeverity or failOnPosture gate fired | 2 |
Full Policy Configuration Example
- Any
criticalfinding fails the CI pipeline. - An
elevatedorcriticalposture (risk score ≥ 60) fails the CI pipeline. - Any
highorcriticalfinding blocks automated fixes until--approval-token approvedis provided.
The PolicyDecision Type
Every policy evaluation produces a PolicyDecision object that is embedded verbatim into agent-run-record.json: