mirror of
https://github.com/openclaw/trust.git
synced 2026-07-25 20:25:49 -04:00
[Mitigation] Content provenance taint graph for prompt injection defense #2
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @zeroaltitude on GitHub (Feb 8, 2026).
Proposal
A content provenance tracking system ("taint graph") that traces the origin and trust level of every piece of content flowing through an agent turn. Instead of relying solely on XML markers (
<<<EXTERNAL_UNTRUSTED_CONTENT>>>) that can be escaped or stripped, this approach tracks data flow structurally through a directed acyclic graph (DAG) and enforces policies based on content lineage.As a side benefit, being able to track and visualize the interactions in the graph increases auditability and visibility.
The Problem It Solves
OpenClaw currently wraps external content with XML markers and a security notice. This is a good first step, but has structural limitations:
How It Works
Trust Taxonomy (6 levels)
systemownerlocalsharedexternaluntrustedCreating a scheme for classifying these is in-scope (e.g. current exploration: use a trained classifier to give a score and confidence interval).
Per-Turn Provenance DAG
Each agent turn builds a directed graph tracking how content flows:
When the agent tries to call
execafter processingweb_fetchresults, the graph shows the turn is tainted byexternalcontent. A policy engine can then block, restrict, or require confirmation.Policy Engine
Declarative policies that reference taint levels:
Four policy modes:
allow,deny,restrict(limit tool arguments),confirm(block until user approves per-session).Threats Addressed
This mitigation directly addresses or significantly reduces risk for 8 threats in the current model, and partially addresses 4 more:
Directly Addresses
external; taint propagates through the turn DAGuntrustedtrust level automaticallyPartially Addresses
before_response_emithook could detect system prompt content in responses on tainted turnsImplementation Approach
This could be implemented as a plugin using OpenClaw's existing hook system, with a few additional hooks:
Existing hooks used:
before_tool_call(policy enforcement),after_tool_call(taint propagation from tool results),message_received(initial trust classification),message_sending(outbound gate)New hooks needed:
before_llm_call— full context visible, can see all sources feeding into the callafter_llm_call— filter/block tool calls before execution based on taintcontext_assembled— source census before LLM callbefore_response_emit— final gate on outbound responsesWe've built a proof-of-concept plugin implementing this approach. Happy to share the code or collaborate on upstreaming the hook extensions needed.
Why Plugin-Based
A plugin approach as a first implementation makes sense because it allows us to experiment with ideas and test them empirically before we make them part of the main code -- and making best-of-breed security ideas part of the main code is the ultimate goal.
For early investigation:
Related