Preventing LLMs from Introducing Security and Compliance Violations
Enforce encryption standards, auth requirements, PII handling rules, and secrets policies — before the LLM generates a single line of non-compliant code.
AI coding assistants don't know your compliance posture.
They don't know that your SOC 2 audit requires auth middleware on every endpoint. They don't know that GDPR prohibits logging user email addresses. They don't know that your secrets management policy was updated after last year's incident.
Security teams are discovering that standard code review is no longer sufficient when AI generates 10× more code at 10× the speed. You need enforcement earlier in the loop.
Rule: Never log or expose user email, name, or address.
Context: GDPR Article 5 compliance. Violations require DPA notification.
✗ FAIL decision/auth-middleware-required
Rule: All API endpoints must use AuthMiddleware.
Context: SOC 2 CC6.1 — unauthenticated endpoints are a critical finding.
→ Surfaced 2 violations before code generation.
SAST and code review catch violations too late.
| Approach | Limitation | With Mneme HQ |
|---|---|---|
| SAST / linters | Find known vulnerability patterns; can't encode business-specific compliance rules | Business-specific rules encoded as decisions with rationale and enforcement |
| Security review | End-of-sprint bottleneck; too late to prevent; expensive | Pre-flight check at prompt time, before a line of code exists |
| Security training | Periodic; not actionable at the point of code generation | Rule surfaced exactly when relevant — during coding |
| Static policy docs | Not queryable; not enforced; go stale | Structured, retrievable, CI-gated |
Security rules enforced at the earliest possible moment.
Encode your security and compliance rules as decisions
Translate your security policies, GDPR obligations, and SOC 2 controls into structured YAML decisions with explicit rationale.
Run mneme check before prompting
Every AI-assisted change is checked against relevant security decisions before code is written — not after it's merged.
Generate assistant rules files with security context
mneme cursor generate produces a rules file that includes your security constraints, so assistants are compliance-aware in every session.
Gate CI with an audit trail
All violations are logged. In strict mode, CI fails on non-compliant code. Security teams get an auditable record of what was checked and when.
What security decisions look like.
id: no-pii-in-logs title: Never log PII in any endpoint or background job status: accepted rule: User email, name, phone, and address must never appear in log output or API responses not explicitly requesting them. rationale: GDPR Article 5(1)(f) — data must be processed securely. Violation requires DPA notification within 72 hours. enforcement: strict tags: [security, gdpr, pii, compliance]
id: auth-middleware-required title: All API endpoints must use AuthMiddleware status: accepted rule: No endpoint may be registered without AuthMiddleware in the middleware chain. rationale: SOC 2 CC6.1 control requirement. Unauthenticated endpoints are a critical audit finding. enforcement: strict tags: [security, soc2, auth, compliance]
$ mneme check "add debug endpoint for user actions" --tags gdpr,soc2 Checking against 6 security/compliance decisions... ✗ FAIL decision/no-pii-in-logs Reason: Endpoint returns user_id, email — PII exposure detected. ✗ FAIL decision/auth-middleware-required Reason: No auth middleware referenced in proposed endpoint. ✓ PASS decision/no-secrets-in-frontend ✓ PASS decision/encrypt-at-rest-required Result: FAIL (2 violations, strict mode)
What security teams see after enforcement goes live.
Common questions.
Can security teams manage decisions without engineering access?
Does Mneme HQ replace a SAST tool?
How do we handle rules that vary by region or environment?
mneme check --tags gdpr for EU-specific rules or --tags soc2 for audit controls.