Raven — 0-Day Auto-Prevent
This skill is Raven's policy enforcer. It runs the same defensive plan as raven-zero-day-defend but with the human pre-authorizing classes of action by policy rather than each individual action. It is the highest-blast-radius skill in the 0-day suite, and the rules below are non-negotiable.
The skill MUST NOT bypass raven/approval/gate.py. "Auto" means the gate's smart mode is configured with policy-derived rules — it does NOT mean the gate is off.
When to use
Trigger when the user asks any of:
- "Auto-prevent this 0-day"
- "Auto-block / auto-quarantine on detection of
<pattern>" - "Run my response policy automatically"
- "Standing policy: isolate any host that matches
<criteria>" - "Apply the playbook without my approval for low-risk actions"
Do not trigger for: a single one-off incident (use raven-zero-day-defend), or for any user who has not explicitly written a policy. This skill refuses to fabricate a policy on the user's behalf.
Inputs
Required:
- Policy reference — path to a Raven policy file OR an inline policy YAML block. Policies must be validated against the policy schema before execution.
- Trigger source — one of:
alert-stream(live fromraven-zero-day-detection),single-alert(one alert id),signal(analyst-supplied indicator block)
Optional:
- Dry run —
trueto evaluate the policy and emit the plan without executing; defaultfalse - Audit sink —
file(default),kafka,siem-webhook
Policy schema (mandatory)
A policy is a YAML document with these top-level keys. The skill MUST reject any policy that fails schema validation.
policy_id: P-PROD-WEB-2026-01
owner: <email or team>
authorized_assets:
- <fqdn or cidr or asset tag> # at least one; "*" is rejected
trigger_predicate:
any_of:
- alert.severity: critical
- alert.detector_hits[*].rule_id: raven.binary.suspicious_packer_v3
- alert.d3fend_techniques: [D3-FA]
actions:
- name: isolate_host
d3fend_id: D3-NI
module: raven.mitigation.containment_actions
auto_approve_if:
- asset_tag in [non-production, canary]
- blast_radius_score < 0.3
else: manual
- name: rotate_credentials
d3fend_id: D3-CH
module: raven.mitigation.response_orchestrator
auto_approve_if:
- principal.type == service-account
else: manual
- name: deploy_decoy
d3fend_id: D3-DF
module: decoy.file
auto_approve_if:
- always
required_negative_constraints:
- never_touch_assets: [<asset list>]
- never_apply_to_principals: [<principal list>]
- max_actions_per_minute: 10
- max_actions_per_hour: 100
Schema notes:
authorized_assetsMUST list specific assets — wildcard*is rejected.- Every action MUST have a
d3fend_idand amodulefrom Raven's defender-edition module list. Excluded modules (offensive.py,metasploit_integration.py,empire_client.py,exploitdb*.py) fail validation. auto_approve_ifpredicates are evaluated against the trigger context; if any predicate is unresolvable, the action falls toelse: manualautomatically.required_negative_constraintsare hard caps; the skill MUST honor them even ifauto_approve_ifwould otherwise authorize.
Pipeline — six mandatory stages
Stage 1 — Policy load and validate (𝒯-grounded)
- Parse the policy with a JSON-schema validator. Reject on any schema failure.
- Resolve every
d3fend_idviaraven.d3fend.api.lookup_technique— non-existent ids fail validation. - Confirm every
modulereference is in the defender-edition allowlist viaraven.d3fend.coverage.allowed_modules. - Persist the policy hash to the audit log; future runs MUST log the same hash or fail-closed.
Stage 2 — Trigger evaluation (𝒯-grounded)
For each incoming signal (alert from raven-zero-day-detection, finding from raven-zero-day-investigator, or analyst-supplied indicator):
- Evaluate
trigger_predicatestrictly — boolean evaluation only, no LLM interpretation. - If the predicate matches, emit a
MatchedTriggerevent with the signal hash and policy id. - If multiple actions match, retain order from the policy file — execution is deterministic.
Stage 3 — Action authorization (G4 + approval-gate)
For each candidate action:
- Check
required_negative_constraintsfirst. If any constraint is violated, the action is rejected withreason=constraint_violationand dispatched to manual review. - Evaluate
auto_approve_ifpredicates. If all resolve true, the action is markedsmart_eligible. - The action ALWAYS routes through
raven.mitigation.response_orchestrator.execute(...), which callsraven/approval/gate.py. Evensmart_eligibleactions go through the gate — the gate is the single enforcement point. - The gate's
smart.pyLLM is given the action context, policy snippet, and trigger evidence. It returns approve / deny / escalate. UNRECOVERABLE_BLOCKLISTpatterns inraven/approval/patterns.pyare hard-rejected even when policy says auto-approve.
The skill MUST NOT call mitigation modules directly to bypass the gate. This is the most-tested invariant.
Stage 4 — Rate limiting
Enforce max_actions_per_minute and max_actions_per_hour using a Redis-backed sliding window. On rate-limit breach:
- Subsequent actions are dispatched to
manualregardless of policy. - Emit a
raven_auto_prevent_rate_limit_breach_totalPrometheus counter. - Notify the policy owner via the configured channel.
Stage 5 — Execution & verification (𝒯-grounded)
After the gate approves, execute the action through the named module. After execution:
- Capture the module's return value and any side-effect handle (process id, firewall rule id, decoy deployment id).
- Verify the side effect with an independent tool-oracle call — e.g. if the action was
isolate_host, query the firewall to confirm the rule is present. - If verification fails, immediately attempt a rollback via the
restore/subsystem and escalate to manual.
Stage 6 — Audit log emission
Every action — approved, denied, rate-limited, or rolled-back — appends one record to the audit log:
{
"ts": "...",
"policy_id": "...",
"policy_sha": "...",
"trigger_signal_hash": "...",
"action_name": "...",
"d3fend_id": "...",
"module": "...",
"approval_decision": "approve|deny|escalate",
"approval_reason": "...",
"executed": true|false,
"verified": true|false,
"rolled_back": true|false,
"blast_radius_score": <float>,
"operator_override": null,
"cdp_grounding": {"T": true, "M": true|false, "L": false}
}
Audit log is append-only, hash-chained (each record contains prev_record_sha256). The skill MUST refuse to start if the chain on disk is broken.
CDP contract — quick check before each action
assert action.d3fend_id resolves through raven.d3fend.api.lookup_technique
assert action.module in defender-edition allowlist
assert approval gate returned a decision (not None)
assert at least one 𝒯 tool oracle invocation was made (this stage or upstream)
assert action satisfies required_negative_constraints
Any failed assertion aborts the action and emits an audit record with approval_decision="abort_cdp_violation".
Output contract
# Raven 0-Day Auto-Prevent — policy <policy_id>
## Run metadata
- Policy SHA: <sha>
- Trigger source: <alert-stream|single-alert|signal>
- Window: <start> → <end>
- Dry run: <true|false>
## Triggered actions (<count>)
### Action <action_name> on <target>
- D3FEND: <id>
- Module: <module>
- Approval: <approve|deny|escalate>
- Auto-approve predicates: <list>
- Executed: <yes|no>
- Verified: <yes|no>
- Rolled back: <yes|no>
- Blast radius: <score>
- Audit record: <id>
(repeat)
## Rate-limit events (<count>)
| ts | counter | breach |
|----|---------|--------|
## Constraint violations rejected (<count>)
| action | violation | dispatched_to_manual |
|--------|-----------|-----------------------|
## Audit chain integrity
- Records appended: <n>
- Chain valid: <yes|no>
- Last record SHA: <sha>
Refusal rules
- Refuse to run without a validated policy. No default policy exists.
- Refuse any policy with
authorized_assets: ["*"]. - Refuse any policy referencing excluded modules.
- Refuse to start if the audit log chain on disk is broken.
- Refuse to bypass
raven/approval/gate.pyunder any flag, including--force. - Refuse to auto-execute any action without a verification step.
- Refuse to silently downgrade
manualdecisions tosmart— the gate's decision is final per-action.
Related skills
raven-zero-day-detection— primary upstream producer of triggers.raven-zero-day-investigator— alternative upstream producer (investigation outcomes).raven-zero-day-defend— same action library, but always operator-in-the-loop.raven-zero-day-fixing— invoked when an action isapply_patchorrollback.restore/subsystem — invoked for verified rollback on execution failure.- D3FEND OWL integration (
raven/d3fend/) — id resolution for every action (D3FEND home).