Python: fix: bound pending policy approvals - #7996
Open
Patel Namraa (Namraa310806) wants to merge 3 commits into
Open
Python: fix: bound pending policy approvals#7996Patel Namraa (Namraa310806) wants to merge 3 commits into
Patel Namraa (Namraa310806) wants to merge 3 commits into
Conversation
Patel Namraa (Namraa310806)
deployed
to
github-app-auth
September 1, 2026 14:55 — with
GitHub Actions
Active
Patel Namraa (Namraa310806)
deployed
to
github-app-auth
September 1, 2026 14:55 — with
GitHub Actions
Active
Patel Namraa (Namraa310806)
deployed
to
github-app-auth
September 1, 2026 14:55 — with
GitHub Actions
Active
Patel Namraa (Namraa310806)
deployed
to
github-app-auth
September 1, 2026 14:56 — with
GitHub Actions
Active
Patel Namraa (Namraa310806)
deployed
to
github-app-auth
September 1, 2026 15:03 — with
GitHub Actions
Active
Contributor
Author
Note on Related WorkA draft PR (#7893) was already opened for this issue, and I reviewed it while working on #7890. Since the draft had not yet progressed to an active PR while the issue remained unresolved in the main codebase, I opened this PR with a more concise approach focused on directly bounding the pending approval state and preserving the existing approval-binding behavior. The intent is not to duplicate or compete with the existing work, but to make sure the underlying bug is fixed with a focused and maintainable approach. I’m happy to adjust or consolidate the implementation based on maintainer feedback. |
5 tasks
Patel Namraa (Namraa310806)
deployed
to
github-app-auth
September 2, 2026 03:27 — with
GitHub Actions
Active
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation & Context
PolicyEnforcementFunctionMiddlewarecan retain pending policy-approval entries indefinitely whenapproval_on_violation=Trueand an approval is never consumed.The pending approvals are stored in
_pending_policy_approvals. When applications reuse a middleware instance across many interactions, unconsumed approvals can accumulate over time, causing unbounded memory growth.This PR fixes the lifecycle of those pending approvals while preserving the existing approval-binding and fail-closed security behavior.
Fixes #7890
Description & Review Guide
What are the major changes?
_pending_policy_approvalswith a configurablemax_pending_approvalslimit, defaulting to1000.call_idis encountered from a different session.What is the impact of these changes?
_pending_policy_approvalsfrom growing without bound under repeated unconsumed policy violations.What do you want reviewers to focus on?
max_pending_approvals=1000is an appropriate bound for the experimental FIDES policy-approval flow.Related Issue
Fixes #7890
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.