Skip to content
Draft
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
10 changes: 9 additions & 1 deletion 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. Other `ContextProvider`
implementations remain trusted plugins; provider-injected messages require an explicit provider/application trust
boundary until a first-class provider-message labeling contract is defined.

**🚀 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 @@ -363,4 +367,8 @@ cd python/packages/core && ../../.venv/bin/pytest tests/test_security.py -v
- **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. History-provider messages reconstruct missing state, while restored state remains
authoritative for unstamped stored history; trusted non-history context providers remain responsible for the data they
inject.
18 changes: 18 additions & 0 deletions python/packages/core/agent_framework/_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -1841,6 +1841,24 @@ async def _prepare_session_and_messages(
state=provider_session.state.setdefault(provider.source_id, {}),
)

approval_history_consumers = [
(provider, prepare)
for provider in self.context_providers
if callable(prepare := getattr(provider, "_prepare_approval_history", None))
]
if approval_history_consumers and not per_service_call_history_required:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When per-service-call persistence loads local history, this skips the only post-provider reconstruction hook. The FIDES chat middleware runs before PerServiceCallHistoryPersistingMiddleware and marks itself processed before that loader replaces context.messages, so unstamped assistant/tool history reaches the model while the scope remains trusted and protected tool calls can execute. Ensure local history is classified after the per-service loader and before downstream model/tool execution.

if provider_session is None:
raise RuntimeError("Provider session must be available when approval history is prepared.")
for provider, prepare in approval_history_consumers:
prepared = prepare(
agent=self,
session=provider_session,
context=session_context,
state=provider_session.state.setdefault(provider.source_id, {}),
)
if isawaitable(prepared):
_ = await prepared

Comment on lines +1852 to +1861
# Merge provider-contributed tools into chat_options
if session_context.tools:
if chat_options.get("tools") is not None:
Expand Down
Loading
Loading