Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions docs/features/FIDES_IMPLEMENTATION_SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

**FIDES** is a comprehensive deterministic prompt injection defense system for the agent framework. The implementation provides label-based security mechanisms to defend against prompt injection attacks by tracking integrity and confidentiality of content throughout agent execution.

FIDES enforces tool-result, hidden-variable, caller-replayed, and history-provider flows. Applications can use
`SecureAgentConfig.message_labeler` as the authoritative trust boundary for messages added by earlier
`ContextProvider` implementations.

**🚀 Key Features:**
- **Context Provider Pattern** - `SecureAgentConfig` extends `ContextProvider`, injecting tools, instructions, and middleware automatically
- **Automatic Variable Hiding** - UNTRUSTED content is automatically hidden without requiring manual intervention
Expand Down Expand Up @@ -355,12 +359,18 @@ cd python/packages/core && ../../.venv/bin/pytest tests/test_security.py -v

**FIDES** provides a comprehensive, deterministic defense against prompt injection attacks with:

- **Zero-effort protection**: Automatic variable hiding for developers
- **Automatic result protection**: FIDES-labeled untrusted tool output is hidden automatically
- **Context provider pattern**: `SecureAgentConfig` extends `ContextProvider` for automatic setup
- **Granular control**: Per-item embedded labels via `Content.from_text()` for mixed-trust data
- **Easy configuration**: `SecureAgentConfig` for one-line setup
- **Data safety**: Exfiltration prevention via confidentiality gates
- **Full traceability**: Message-level label tracking
- **Complete auditability**: All security events logged

The system ensures that untrusted content never directly reaches the LLM context and that all tool calls are policy-checked based on the cumulative security state before execution.
The system hides FIDES-labeled untrusted tool output from the LLM context and policy-checks tool calls against the
cumulative security state before execution. Newly supplied assistant/tool messages are conservatively labeled even
when state was restored. Stored provider history is reconstructed conservatively whenever it is loaded; FIDES does not
infer trust through transcript persistence, deduplication, compaction, or merging. Applications may instead configure
`SecureAgentConfig.message_labeler` to authoritatively classify messages added by context providers registered before
it, without mutating or stamping those messages.
Per-service-call history that is unavailable at run setup is treated as **UNTRUSTED + PRIVATE**.
15 changes: 10 additions & 5 deletions python/packages/ag-ui/tests/ag_ui/test_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -7358,10 +7358,10 @@ async def test_endpoint_fides_replacement_rotates_lifecycle_generation(
assert executed == ["guarded"]


async def test_endpoint_fides_approval_uses_lifecycle_bound_request_generation(
async def test_endpoint_fides_approval_without_replay_provenance_fails_closed(
streaming_chat_client_stub: Any,
) -> None:
"""AG-UI preserves trusted request generation while rebinding to occurrence identity."""
"""AG-UI snapshot replay requires explicit provenance before FIDES can reuse one approval."""
client, snapshot_store, security, executed, wrapped_agent = _build_fides_policy_approval_endpoint(
streaming_chat_client_stub
)
Expand Down Expand Up @@ -7389,11 +7389,16 @@ async def test_endpoint_fides_approval_uses_lifecycle_bound_request_generation(

assert approved.status_code == 200
results = [event for event in _decode_sse_events(approved) if event.get("type") == "TOOL_CALL_RESULT"]
assert [(event["toolCallId"], event["content"]) for event in results] == [("call-guarded", "guarded result")]
assert executed == ["guarded"]
assert results == []
assert executed == []
finished = [event for event in _decode_sse_events(approved) if event.get("type") == "RUN_FINISHED"]
replacement_interrupts = _run_finished_interrupts(finished[-1])
assert len(replacement_interrupts) == 1
assert replacement_interrupts[0]["id"] != approval_id
assert replacement_interrupts[0]["toolCallId"] == "call-guarded"
snapshot = await snapshot_store.get(scope="tenant-a", thread_id=thread_id)
assert snapshot is not None and snapshot.session_state is not None
assert snapshot.session_state[security.source_id]["pending_policy_approvals"] == {}
assert snapshot.session_state[security.source_id]["pending_policy_approvals"]


async def test_endpoint_agent_approval_resume_persists_replayable_tool_results(streaming_chat_client_stub):
Expand Down
Loading
Loading