{
  "entry_points": [
    "app/main.py (FastAPI app initialization and route registration)",
    "app/proxy.py (Handles /v1/chat/completions HTTP endpoint)",
    "app/reports.py (Dashboard/report HTTP endpoints)"
  ],
  "data_flow": [
    "Client -> app/main.py -> app/proxy.py",
    "app/proxy.py -> app/store.py (persist run/request metadata)",
    "app/proxy.py -> Upstream llama.cpp (forward request)",
    "Upstream llama.cpp -> app/proxy.py -> app/redaction.py (sanitize response)",
    "app/redaction.py -> Client/Dashboard",
    "Dashboard Request -> app/reports.py -> app/store.py (aggregate stats)",
    "app/reports.py -> Client/Dashboard"
  ],
  "risks": [
    {
      "module": "app/proxy.py",
      "risk": "Unvalidated upstream forwarding and metadata recording may expose the system to SSRF, prompt injection, or unbounded request logging. Lack of rate limiting or response validation could lead to resource exhaustion."
    },
    {
      "module": "app/store.py",
      "risk": "SQLite write concurrency limits (database locking) under concurrent proxy requests. Potential SQL injection if parameterization is missing. Unbounded table growth without retention policies."
    },
    {
      "module": "app/redaction.py",
      "risk": "Regex/pattern-based secret removal is prone to bypasses (false negatives) and may inadvertently strip valid data (false positives). Incomplete sanitization could leak credentials or PII in dashboard previews."
    },
    {
      "module": "app/reports.py",
      "risk": "Heavy aggregation queries on SQLite may cause read locks or performance degradation. Dashboard endpoints may lack authentication/authorization, risking information disclosure."
    }
  ]
}