Components

Detailed description of each major component in Triage Warden.

tw-api

The HTTP server and web interface.

REST API Routes

RouteDescription
GET /api/incidentsList incidents with filtering
POST /api/incidentsCreate new incident
GET /api/incidents/:idGet incident details
POST /api/incidents/:id/actionsExecute action on incident
GET /api/playbooksList playbooks
POST /api/webhooks/:sourceReceive webhook events

Web Handlers

Server-rendered pages using HTMX and Askama templates:

  • Dashboard with KPIs
  • Incident list and detail views
  • Approval workflow interface
  • Playbook management
  • Settings configuration

Authentication

  • Session-based auth for web dashboard
  • API key auth for programmatic access
  • Role-based access control (admin, analyst, viewer)

tw-core

Core domain logic and data access.

Domain Models

#![allow(unused)]
fn main() {
pub struct Incident {
    pub id: Uuid,
    pub incident_type: IncidentType,
    pub severity: Severity,
    pub status: IncidentStatus,
    pub source: String,
    pub raw_data: serde_json::Value,
    pub verdict: Option<Verdict>,
    pub confidence: Option<f64>,
    pub created_at: DateTime<Utc>,
}

pub struct Action {
    pub id: Uuid,
    pub incident_id: Uuid,
    pub action_type: ActionType,
    pub status: ActionStatus,
    pub approval_level: Option<ApprovalLevel>,
    pub executed_by: Option<String>,
}
}

Repositories

Database access layer with SQLite and PostgreSQL support:

  • IncidentRepository
  • ActionRepository
  • PlaybookRepository
  • UserRepository
  • AuditRepository

Event Bus

Async event distribution:

#![allow(unused)]
fn main() {
pub enum Event {
    IncidentCreated { id: Uuid },
    IncidentUpdated { id: Uuid },
    ActionRequested { id: Uuid },
    ActionApproved { id: Uuid, approver: String },
    ActionExecuted { id: Uuid, success: bool },
}
}

tw-actions

Action handlers for incident response.

Email Actions

ActionDescription
parse_emailExtract headers, body, attachments
check_email_authenticationValidate SPF/DKIM/DMARC
quarantine_emailMove to quarantine
block_senderAdd to blocklist

Lookup Actions

ActionDescription
lookup_sender_reputationCheck sender against threat intel
lookup_urlsAnalyze URLs in content
lookup_attachmentsHash and check attachments

Host Actions

ActionDescription
isolate_hostNetwork isolation via EDR
scan_hostTrigger endpoint scan

Notification Actions

ActionDescription
notify_userSend user notification
notify_reporterUpdate incident reporter
escalateRoute to approval level
create_ticketCreate Jira ticket

tw-policy

Policy engine for action approval.

Rule Evaluation

#![allow(unused)]
fn main() {
pub struct PolicyRule {
    pub name: String,
    pub action_type: ActionType,
    pub conditions: Vec<Condition>,
    pub approval_level: ApprovalLevel,
}

pub enum PolicyDecision {
    Allowed,
    Denied { reason: String },
    RequiresApproval { level: ApprovalLevel },
}
}

Approval Levels

  1. Auto - No approval required
  2. Analyst - Any analyst can approve
  3. Senior - Senior analyst required
  4. Manager - SOC manager required

tw-connectors

External service integrations.

Connector Trait

#![allow(unused)]
fn main() {
#[async_trait]
pub trait Connector: Send + Sync {
    fn name(&self) -> &str;
    fn connector_type(&self) -> &str;
    async fn health_check(&self) -> ConnectorResult<ConnectorHealth>;
    async fn test_connection(&self) -> ConnectorResult<bool>;
}
}

Available Connectors

TypeImplementations
Threat IntelVirusTotal, Mock
SIEMSplunk, Mock
EDRCrowdStrike, Mock
Email GatewayMicrosoft 365, Mock
TicketingJira, Mock

tw-bridge

PyO3 bindings for Python integration.

Exposed Classes

from tw_bridge import ThreatIntelBridge, SIEMBridge, EDRBridge

# Use connectors from Python
threat_intel = ThreatIntelBridge("virustotal")
result = threat_intel.lookup_hash("abc123...")

tw_ai (Python)

AI triage and playbook execution.

Triage Agent

Claude-powered agent for incident analysis:

agent = TriageAgent(model="claude-sonnet-4-20250514")
verdict = await agent.analyze(incident)
# Returns: Verdict(classification="malicious", confidence=0.92, ...)

Playbook Engine

YAML-based playbook execution:

name: phishing_triage
steps:
  - action: parse_email
  - action: check_email_authentication
  - action: lookup_sender_reputation
  - condition: sender_reputation < 0.3
    action: quarantine_email