01/Averqen·v1.0.0
Averqen
AI-assisted security investigation with deterministic security boundaries.
- status
- v1.0.0 · engineering complete
- role
- solo engineer
- focus
- AI security · detection · investigation · response
- proof
- 1,493 tests · 27 FORCE-RLS tables · 58 OpenAPI paths
I built Averqen to explore how AI can help investigate security incidents without becoming the authorization or execution boundary. Telemetry, detection, correlation, tenant isolation, policy decisions, and high-impact response controls remain deterministic; AI operates only on bounded evidence.

problem
Security tooling has two competing pressures: analysts need help making sense of large volumes of telemetry, but handing an AI model direct authority over detection or response creates a new security boundary.
I wanted to build a system where AI could contribute useful investigation context without being trusted to decide what happened, who may access the data, or what security action should execute.
architecture
The architecture keeps the model downstream of deterministic security controls. Events are normalized and detected first, alerts are correlated into incidents, and only then is a bounded evidence packet assembled for AI analysis. AI output goes through deterministic validation before it becomes visible as investigation context.
Architecture overview — v1.0.0
Security telemetry
- Ingestion
- Normalization
- Deterministic detection
- Alerts
Investigation foundation
- Incident correlation
- Entity graph
- Timeline
- Threat intelligence
Grounded AI
- Bounded evidence packet
- Structured investigation
- Citation validation
- Evidence sufficiency
Controlled response
- Response proposal
- Deterministic policy
- Human approval
- SimulationExecutor
Security boundary
- FORCE RLS
- Restricted runtime DB role
- MFA + scoped API keys
- Audit hash chain
AI investigates. Deterministic controls authorize. Humans approve. The model is downstream of detection and correlation — it never queries the database directly or executes response actions.
security telemetry
deterministic detection
Detection is deliberately outside the AI layer. Rules include single-event, threshold, sequence, and IOC matching. Alert evidence remains traceable back to source events.
Keeping detection deterministic means the system's conclusions about what happened are reproducible and auditable — not subject to model variance.
incident correlation
entity graph
grounded ai investigator
The AI investigator never queries the database directly. A deterministic EvidencePacketBuilder assembles bounded incident evidence and assigns stable references such as ALT-NNN, EVT-NNN, ENT-NNN, TI-NNN.
The model returns structured claims rather than unrestricted prose. Citations, MITRE mappings, contradiction references, and claim support are checked before the investigation receives its final status.
ai trust boundary
AI investigates.
Deterministic controls authorize.
Humans approve.
Attacker-controlled telemetry is treated as untrusted evidence, never as model instructions. Model confidence is stored separately from the deterministic evidence score, so the model cannot promote its own output from insufficient evidence to a verified conclusion.
threat intelligence
Threat intelligence adds context rather than truth. Indicators retain source provenance, confidence, freshness, and exact matches to internal evidence. Expired and revoked intelligence is handled differently from active observations.

controlled response
AI may propose a typed response action, but it cannot execute one. The backend independently validates the target, computes risk, evaluates deterministic policy, and requires human approval for high-impact actions before execution can proceed.
The v1.0.0 executor is simulation-only. No firewall, EDR, IAM, or operating-system control is performed.

tenant isolation
27 tenant-sensitive tables use PostgreSQL FORCE Row-Level Security. The runtime application role is neither a superuser nor BYPASSRLS, and workspace identifiers from paths or local storage act only as selectors — authorization still depends on authenticated live membership and database policy.
enterprise hardening
The security surface includes Redis-backed rate limiting, scoped API keys, TOTP MFA, hash-chained audit records, webhook SSRF defenses, SSE infrastructure, and security and compliance evidence exports. These controls sit at the infrastructure level, separate from the AI investigation path.
adversarial verification
The final hardening pass added adversarial coverage across authentication, cross-tenant access, prompt injection, SSRF, response authority, dangerous execution primitives, idempotency, and query safety.
- Tests
- 1,493 / 1,493 passing
- FORCE-RLS tables
- 27 tenant-sensitive
- OpenAPI paths
- 58
- Phase 9 adversarial
- 0 failures
engineering challenges
RLS context propagation. Release verification found services querying RLS-protected tables before setting the tenant/user GUC. The fix was to enforce tenant context setup before those operations, ensuring RLS policy had the correct context from the first query.
Refresh-token transaction failure. An audit RLS failure could invalidate the surrounding PostgreSQL transaction and roll back refresh-session state. Fixing context setup before audit writes resolved the cascade and kept the refresh path transactionally sound.
AI evidence vs authority. The architectural challenge was getting useful AI analysis — MITRE mappings, claim citations, contradiction detection — while ensuring the model never became the authorization or execution authority. The bounded evidence packet and structured output schema enforce that boundary at the protocol level.
demo
The release demo seeds 32 security events that flow through 8 detection rules, producing 11 alerts correlated into 3 incidents, with entity and threat-intelligence context assembled for each. The flagship incident in the dataset drives a complete investigation path: grounded AI analysis, a response proposal, human approval, and simulation.
→ 32 seeded events
→ 8 detection rules
→ 11 alerts
→ 3 incidents
→ entity / threat-intelligence context
→ grounded AI investigation
→ response proposal
→ human approval
→ simulation
known limitations
- Response execution is simulation-only; no real firewall, EDR, or IAM integrations are exercised.
- The system is an engineering portfolio project and is not presented as production-proven at enterprise scale.
- High-impact response actions remain behind deterministic policy and human approval.
- Averqen does not claim SOC 2 or ISO 27001 certification.
- The portfolio demo uses deterministic AI output so the investigation flow remains reproducible.
stack
Python · FastAPI · PostgreSQL · Redis · Next.js · TypeScript · SQLAlchemy · Alembic · OpenTelemetry · pytest
Areas
security telemetry · deterministic detection · incident correlation · entity graph · threat intelligence · MITRE ATT&CK · grounded AI investigation · evidence validation · AI trust boundary · deterministic response policy · human approval · simulation-only execution · hash-chained audit records · FORCE RLS · MFA · scoped API keys · Redis rate limiting · SSRF defenses · adversarial verification
repository
Public repository: github.com/miransec/averqen

