Deterministic Security Gateways for Autonomous AI Agents
Authors: Kavach Security Architecture Group • Publication: November 2026 • Classification: Public Engineering Architecture
1. The Failure of Probabilistic Self-Governance
When an LLM is asked to both write code and verify whether the code complies with company security policy, the risk of sycophancy and confabulation is high. If an injection attacker embeds deceptive instructions within a repository file or API schema, the agent can be coerced into calling destructive tools. Kavach decouples reasoning from enforcement: the AI suggests patches, while an out-of-band Open Policy Agent (OPA) engine enforces non-negotiable Rego invariants.
2. The 7-Stage Zero-Trust MCP Gateway Pipeline
Every MCP tool invocation received by Kavach traverses seven isolated security gates before execution:
- Cryptographic Identity Binding: Verifies the calling agent identity and public key signature.
- RBAC/ABAC Principal Authorization: Ensures the tool scope matches project boundaries (prevention of Broken Object Level Authorization / BOLA).
- Deterministic OPA Policy Evaluation: Evaluates Rego guardrails with zero bypass allowed for CRITICAL tiers.
- Dynamic Risk Severity Assessment: Determines blast radius and assigns container isolation requirements.
- Human-in-the-Loop Approval Check: Halts destructive actions until a designated security officer confirms.
- Isolated Tool Execution: Runs scanners (Semgrep, Trivy, Gitleaks) inside ephemeral containers.
- Immutable PostgreSQL Audit Trail: Records sanitized payloads with cryptographic trace IDs.
3. Empirical Validation vs. Static Checklists
Traditional compliance relies on self-reported questionnaires. Kavach enforces runtime evidence: an issue is only marked resolved after an automated sandbox rescan proves that the offending AST node or vulnerability signature has ceased to trigger scanner detections.
