Repository navigation
fix(risk-acceptance): keep an unaccepted duplicate inactive when it leaves or expires - #16982
Merged
blakeaowens merged 4 commits intoNov 18, 2026
Merged
Conversation
…eaves or expires A duplicate that a risk acceptance never accepted (duplicate, not risk accepted) can be a member: add_findings_to_risk_acceptance leaves it as it is. Removing it from the acceptance, deleting the acceptance, or expiring an acceptance that reactivates its findings still set it active, leaving an active duplicate the acceptance never suppressed. release_finding now keeps such a member's active value (helper.not_held: closed for another reason, or a duplicate never accepted) and clears only the risk accepted flags, as it already did for a member closed for another reason. _expire_now leaves it as it is. A duplicate the acceptance did accept still comes back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0143hYTFvxQiwycLMvhG5mDm
…n it leaves or expires Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0143hYTFvxQiwycLMvhG5mDm
…e shared setup test_add_risk_acceptance_multiple_findings_accepted accepted findings 2 and 3, and finding 3 is a duplicate that is not risk accepted: add_findings_to_risk_acceptance leaves it as it is. The expire and reinstate tests built on that setup only passed because an expiry reopened finding 3, which is the behavior the previous commit removes. Accept 2 and 7 (the engagement's other finding that is not a duplicate), so every member is one the acceptance holds; the unaccepted duplicate keeps its own tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0143hYTFvxQiwycLMvhG5mDm
…ccepted With the expiry no longer reopening a duplicate the acceptance never accepted, a later reinstate of a reactivating acceptance leaves it out through findings_closed_since_expiry, as it leaves out a member closed since the expiry. Pin that with a test (expire, reinstate: the duplicate is no longer a member and keeps its status, the held members are accepted again), and say so in the docstring, the reinstate log line and the reinstate docs. The bulk edit docs named a per-Asset deduplication setting that does not exist: the switch is per Engagement (Deduplication within this engagement only). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0143hYTFvxQiwycLMvhG5mDm
Maffooch
approved these changes
Nov 18, 2026
devGregA
approved these changes
Nov 18, 2026
blakeaowens
deleted the
fix/risk-acceptance-release-keeps-unaccepted-duplicate
branch
November 18, 2026 07:51
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.
Description
A Full Risk Acceptance can hold a member it never accepted:
add_findings_to_risk_acceptanceleaves a duplicate that is not risk accepted as it is (duplicate=True, risk_accepted=False, inactive), while the form or the serializer has already written it intoaccepted_findings. Three writers still reopened that duplicate, leavingactive=True, duplicate=True, an active duplicate the acceptance never suppressed:release_finding, behindremove_finding_from_risk_acceptance(the Remove button on the Risk Acceptance page, the API removal) andhelper.delete(deleting the acceptance), set every member active unless it was closed for another reason._expire_now, with Reactivate Findings on Expiration on (the expire action and the scheduled expiry), set every inactive member active.release_findingnow readsnot_held()(closed for another reason, or a duplicate never accepted) before it clears the risk accepted flag. Such a member keeps itsactivevalue, and its endpoint statuses lose only theirrisk_acceptedflag, as a member closed for another reason already did._expire_nowleaves a duplicate that is not risk accepted as it is: it is not saved and is not in the reactivated list. A duplicate the acceptance did accept (risk accepted before it was marked a duplicate) is held, and still comes back. The expiry change is deliberately limited to that duplicate rule.Test results
New cases in
unittests/test_risk_acceptance.py(RiskAcceptanceTestUI) build an acceptance holding two findings plus an unaccepted duplicate with a mitigated endpoint status:test_remove_keeps_an_unaccepted_duplicate_inactive,test_delete_keeps_an_unaccepted_duplicate_inactive,test_expire_keeps_an_unaccepted_duplicate_inactive: the duplicate stays inactive and not risk accepted, its endpoint status stays mitigated; the held findings come back, and expiry's notification lists only them;test_remove_reopens_a_duplicate_the_acceptance_accepted: the control, an accepted finding marked a duplicate afterwards still comes back.On
devthe first three fail (the unaccepted duplicate was reactivated, active=True), and the control passes; with this change all four pass.The shared setup
test_add_risk_acceptance_multiple_findings_acceptedaccepted findings 2 and 3, and finding 3 indojo_testdata.jsonis a duplicate that is not risk accepted, so the acceptance never held it. Eight expire and reinstate tests built on it (test_expire_risk_acceptance_sla_reset,test_expire_risk_acceptance_restores_verified_when_enabled, the sixtest_reinstate_*that close a member and expire again) passed only because an expiry reopened finding 3, the behavior this PR removes. The setup now accepts findings 2 and 7, the engagement's two findings that are not duplicates, so every member is one the acceptance holds. With the old setup and this fix those eight fail exactly as the first CI run on this PR did; with the new setup the wholeRiskAcceptanceTestUIclass passes (51 tests).ruff check(0.16.10) passes on the changed files.Performance, an acceptance holding 25 findings plus 25 unaccepted duplicates (each with one endpoint status), median of 7 interleaved runs:
devThe duplicates left active go from 25 to 0 in each case; the savings are the writes that reopened them.
Documentation
OS__risk_acceptance.mdandPRO__risk_acceptance.md(expiry and delete or removal) andPRO__bulk_edit_findings.md(moving a Finding to another Engagement) now say that a duplicate the Risk Acceptance never accepted stays inactive.🤖 Generated with Claude Code
https://claude.ai/code/session_0143hYTFvxQiwycLMvhG5mDm