# From CRUD to Autonomous Agents: Formal Validation and Zero-Trust Security for Semantic Gateways in AI-Native Enterprise Systems

Crypto.world

> Enterprise systems are moving from deterministic CRUD/REST architectures to AI-native systems where large language models plan and execute multi-step actions by calling tools.

**arXiv**: 2604.25555

**Published**: 2026-04-28

**Authors**: Ignacio Peyrano

## AI summary

## Overview

**Research area:** Computer security (cs.CR) at the intersection of enterprise software architecture, agentic AI security, and formal verification — specifically the design and validation of a "Semantic Gateway" built on the Model Context Protocol (MCP).

**Technical level:** Advanced. The paper combines a systems architecture proposal with POMDP formalism, Enabledness-Preserving Abstractions, greybox fuzzing, and an OPA/Rego policy model; the motivation and results are readable by a general engineering audience, but the formal sections require background in state-machine verification.

**Scope (1 sentence):** The paper argues that LLM-driven autonomous agents must be treated as stochastic state-transition systems rather than ordinary API clients, and backs this with a three-layer Zero-Trust gateway design, a formal model, an Echidna-inspired semantic fuzzer, and a reproducible Python proof-of-concept.

## What This Paper Is About

Enterprise systems are moving from deterministic CRUD/REST architectures to AI-native systems where large language models plan and execute multi-step actions by calling tools. Exposing granular REST endpoints directly to such agents causes context-window bloat and opens new attack surfaces — indirect prompt injection, context poisoning, and Broken Object Level Authorization (BOLA) via hallucinated tool combinations — while the model's probabilistic nature undermines classical validation and access control. The paper's goal is to define a governed MCP-based "Semantic Gateway" that sits between the stochastic agent and the deterministic backend, and to show that agent behavior can be formally abstracted, fuzzed, and audited.

## Key Contributions

1. **A Semantic Gateway architecture.** A stateful MCP-governed layer with an Intent Intake Layer, a Semantic Normalizer/Vectorizer, a pre-inference Semantic Firewall, an Embedding Router and Tool Registry, a Chain-of-Thought Planner, a Policy Enforcement Point, a Cryptographic Human-in-the-Loop gate, and a hash-chained Audit Ledger — reframing the enterprise API as a semantic surface rather than a REST topology.
2. **A three-layer Zero-Trust model.** Layer 1 is a pre-inference Semantic Firewall (context isolation, taint-aware memory); Layer 2 is deterministic tool-level RBAC with BOLA ownership checks enforced through Open Policy Agent/Rego; Layer 3 is out-of-band cryptographic HITL approval modelled on the IETF CHEQ and ACAP drafts.
3. **Importing smart-contract verification into agent security.** The agent is modeled as a POMDP, and Enabledness-Preserving Abstractions (EPAs) — previously used for immutable blockchain contracts — are adapted so that the agent's tool-permission state space is quotiented into finite equivalence classes (abstract states defined as subsets of the tool set), plus a greybox semantic fuzzer with reduction heuristics (Reduce_True, Reduce_Equal, Unreachable State Pruning).
4. **A reproducible open-source proof-of-concept.** A Python implementation with 47 automated tests (all passing), an OPA-inspired pure-Python RBAC evaluator, a SHA-256 hash-chained SQLite audit ledger, a NetworkX EPA graph, and a deterministic fuzzer demo (seed = 42) that discovers and then eliminates a BOLA vulnerability.

## Main Findings

- **Incidental code reduction of 84.2%.** Adding a new functional sub-domain took 920 lines of code in the REST baseline versus 145 lines in the Semantic Gateway, and time-to-market fell from 16 working days to 3 working days (Table 3 reports this as a 5.3× acceleration).
- **100% discovery rate of hidden unauthorized state transitions.** Across 500,000 multi-turn fuzzing sequences, the methodology found a silent permission-overwrite flaw: the `AcceptSharingRequest()` tool could be executed on a document already in the `SharingWithThirdParty` abstract state, a self-loop on that state that the fixed EPA removes.
- **The BOLA bug was found fast.** In the PoC, the fuzzer hit the invariant violation in 52 iterations out of a possible 500; across 100 random seeds the median was 52 iterations (min 12, max 143), which the paper attributes to the guided mutation strategy (80% valid-tool selection, 20% adversarial).
- **The fix was verifiably sufficient.** After the Rego policy correction (`EPAGraph(buggy=False)`), 500 iterations per seed produced zero violations, and the observed graph reached 100% correspondence with the theoretical design graph.
- **Layered defense compounded.** Under the Swiss Cheese threat equation P_breach = ε1 × ε2 × ε3, Layer 1 (Semantic Firewall) purged 99.4% of pre-inference prompt injections and tainted-context attempts, giving ε1 = 0.006; Layer 2 intercepted 100% of the malicious requests that bypassed Layer 1, producing 0% real-state compromise and driving ε2 → 0; Layer 3 blocked execution until out-of-band cryptographic verification completed.
- **Caching beat transformer inference.** A Cognitive Cache with a cosine similarity threshold of δ = 0.97 let repeated or near-identical intents bypass the transformer entirely and dispatch with sub-millisecond latency.
- **Long-tail state-space scaling is a real limit.** When the MCP registry exceeded 200 highly interconnected, cross-dependent tools, the fuzzer often hit its standard two-hour timeout before resolving the full transition graph — consistent with the O(2^|T|) growth of the abstract state space.
- **Test suite reproducibility.** The 47-test PoC suite runs in under 2 seconds on commodity hardware with no external API dependency; the semantic router uses TF-IDF with cosine similarity instead of dense embeddings, and the Claude planner has a deterministic mock fallback.

## Methodology in Plain English

The authors first specify an architecture: an incoming natural-language intent is embedded into a vector, matched against tool descriptions by cosine similarity, and filtered down to a subset of tools that fits a token budget — framed formally as a knapsack-style optimization. Only after that does the main LLM plan a multi-step tool sequence. The plan is treated as a suggestion: an external policy engine (OPA/Rego) checks the action, resource, and parameters deterministically, and irreversible actions are suspended for out-of-band human signature.

To test this, they treat the agent's world as a partially observable Markov decision process and abstract the enterprise state by *which set of tools are currently enabled for the agent*. Every concrete state that permits the same tool set collapses into one abstract state, so a theoretically infinite state space becomes a finite graph. They then adapt greybox fuzzing, as used against Ethereum contracts with Echidna, to write invariant tests of the form "starting in state A, executing tool K with these parameters must not reach state B," and run hundreds of thousands of mutated intents and adversarial parameter sequences to try to falsify those assertions. Heuristics prune the search: read-only tools are abstracted away, tools sharing identical policy claims are merged, and formally unreachable branches are cut before fuzzing.

The empirical setup compared the gateway against an equivalent REST baseline: 200 tools/endpoints (120 read-only, 60 write, 20 critical), three hierarchical roles (Financial Analyst, Risk Manager, Compliance Auditor), a 10,000-intent base corpus, up to a 500,000-sequence test limit, NVIDIA A100 GPUs, a DeBERTa-v3 firewall micro-model, Llama-3-8B and GPT-4o as planners, and temperature θ = 0.4.

## Why This Matters

**Impact on research.** The paper makes a methodological move rather than just an engineering one: it shows that verification techniques from smart-contract security transfer to agentic systems once you define the right abstraction. If agent behavior can be reduced to an EPA graph, AI security shifts from heuristic monitoring to something closer to a proof obligation — a framing the paper explicitly contrasts with what OWASP's LLM Top 10 and the NIST AI RMF currently provide (guidance, but no runtime formal method).

**Real-world applications:**

- Financial document management and risk reporting, the exact scenario evaluated, where BOLA-style cross-department access and irreversible share operations are the main risk.
- Regulated enterprise back-office workflows (compliance, audit, HR record changes) that need an immutable, hash-chained trace of intent → plan → policy decision → parameters → state mutation.
- Any MCP-based tool ecosystem where a model must discover capabilities at runtime without being handed hundreds of OpenAPI endpoints in its context window.
- High-stakes or irreversible operations (payments, deletions, external data sharing) that need cryptographic human approval without blocking the whole agent loop.

**Industry relevance.** The 920 → 145 line-of-code result is a concrete argument that applying REST/CRUD patterns to agent integration is structurally wasteful, and that declarative tool schemas plus policy-as-code are cheaper to extend. The flip side is the paper's own warning: with a 0.6% firewall failure rate, models *will* be compromised, so the deterministic policy barrier is load-bearing — unmediated REST access would have meant a breach in their scenario.

## Future Directions

- **Taming state-space explosion.** The O(2^|T|) blowup caused the fuzzer to hit its two-hour timeout once the registry exceeded 200 interconnected tools; better pruning, compositional abstraction, or distributed fuzzing is needed before the method scales to large enterprise tool catalogs.
- **Fuzzing under strict cryptographic preconditions.** Randomized mutation struggles to satisfy exact hash collisions or synchronized timestamp matches in OPA rules, which can hide deeper branches; constraint-guided or solver-assisted mutation is an obvious next step.
- **Domain generalization.** All experiments were confined to a simulated financial document management system; transfer to real-time and ultra-high-frequency domains is left open (the paper's external-validity discussion is where the provided text ends).
- **Closing the gap between PoC and production.** The PoC substitutes TF-IDF for dense embeddings, uses a pure-Python RBAC evaluator instead of real OPA, and SQLite instead of EventStoreDB or PostgreSQL — validating those substitutions under load is unresolved.

## Target Audience

Security architects and platform engineers designing agentic enterprise integrations; applied researchers in AI safety and formal methods looking for a transferable verification technique; and engineering leaders evaluating MCP-based tool exposure versus traditional REST APIs. Readers without background in state-machine abstraction or policy-as-code will follow the motivation and results but should expect the formal model section to require effort.

## Authors’ abstract

Enterprise software engineering is shifting away from deterministic CRUD/REST architectures toward AI-native systems where large language models act as cognitive orchestrators. This transition introduces a critical security tension: probabilistic LLMs weaken classical mechanisms for validation, access control, and formal testing. This paper proposes the design, formal validation, and empirical evaluation of a Semantic Gateway governed by the Model Context Protocol (MCP). The…

[The full abstract on arXiv](https://arxiv.org/abs/2604.25555)

[Read the original paper](https://arxiv.org/abs/2604.25555)

---

Canonical: https://crypto.world/paper/from-crud-to-autonomous-agents-formal-validation-and-zero-trust-2604.25555
