# firdawsm/aics203-red-team-lab architecture

> Architecture diagram of the GitHub repository firdawsm/aics203-red-team-lab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/firdawsm/aics203-red-team-lab
- Repository: https://github.com/firdawsm/aics203-red-team-lab

## Overview

This repository is a deterministic, offline AI red-team validation lab, not a production AI service. The main workflow is a user submitting a probe or running supplied cases through the loopback HTTP API, which evaluates each request under baseline or hardened policy and returns findings; the suite also records results. The evaluator implements retrieval, disclosure, tool-use, and output-handling scenarios. The README documents SSH-tunnel-only access and the 16-case validation workflow. The graph follows shown source calls; it excludes evidence files and lab documentation from runtime components.

Main entry points: [`server/engine.py`](https://github.com/firdawsm/aics203-red-team-lab/blob/main/server/engine.py) (Policy Evaluator), [`server/app.py`](https://github.com/firdawsm/aics203-red-team-lab/blob/main/server/app.py) (HTTP API), [`client/run_cases.py`](https://github.com/firdawsm/aics203-red-team-lab/blob/main/client/run_cases.py) (Case Suite), [`client/individual_probe.py`](https://github.com/firdawsm/aics203-red-team-lab/blob/main/client/individual_probe.py) (Single Probe)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Lab Clients"]
  node_case_suite["Case Suite<br/>[run_cases.py]"]
  node_single_probe["Single Probe"]
  node_cases["Supplied Cases<br/>[cases.json]"]
end

subgraph group_service["Simulator Service"]
  node_http_api["HTTP API<br/>[app.py]"]
  node_evaluator["Policy Evaluator<br/>[engine.py]"]
end

subgraph group_scenarios["Policy Scenarios"]
  node_retrieval["Retrieval Checks<br/>[engine.py]"]
  node_disclosure["Disclosure Checks<br/>[engine.py]"]
  node_tool_use["Tool Checks<br/>[engine.py]"]
  node_output_handling["Output Checks<br/>[engine.py]"]
end

node_user(("Lab User"))

node_user -->|"runs suite"| node_case_suite
node_user -->|"submits probe"| node_single_probe
node_case_suite -->|"loads cases"| node_cases
node_case_suite -->|"posts requests"| node_http_api
node_single_probe -->|"posts request"| node_http_api
node_http_api -->|"evaluates payload"| node_evaluator
node_evaluator -->|"dispatches scenario"| node_retrieval
node_evaluator -->|"dispatches scenario"| node_disclosure
node_evaluator -->|"dispatches scenario"| node_tool_use
node_evaluator -->|"dispatches scenario"| node_output_handling
node_http_api -->|"returns JSON"| node_case_suite
node_http_api -->|"returns JSON"| node_single_probe

click node_case_suite "https://github.com/firdawsm/aics203-red-team-lab/blob/main/client/run_cases.py"
click node_single_probe "https://github.com/firdawsm/aics203-red-team-lab/blob/main/client/individual_probe.py"
click node_cases "https://github.com/firdawsm/aics203-red-team-lab/blob/main/cases/cases.json"
click node_http_api "https://github.com/firdawsm/aics203-red-team-lab/blob/main/server/app.py"
click node_evaluator "https://github.com/firdawsm/aics203-red-team-lab/blob/main/server/engine.py"
click node_retrieval "https://github.com/firdawsm/aics203-red-team-lab/blob/main/server/engine.py"
click node_disclosure "https://github.com/firdawsm/aics203-red-team-lab/blob/main/server/engine.py"
click node_tool_use "https://github.com/firdawsm/aics203-red-team-lab/blob/main/server/engine.py"
click node_output_handling "https://github.com/firdawsm/aics203-red-team-lab/blob/main/server/engine.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_case_suite,node_single_probe,node_cases,node_user toneBlue
class node_http_api,node_evaluator toneAmber
class node_retrieval,node_disclosure,node_tool_use,node_output_handling toneMint
```

## Components

### Lab Clients

- [Case Suite](https://github.com/firdawsm/aics203-red-team-lab/blob/main/client/run_cases.py): `client/run_cases.py`
- [Single Probe](https://github.com/firdawsm/aics203-red-team-lab/blob/main/client/individual_probe.py): `client/individual_probe.py`
- [Supplied Cases](https://github.com/firdawsm/aics203-red-team-lab/blob/main/cases/cases.json): `cases/cases.json`

### Simulator Service

- [HTTP API](https://github.com/firdawsm/aics203-red-team-lab/blob/main/server/app.py): `server/app.py`
- [Policy Evaluator](https://github.com/firdawsm/aics203-red-team-lab/blob/main/server/engine.py): `server/engine.py`

### Policy Scenarios

- [Retrieval Checks](https://github.com/firdawsm/aics203-red-team-lab/blob/main/server/engine.py): `server/engine.py`
- [Disclosure Checks](https://github.com/firdawsm/aics203-red-team-lab/blob/main/server/engine.py): `server/engine.py`
- [Tool Checks](https://github.com/firdawsm/aics203-red-team-lab/blob/main/server/engine.py): `server/engine.py`
- [Output Checks](https://github.com/firdawsm/aics203-red-team-lab/blob/main/server/engine.py): `server/engine.py`

### Other components

- **Lab User**

## Connections

- Lab User → Case Suite: runs suite (evidence: `README.md`)
- Lab User → Single Probe: submits probe (evidence: `README.md`)
- Case Suite → Supplied Cases: loads cases (evidence: `client/run_cases.py`)
- Case Suite → HTTP API: posts requests (evidence: `client/run_cases.py`)
- Single Probe → HTTP API: posts request (evidence: `client/individual_probe.py`)
- HTTP API → Policy Evaluator: evaluates payload (evidence: `server/app.py`)
- Policy Evaluator → Retrieval Checks: dispatches scenario (evidence: `server/engine.py`)
- Policy Evaluator → Disclosure Checks: dispatches scenario (evidence: `server/engine.py`)
- Policy Evaluator → Tool Checks: dispatches scenario (evidence: `server/engine.py`)
- Policy Evaluator → Output Checks: dispatches scenario (evidence: `server/engine.py`)
- HTTP API → Case Suite: returns JSON (evidence: `client/run_cases.py`)
- HTTP API → Single Probe: returns JSON (evidence: `client/individual_probe.py`)
