Skip to content

Python: Harden FIDES replay and approval authority - #9876

Merged
Eduard van Valkenburg (eavanvalkenburg) merged 17 commits into
mainfrom
fides-replay-approval-authority
Nov 11, 2026
Merged

Eduard van Valkenburg (eavanvalkenburg) merged 17 commits into
mainfrom
fides-replay-approval-authority

Conversation

@eavanvalkenburg

@eavanvalkenburg Eduard van Valkenburg (eavanvalkenburg) commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Motivation & Context

FIDES security state must remain conservative when callers or history providers replay assistant, tool, function-result,
and approval content. Unstamped replay data, modified hidden placeholders, or caller-forged approval controls must not
inherit trust or execution authority from IDs alone.

Applications also need an explicit way to classify data added by their own context providers without adding
FIDES-specific stamping logic to those providers. This PR keeps that authority inside SecureAgentConfig and preserves
conservative behavior for data the application has not classified.

Description & Review Guide

  • What are the major changes? Replay classifies unstamped assistant/tool content and data-bearing function results
    conservatively, authenticates exact session-owned hidden placeholders, and binds FIDES and ordinary approvals to
    canonical stored call bodies, exact live controls, and pending session snapshots. SecureAgentConfig accepts an
    optional synchronous message_labeler(source_id, message) callback. FIDES uses the authoritative
    SessionContext.context_messages bucket as source_id, applies the returned ContentLabel at fold points, caches it
    for the exact message object during the run, and does not mutate or stamp provider messages. SecureAgentConfig
    must follow non-history providers whose messages it classifies; explicit history providers should also precede it
    when they need application-owned labels. Ordinary history loaded later is reconstructed conservatively before tool
    policy executes. Per-service-call history that is unavailable at run setup fails closed as
    UNTRUSTED + PRIVATE.
  • What is the impact of these changes? Replayed or forged content fails closed, replacement and occurrence-only
    approvals remain usable, and applications can classify their own provider data as trusted, untrusted, public,
    private, or identity-scoped. The simplification removes the provider-authority class, two one-use middleware classes,
    message stamping, and no-op replay middleware. It adds no ContextProvider lifecycle API. The new parameter is
    optional and experimental; this is not a breaking change.
  • What do you want reviewers to focus on? Please review the distinction between application-owned message-label
    authority and untrusted serialized labels, the use of authoritative provider buckets rather than message attribution,
    exact-object authority through replay, and the private FIDES preflight for later-loaded ordinary history. Also verify
    that core remains the execution authority for approvals and that this change does not expand the public
    ContextProvider lifecycle. This layer intentionally excludes precise service-history continuation ownership,
    AG-UI replay provenance, and MCP result carrier behavior.

Related Issue

Fixes #9652

#9652 is the original source draft. This PR is its focused replay-and-approval-authority replacement. The policy,
state, and materialization foundation from #9875 is already present, while service-history continuation, AG-UI
provenance, and MCP carrier work remain in later replacement layers.

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

AI assistance details: GitHub Copilot assisted with implementation, regression tests, documentation, and this PR
description.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

@github-actions github-actions Bot left a comment

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.

MAF Automated Review — Iteration 1

Result: Findings reported
Scope: full PR (1 commit(s)): 40521719e14d
Model: gpt-5.6-sol

Overview

The change adds conservative replay classification, exact session-owned placeholder authentication, and canonical approval bindings with strong mutation, depth, duplicate-key, and lifecycle guards. Exact control tokens and pending-session snapshots substantially reduce approval replay authority. However, local per-service history can bypass classification entirely, restored-history coverage is represented by an unbound session-wide boolean, and pre-upgrade hidden placeholders are rejected by the new canonical encoding.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
3 verified findings remained after source verification (2 high, 1 medium) across 2 files. Details are attached to the affected lines below.

Affected areas: python/packages/core/agent_framework/_agents.py, python/packages/core/agent_framework/security.py

Copilot AI balanced review requested due to automatic review settings October 30, 2026 13:40

Copilot AI left a comment

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

4 open issues
What changed in this PR

Hardens FIDES handling of replayed/history-provided content and approval controls so that callers cannot regain trust/authority by replaying or forging IDs, and missing label state is reconstructed conservatively.

Changes:

  • Add conservative replay label classification (including depth/cycle/duplicate-key defenses) and authenticated hidden-placeholder verification.
  • Bind approval authority to canonical stored call bodies + exact live controls, and reconstruct history labels after history providers load.
  • Extend agent session preparation to run provider-specific approval-history preparation; expand regression coverage and documentation.
File Description
python/​packages/​core/​agent_framework/​security.py Implements replay classification, hidden-placeholder authentication, and approval replay authority binding.
python/​packages/​core/​agent_framework/​_agents.py Invokes provider _prepare_approval_history hook after providers run to finalize reconstruction/binding.
python/​packages/​core/​tests/​test_security.py Adds extensive regression tests for replay classification, placeholder integrity, and approval binding.
python/​samples/​02-agents/​security/​FIDES_DEVELOPER_GUIDE.md Documents conservative replay behavior and approval authority rules.
docs/​features/​FIDES_IMPLEMENTATION_SUMMARY.md Updates FIDES summary to include replay/history-provider behavior and trust boundary notes.

Review effort: Lite

Base automatically changed from fides-core-policy-foundation to main November 4, 2026 15:20
Merged via the queue into main with commit 22b5e75 Nov 11, 2026
55 checks passed
@eavanvalkenburg
Eduard van Valkenburg (eavanvalkenburg) deleted the fides-replay-approval-authority branch November 11, 2026 17:10

This branch was successfully deployed

1 active deployment
github-app-auth — 4c0ce31b Deployed Nov 11, 2026 by eavanvalkenburg via add_label #27592
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants