This document details the architectural internals, threat model, and zero-trust security boundaries of the ModueAgent framework.
ModueAgent is designed to operate in environments where LLM inputs are adversarial and untrusted.
- Indirect Prompt Injection (IPI):
- Malicious payloads injected into external data (web scrapers, third-party databases, user uploads).
- Defense: Strict tool whitelisting (
allowed_tools), fine-grained JIT capabilities, andEffectClass.DESTRUCTIVEverification traps.
- Confused Deputy Problem:
- The LLM holds legitimate authority on behalf of the user, but acts on attacker instructions.
- Defense: Separation of Transport (L1) and Resource (L2) scopes; attenuation upon delegation.
- Information Disclosure & Credential Harvesting:
- Raw tool outputs containing secrets (API keys, environment variables, internal IPs) leaking into prompts.
- Defense: XOA execute-only output filtering via
extract_safewith immediate in-memory dropping of raw payloads.
- Arbitrary Code Execution (RCE):
- Unsandboxed evaluation of expressions or command shells.
- Defense: AST node whitelist (
safe_eval_arithmetic); noeval(),exec(), or raw shell built-ins.
- Denial-of-Wallet (DoW) & Resource Starvation:
- Poisoned loops draining API credits.
- Defense: Hard budget execution ceilings (
max_steps,max_tokens) with partial synthesis fallbacks.
+-------------------------------------------------------------------------+
| Cognition (Untrusted Space) |
| |
| [User Prompt] ──> [Conversation History] ──> [LLM Provider / Planner] |
+------------------------------------+------------------------------------+
| ToolCallRequest
v
+------------------------------------+------------------------------------+
| Security & Capability Kernel (Trusted Space) |
| |
| 1. Input Schema Validation (_validate_tool_arguments) |
| 2. Agent Tool Whitelist Filter (allowed_tools) |
| 3. JIT Ephemeral Capability Issuance (CapabilityEngine) |
| 4. Verification Trap (Verification Callback / Independent Trap) |
+------------------------------------+------------------------------------+
| Sandboxed Invocation
v
+------------------------------------+------------------------------------+
| Execution Sandbox (Isolated Space) |
| |
| [Tool Function] ──> [Raw Output] ──> [XOA extract_safe] ──> [Filtered] |
| │ |
| └──> (Raw output destroyed) |
+-------------------------------------------------------------------------+
- Implements an Object Capability (OCap) model.
- Every token is an immutable
@dataclass(frozen=True). - Token scope is partitioned into
TRANSPORT(channel access) andRESOURCE(execution). - Wildcard
tool:*grants are strictly rejected (Anti-Wildcard Invariant).
safe_eval_arithmetic: Parses expressions using Python'sastmodule and visits only whitelisted binary/unary operators and constants.extract_safe: Traverses dictionary keys and array indices using a recursive parser without executing code.mask_error: Sanitizes internal stack traces and absolute filesystem paths.
- Orchestrates the ReAct execution loop.
- Provisions JIT tokens per tool call and revokes them immediately after execution.
- If an agent exceeds
max_stepsormax_tokens, it hard-stops and produces a safe partial answer via_synthesize_partial_answer.