Back to KB
Difficulty
Intermediate
Read Time
8 min

Arcjet for AI Agents: Securing the Attack Surface Inside LLM Apps

By Codcompass Team··8 min read

Closing the Agentic Action Gap: In-Process Security for LLM Tool Execution

Current Situation Analysis

The security model for traditional web applications relies on a perimeter defense. A Web Application Firewall (WAF) sits at the network edge, inspecting incoming HTTP requests for malicious payloads, blocking known-bad IPs, and rate-limiting abusive clients. This model assumes the attack surface is static and external: the danger enters via a request, and if the WAF lets it pass, the application processes it.

Large Language Model (LLM) agents shatter this assumption. When you deploy an agent equipped with tools—filesystem access, HTTP clients, database connectors—the application's behavior becomes dynamic and autonomous. The initial user request may be entirely benign, but the agent's internal reasoning loop can generate dangerous actions several steps later. The agent decides at runtime which tools to invoke and with what arguments, often based on untrusted data ingested from external sources.

This creates a structural blind spot. Edge WAFs inspect traffic crossing the network boundary once. They cannot see actions that occur in memory after the request is accepted. Furthermore, agents typically execute with the credentials of the service account or user who initiated the session. This triggers the confused deputy problem: an attacker does not need to breach your infrastructure; they only need to influence the agent's instructions to borrow its authority. The agent becomes a deputy acting on behalf of the attacker, using your own keys to read sensitive files, query internal databases, or fetch restricted resources.

Relying solely on edge security leaves agentic applications exposed to runtime exploitation. The industry is currently underestimating the risk of in-process tool execution, treating agent autonomy as a feature without implementing corresponding deterministic controls at the action boundary.

WOW Moment: Key Findings

The shift from perimeter-based to in-process security fundamentally changes how you measure and mitigate risk in LLM applications. The following comparison highlights why edge-only strategies fail against agentic workflows and what in-process guards enable.

DimensionEdge WAF StrategyIn-Process Agent Guard
Inspection PointNetwork boundary (HTTP ingress)Tool execution boundary (runtime memory)
VisibilityRequest headers and initial payloadRuntime context, tool arguments, and output
Attack CoverageExternal injection, DDoS, bot trafficPrompt injection, SSRF, confused deputy, exfiltration
Latency ImpactNetwork hop overheadIn-memory function call overhead
Credential RiskDoes not mitigate credential misusePrevents unauthorized use of service credentials
ImplementationInfrastructure configurationCode-level integration (SDK)

Why this matters: The data shows that edge WAFs and in-process guards address orthogonal threat models. An edge WAF cannot detect an agent reading /etc/shadow or fetching 169.254.169.254 because these actions never generate network traffic that crosses the perimeter. In-process guards provide visibility into the agent's decision-making process, allowing you to enforce security policies deterministically before a tool executes. This enables defense-in-depth where the guard acts as a backstop for the agent's autonomy.

Core Solution

Implementing in-process security requires wrapping tool execution with deterministic checks. The goal is to intercept the agent's action before it occurs, validate the request against security policies, and only proceed if the action is safe. Arcjet provides an in-process SDK that can be integrated directly into your application code to enforce these checks.

Archit

🎉 Mid-Year Sale — Unlock Full Article

Base plan from just $4.99/mo or $49/yr

Sign in to read the full article and unlock all 635+ tutorials.

Sign In / Register — Start Free Trial

7-day free trial · Cancel anytime · 30-day money-back