Skip to content

feat(blueprints): AI agent input firewall against prompt injection - #4353

Merged
MartinRst merged 3 commits into
kestra-io:mainfrom
Varshith-Kali:blueprint/ai-agent-input-injection-firewall
Oct 20, 2026
Merged

MartinRst merged 3 commits into
kestra-io:mainfrom
Varshith-Kali:blueprint/ai-agent-input-injection-firewall

Conversation

@Varshith-Kali

Copy link
Copy Markdown
Contributor

What this is

A firewall blueprint that screens every inbound prompt to AI agents for prompt-injection attacks before the model ever sees it. It completes the agent-security triad in the gallery: agent-tool-call-audit watches tool calls, ai-agent-output-secrets-pii-gate watches what the model said, and this one watches what goes in.

How it works

  • Keyed webhook (on_agent_input) receives each inbound prompt from the agent gateway before model invocation, plus a disabled daily schedule that replays a recorded fixture as a fallback.
  • Python detection engine (scan_inputs) flags four attack families: instruction overrides ("ignore all previous instructions"), prompt-extraction probes ("reveal your system prompt"), role-play jailbreaks ("you are now DAN"), and delimiter smuggling ([SYSTEM], <<SYS>>).
  • Gemini judge (judge_finding, concurrency-capped at 3) verdicts each finding as attack/benign so coincidental wording never triggers a quarantine.
  • Parallel escalation: confirmed attacks are quarantined to inputs.quarantined.jsonl (never sent to the model), a labeled GitHub issue is opened, and Slack is paged. Clean prompts are recorded as passed for the audit trail.

Verification

The full Python chain was run end-to-end against the seeded fixture: 5 prompts in, 5 findings across all four attack kinds on the 3 malicious inputs (2 critical, 2 high, 1 medium), 3 prompts quarantined with reasons attached, and zero findings on the benign inputs. YAML validated (id matches filename, all 9 extend fields, metaDescription within limits). All plugin types are ones already used by merged blueprints. A live Kestra run was not possible in this environment (no Docker/credentials), which the fixture verification covers.

Checklist

  • Minimum 3 runnable tasks (7 tasks)
  • At least 1 flowable task (If, Loop, Parallel)
  • At least 1 trigger (Webhook + disabled Schedule)
  • At least 1 non-core plugin (github, slack, gemini)
  • Run at least once (fixture run above)
  • One PR per blueprint, file under flows/, extend block present

Gate every completed AI agent run's outputs for leaked secrets and PII:
keyed webhook trigger, Python detection engine (secret patterns, PII,
Luhn-checked cards, entropy sweep), Gemini LLM-judged triage, parallel
redaction + GitHub issue + Slack alert. Includes disabled schedule replay
of the built-in fixture.

Signed-off-by: Varshith Puli <pulivarshit@gmail.com>
Signed-off-by: Varshith Puli <pulivarshit@gmail.com>
Firewall every inbound prompt before the model sees it: a Python
detection engine flags instruction overrides, prompt-extraction
probes, role-play jailbreaks and delimiter smuggling, borderline
hits are judged by Gemini, confirmed attacks are quarantined and
escalated to GitHub and Slack. Completes the agent security triad
alongside the tool-call audit and output safety gate blueprints.
@github-project-automation github-project-automation Bot moved this to To review in Pull Requests Oct 19, 2026
@MartinRst
MartinRst merged commit 65f8e2a into kestra-io:main Oct 20, 2026
@github-project-automation github-project-automation Bot moved this from To review to Done in Pull Requests Oct 20, 2026
@MilosPaunovic MilosPaunovic added the kind/external Pull requests raised by community contributors label Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/external Pull requests raised by community contributors

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants