Remediation

Ravenscan can generate, simulate, and execute guided remediation plans for infrastructure findings. Credentials are fetched from Coderaft Vault at execution time — they are never stored or logged by Ravenscan. All actions are logged to the immutable WORM audit trail.

Workflow overview

  1. Select credential — enter the UUID of a Vault credential (SSH key or sudo password). The secret is fetched from Coderaft Vault at execution time — never stored by Ravenscan.
  2. View plan — a step-by-step plan is generated from the finding's rule (e.g. vuln-ssh-* → update sshd_config + restart, with a backup step).
  3. Dry-run — simulate execution: checks command safety, warns on destructive ops, no host mutation.
  4. Apply — execute the plan via SSH. Poll status via GET /api/v1/remediation/status/:plan_id.
  5. Rollback — run each step's rollback_command in reverse order to restore pre-remediation state.

API — full workflow

Remediation API workflow
# Step 1: create a remediation plan
curl -X POST https://ravenscan.example.com/api/v1/remediation/plan \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "finding_id": "vuln-ssh-weak-cipher-abc123",
    "target_host": "192.168.1.10",
    "credential_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
  }'
# → { "plan_id": "uuid", "steps": [...], "estimated_duration_s": 40 }

# Step 2: dry-run — no host mutation
curl -X POST https://ravenscan.example.com/api/v1/remediation/dry-run \
  -H "Authorization: Bearer $API_KEY" \
  -d '{ "plan_id": "uuid" }'

# Step 3: apply (confirm: true required)
curl -X POST https://ravenscan.example.com/api/v1/remediation/apply \
  -H "Authorization: Bearer $API_KEY" \
  -d '{ "plan_id": "uuid", "confirm": true }'

# Poll status (for long-running plans)
curl https://ravenscan.example.com/api/v1/remediation/status/uuid \
  -H "Authorization: Bearer $API_KEY"
# → { "status": "running|done|failed|rolled_back", ... }

# Rollback executed steps
curl -X POST https://ravenscan.example.com/api/v1/remediation/rollback/uuid \
  -H "Authorization: Bearer $API_KEY"

Plan response — example

Example plan response
{
  "plan_id": "uuid",
  "finding_id": "vuln-ssh-weak-cipher-abc123",
  "target_host": "192.168.1.10",
  "steps": [
    {
      "order": 1,
      "command": "sshd -T | grep ciphers",
      "expected_outcome": "output lists configured ciphers",
      "rollback_command": "echo 'no rollback needed for read-only probe'"
    },
    {
      "order": 2,
      "command": "cp /etc/ssh/sshd_config /etc/ssh/sshd_config.wolfguard.bak && sed -i ...",
      "expected_outcome": "sshd_config updated with strong ciphers",
      "rollback_command": "cp /etc/ssh/sshd_config.wolfguard.bak /etc/ssh/sshd_config && systemctl restart sshd"
    }
  ],
  "estimated_duration_s": 40
}

Security

  • No secrets in payload or logs — credential_id is a UUID referencing Coderaft Vault. The actual SSH/sudo credential is fetched at execution time via vault.Fetch(credential_ref).
  • UUID validation — the API rejects any credential_id that is not a valid UUID, preventing accidental raw credential submission.
  • WORM audit trail — every plan creation, dry-run, apply step, and rollback is appended to the immutable audit_log table (SQLite triggers preventing UPDATE and DELETE).

Plan status values

Status Meaning
pendingPlan created, not yet applied
runningSSH execution in progress
doneAll steps completed successfully
failedOne or more steps failed
rolled_backAll rollback commands executed

Scope

Remediation is executed over SSH only. A winrm-typed Vault credential can be stored, but there is no real WinRM executor yet — Windows credentialed remediation is not available today.

Next steps