{
  "id": 22206161,
  "title": "Let the model propose, let code decide: a tiny action gate for prompt-injection-prone AI workflows",
  "url": "https://urgent.news/2026/11/27/let-the-model-propose-let-code-decide-a-tiny-action-gate-for-prompt",
  "topic": "ai",
  "section": "AI",
  "published": "2026-11-27T18:20:36.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/callkarma/let-the-model-propose-let-code-decide-a-tiny-action-gate-for-prompt-injection-prone-ai-workflows-422m"
  },
  "original_language": "en",
  "account": "This tutorial describes a method to prevent prompt injection attacks on LLM applications. Prompt injection occurs when an attacker manipulates the input to an AI system, causing it to perform unintended actions. The author emphasizes that while there may not be foolproof prevention methods, the goal is to minimize the impact of such attacks.\n\nThe tutorial presents a Python action gate implementation, a deterministic component that sits between an LLM's proposed actions and actual systems. The gate ensures that once untrusted content is present in the model's context, it cannot trigger consequential actions on its own. Instead, consequential actions are queued for human approval, and any attempt to send data outside an allowlist is refused.\n\nThe author defines a set of allowed actions, each associated with a boolean value indicating whether it can send output outside the system and whether it is consequential. Additionally, a list of allowed domains is provided for URL and email-related actions. If any domain in the proposal's context is not in this list, the action is refused.\n\nThe gate function takes a proposal and a boolean flag indicating whether the context contains untrusted content. It checks if the action is allowed and if any domains in the proposal are outside the allowlist. Based on these checks, the gate decides whether to run the action, send it to a human for review, or refuse it altogether. The decision is returned as a JSON object with the chosen action, verdict, reason, and any relevant arguments.",
  "summary": "If your app feeds customer emails, tickets, web pages or files to an LLM and then does something with the output, you have a prompt-injection problem whether or not you've seen an attack yet. OWASP lists prompt injection as LLM01 in its 2025 Top 10 for LLM applications and says it is \"unclear if there are fool-proof methods of prevention.\" The UK NCSC argued in December 2025 that it isn't…",
  "summary_source": "publisher",
  "key_points": [
    "Python action gate implementation prevents prompt injection in LLM applications",
    "Gate ensures untrusted content cannot trigger consequential actions independently",
    "Gate queues consequential actions for human approval and blocks external data sends"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}