Skip to content

feat(security): pre-action content firewall — wire prompt-injection defense over MCP/web/RAG/tool-output #10552

Description

@mrveiss

Pre-action content firewall — wire prompt-injection defense over untrusted inputs

Part of umbrella #10542 · Theme A (collaboration core) · security — highest-risk gap

Problem

A PromptInjectionDetector exists but only guards context files. It is not wired into the agent's untrusted-input paths — MCP tool output, web-fetched content, RAG-retrieved documents, file reads, command stdout. An agent that executes commands in a Docker sandbox and ingests external content is exactly the threat model for indirect prompt injection (a malicious web page / repo / doc telling the agent to exfiltrate secrets or run destructive commands). Today there's no firewall on that boundary.

What exists today

  • security/prompt_injection_detector.py — PromptInjectionDetector / InjectionRisk (detects "ignore previous instructions" etc.) — scoped to context files (tests/test_injection_detection.py).
  • services/tool_output_filter.py — formatting cleaner (truncate/dedup/ansi), not a security boundary.
  • a2a/trust_score.py — trust scoring primitive.
  • web_fetch/extractors.py — where web content enters.
  • Memory note: "prompt-injection in tool output — ignore + flag once" is currently a manual discipline, not enforced.

What to build

  • A content firewall that runs PromptInjectionDetector (+ data/instruction separation) over every untrusted input before it reaches the model: MCP tool results, web fetch, RAG documents, file reads, command stdout.
  • Policy on detection: strip / quarantine / require human approval based on InjectionRisk, surfaced in the trajectory and to the human.
  • Mark provenance of untrusted spans so the model treats them as data, not instructions (delimiting + system reminder).
  • Wire at the choke points (parallel executor, MCP client, RAG response builder, web_fetch) — one shared filter, not per-site copies.

Acceptance criteria

  • Untrusted tool/web/RAG content passes through the detector before reaching the model (test: a seeded "ignore previous instructions" payload in a tool result is quarantined/flagged).
  • High-risk detections block or escalate to human approval; recorded in the trajectory.
  • One shared firewall reused across executor / MCP client / RAG / web_fetch — no duplicated logic.
  • No regression on benign content (false-positive budget tested).

Entry points

autobot-backend/security/prompt_injection_detector.py · autobot-backend/tools/parallel/executor.py · autobot-backend/skills/sync/mcp_client.py · autobot-backend/knowledge/search_components/response_builder.py · autobot-backend/web_fetch/extractors.py · autobot-backend/agent_loop/approval_workflow.py.

Activity

  1. github-actions commented on Jun 30, 2026

    @github-actions
    Contributor

    PR #10758 (merged to Dev_new_gui) references this issue with a close keyword.

    feat(security): pre-action content firewall over MCP/web/RAG/file/stdout untrusted inputs (#10552)

    If this issue is fully resolved, close it manually. If work remains, no action is needed.

  2. mrveiss commented on Jul 2, 2026

    @mrveiss
    OwnerAuthor

    Merged to Dev_new_gui (05477ff, PR #10758). Shared security/content_firewall.py runs the existing PromptInjectionDetector over every untrusted input (parallel executor stdout/file, MCP call_tool + read_resource, web_fetch, RAG context assembly); env-tunable QUARANTINE/BLOCK/ESCALATE policy; untrusted spans delimited as DATA; high-risk recorded in trajectory. 12 tests pass. Agent-framework epic #10542. Batch #10440.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions