Prompt injection remains the most formidable security challenge for LLM-integrated applications, a reality underscored by its ranking as LLM01 in the OWASP 2025 Top 10 for LLM applications. The UK NCSC has argued that prompt injection is not analogous to SQL injection because, inside the model, "there is only ever 'next token,'" making parameterized query equivalents impossible. The Call Karma team has released a pragmatic solution that bypasses the futile attempt to detect every injection vector, instead enforcing a deterministic boundary between model proposals and system execution. Their approach, detailed in a recent DEV.to tutorial, assumes the model will occasionally be fooled and designs the infrastructure to render those failures harmless.

The Lethal Trifecta and the Action Gate

The core philosophy, derived from Beurer-Kellner et al. (2025), posits that once an LLM ingests untrusted input, it must be constrained so that input cannot trigger consequential actions. The proposed solution is a ~100-line Python action gate that prevents the model from calling tools directly. Instead, the model returns JSON proposals which are then evaluated against a strict policy defined in code. This separation ensures that business logic and security constraints live in the application layer, not in the fragile prompt.

Deterministic Policy Enforcement

The gate operates on three primary checks: allowlisting actions, scanning for exfiltration channels, and enforcing human review for consequential tasks. Unknown actions are immediately refused, preventing the model from hallucinating new tools. Crucially, the system scans all proposals for URLs or email domains outside a predefined allowlist, a defense against data exfiltration via markdown images or links. Any consequential action proposed after untrusted content has entered the context is routed to a human queue, ensuring that a compromised model cannot autonomously issue refunds or change customer emails.

Limitations and Implementation Nuances

While effective, the authors acknowledge significant limitations. The gate does not prevent the model from generating misleading summaries or poor drafts, which still require standard review. Domain allowlisting is coarse, potentially blocking legitimate subdomains or missing obfuscated attacks that require output normalization. Furthermore, the system relies on the application correctly setting the context_has_untrusted flag, a responsibility that lies with the developer pipeline rather than the model itself.

Key Takeaways

  • The OWASP 2025 Top 10 identifies prompt injection as LLM01, noting a lack of fool-proof prevention methods.
  • The action gate pattern shifts control from the LLM to deterministic code, refusing unknown actions and non-allowlisted domains.
  • Consequential actions triggered by untrusted content are forced into human review queues to prevent autonomous errors.
  • The solution is a pragmatic first step, not a complete replacement for advanced patterns like dual-LLM architectures.

The Bottom Line

Stop trying to outsmart the model with clever prompts and start treating it as an untrusted input source. This gate proves that deterministic code boundaries are the only reliable defense against the lethal trifecta of autonomous agents.