Python: isolate FIDES security state per session - #8138
Conversation
Code Coverage OverviewLanguages: Python Python / code-coverage/pythonThe overall line coverage in commit 124779d in the Show a line coverage summary of the most covered files.
Updated |
There was a problem hiding this comment.
🔵 Needs a closer look
Security-critical state ownership, persistence, and approval replay behavior warrant final human validation.
Pull request overview
Moves FIDES security state into AgentSession to isolate conversations while supporting restoration and standalone middleware use.
Changes:
- Adds session-backed labels, variables, audit logs, and approvals.
- Uses task-local middleware and durable state serialization.
- Updates tests, documentation, and samples for explicit sessions.
File summaries
| File | Description |
|---|---|
python/packages/core/agent_framework/security.py |
Implements session-scoped FIDES state. |
python/packages/core/tests/test_security.py |
Tests isolation, restoration, concurrency, and serialization. |
python/samples/02-agents/security/repo_confidentiality_example.py |
Uses an explicit session for auditing. |
python/samples/02-agents/security/email_security_example.py |
Reads the session-specific audit log. |
python/samples/02-agents/security/FIDES_DEVELOPER_GUIDE.md |
Documents session-scoped state APIs. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: Findings reported
Scope: full PR (2 commit(s)): e912fce745d4, 53e1ce19f123
Model: gpt-5.6-sol-fast
Overview
The PR moves cumulative labels, hidden variables, audit records, and policy approvals into session-owned state, with strong owner checks, opaque JSON encoding, occurrence-aware approval binding, and explicit A/B/A restoration tests. The remaining risks are lifecycle gaps where session state is replaced or implicitly generated, unreclaimed terminal approvals, and compatibility failures for values that the previous standalone store or the framework's public Content contract permits.
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
5 verified findings remained after source verification (5 medium) across 1 file. Details are attached to the affected lines below.
Affected areas: python/packages/core/agent_framework/security.py
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
53e1ce1 to
124779d
Compare
Motivation & Context
FIDES middleware currently stores cumulative labels, hidden variables, audit records, and pending policy approvals on reusable middleware instances. Hosts that share one agent across conversations can therefore leak security state between sessions. This layer moves FIDES state into the owning
AgentSessionboundary while preserving standalone middleware behavior.Description & Review Guide
Related Issue
Part of #7455. This is the bottom layer of a four-PR FIDES hardening stack.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and the title prefix in sync automatically.