Engineering a Self-Hosted AI Compliance Auditor: 18 SOC 2/HIPAA/GDPR Controls, Signed ZIP Bundles, and 409 Legal Holds
Inside ai-compliance-auditor: 18-control SOC 2/HIPAA/GDPR registry, 20 deterministic CFG/ENC/LOG/RBAC/SOP scanners, HMAC-signed ZIP/PDF evidence bundles with offline verify_bundle.py, Policy RAG, and 409 legal-hold DSARs.
Compliance programs fail engineers when evidence lives in static screenshots, policy documents drift out of sync with live infrastructure, and statutory 30-day DSAR deletion workflows accidentally purge records locked under litigation holds.
AI Compliance & Regulatory Auditor Platform (source on GitHub) replaces manual audit spreadsheets with a Phase 2 FastAPI, async SQLAlchemy 2.0 (17 tables across 2 Alembic migrations), PostgreSQL (`pgvector`), and 8-tab React 18 TypeScript console.
18-Control Registry & 20 Deterministic Configuration/TLS Scanners#
Under `controls/` and `scanners/`, an 18-control baseline maps SOC 2 Trust Services Criteria, HIPAA Safeguards, and GDPR Articles alongside custom controls and HITL risk waivers. Twenty deterministic collectors (`CFG-001..004`, `ENC-001..004`, `LOG-001..004`, `RBAC-001..004`, `SOP-001..004`) evaluate inline text, uploaded artifacts, full repository trees, SSRF-guarded HTTP/TLS probes (`/scanners/probe-url`), and scheduled drift checks.
Signed ZIP/PDF Evidence Bundles & Zero-Dependency Offline Verifier#
Every state change appends to a SHA-256 hash-chained `audit_events` ledger under `evidence/`. Compilers generate HMAC-SHA256 signed JSON bundles, multi-page executive PDF attestations (`/report.pdf`), and downloadable ZIP archives (`/export-zip`) containing a standalone `verify_bundle.py` CLI so auditors can verify manifest signatures offline.
PII-Scrubbed Policy RAG, 409 Legal-Hold DSARs & Drift Alerts#
Policy indexing and privacy enforcement work together rather than operating in silos:
active_holds = await privacy_repo.find_active_holds(subject_email=dsar.subject_email)
if active_holds and dsar.request_type == "erasure":
raise HTTPException(
status_code=409,
detail="Erasure blocked: subject is covered by an active Legal Hold",
)- Policy RAG (`rag/`): Chunks handbooks by heading, scrubs PII/PHI before persistence, indexes `384`-dim or Ollama embeddings, maps citations to control codes, and answers compliance questions with explicit evidence links.
- DSAR & Retention Workflows (`privacy/`): Tracks 30-day DSAR SLAs, blocks held erasures with `409 Conflict` until hold release, verifies retention ceilings, and gates time-bounded retention exceptions.
- Drift Alerting & Separation of Duties (`alerts/`, `core/`): Dispatches control-regression, expiring-waiver, and DSAR SLA alerts to HMAC-signed webhooks while enforcing PBKDF2 + JWT RBAC (`viewer`, `auditor`, `compliance_officer`, `admin`), optional Separation of Duties, rate limiting, and OpenTelemetry.
Preparing for SOC 2, HIPAA, or GDPR automation without exposing sensitive evidence to external SaaS tools? Explore Software Architecture or book a consultation.
Production Case Studies & Capabilities
Explore how these engineering patterns are deployed in production systems and available through client engagements.
AI Compliance & Regulatory Auditor Platform
An open-source Python 3.12 (FastAPI), async SQLAlchemy 2.0 + PostgreSQL/pgvector, and React 18 compliance operations console implementing 18 SOC 2/HIPAA/GDPR controls, deterministic repo/URL/config scanners, HMAC-SHA256 signed evidence ZIP & PDF bundles with offline verification, Policy RAG, and 30-day DSAR workflows.
Software Architecture & System Design
Fast-moving teams frequently accrue hidden architectural liabilities: tangled domain logic, unmaintainable monoliths, or over-engineered microservices that paralyze development.
AI Engineering & LLM Integration
Many AI initiatives fail in production due to prompt fragility, high token latency, hallucination risks, and lack of structured evaluation. I bridge the gap between experimental LLM prompts and deterministic software engineering.
Frequently Asked Questions
How can external auditors verify evidence bundles exported from ai-compliance-auditor without trusting the live server?
What happens when a GDPR deletion DSAR targets records covered by an active Legal Hold?
Which deterministic scanners run before any LLM policy synthesis?
Related Technical Articles
Automating Compliance, Data Governance, QA, and IT Operations with Guarded Self-Hosted AI
How deterministic policy scanners, legal-hold DSAR blocks, HKDF/Fernet PII tokenization, SCIM 2.0 dry-run diffs, and OpenAPI E2E test synthesis power internal governance and release engineering safely.
Self-Hosted AI Data Governance: Checksum PII Tokenization, Undoable Jaro-Winkler Merges, and PostgreSQL Schema Audits
How ai-data-governance combines Luhn/Mod-97 checksum PII detection, reversible HKDF/Fernet vault tokenization, undoable Jaro-Winkler/Soundex deduplication, E.164/USPS normalizers, and PostgreSQL DDL hygiene audits.