ravage

Technical Guide

This guide is for contributors changing Ravage internals. For operator commands, start with How To Use. For the system flow, read Architecture.

First Principles

Most Ravage changes should preserve these rules:

Repository Map

Core runtime:

Agent internals:

Benchmark and evaluation:

Command Execution Path

ravage attack is the canonical model-agent entry point:

  1. Resolve brief and target URL.
  2. Create run directory.
  3. Configure audit.db, workspace/, and optional report paths.
  4. Run the ai-web loop with the selected model, mode, and tool runtime.

ravage scan follows the same run-shape pattern but calls deterministic DAST instead of the model loop.

The ravage xben ... path manages target Docker projects, case selection, timeouts, per-case outputs, flag matching, and benchmark modes. For each case it generates a normal engagement brief and invokes the same public ravage attack command. XBEN owns provisioning and scoring; exploit behavior stays in the attack engine. The old top-level ravage --benchmark ... examples are not the current public benchmark interface.

Model Contract

The model must return exactly one JSON action with:

The parser accepts fenced JSON or a JSON object embedded in text, but invalid model output is recorded and corrected through the next observation.

Observations are wrapped with:

This prevents target HTML, JavaScript, error pages, or API responses from pretending to be agent instructions.

Tool And Probe Rules

New tools should follow these rules:

Typed probes should distinguish:

When adding a probe, also update:

Source-Guided Workflow Rules

Source-guided workflows must not become one-off benchmark shortcuts. They should be based on reusable source signals and dynamic proof patterns.

Good workflow shape:

  1. Extract general source signal.
  2. Build candidate routes, params, credentials, object IDs, or payloads.
  3. Attempt bounded runtime proof against the scoped target.
  4. Record each attempt.
  5. Return flag/vulnerability observation only from live target evidence.
  6. Stop when the request budget is exhausted.

Avoid:

Evidence Gates

Ravage accepts findings only after tool-backed evidence. SQLi still has a specialized report_sqli path. Other classes use generic findings with evidence details.

For IDOR/SSTI and similar multi-step cases, proof-bundle verification can be enabled:

--proof-bundle-verifier --require-proof-bundle-findings

Use this when candidate signals are noisy and findings should require semantic proof before promotion.

Memory Rules

Memory is local and advisory.

Safe memory behavior:

Memory must not:

XBEN Modes

XBEN supports explicit context modes:

Do not compare runs unless mode, target set, model route, turn budget, memory mode, tool runtime, and Docker architecture are the same.

Test Strategy

Use focused tests for the touched subsystem:

.venv/bin/python -m pytest packages/ravage/tests/test_ai_agent.py
.venv/bin/python -m pytest packages/ravage/tests/test_xben_runner.py
.venv/bin/python -m pytest packages/ravage/tests/test_source_guided_runtime.py

Broad validation:

.venv/bin/python -m pytest packages/schemas packages/ravage/tests tests
.venv/bin/python -m ruff check .
.venv/bin/python -m mypy packages scripts

If the virtualenv console script is stale, use:

PYTHONPATH=packages/ravage/src:packages/schemas/src \
  .venv/bin/python -m ravage --help

Documentation Rules

Keep docs tied to current code: