Skip to content

feat(risk-acceptance): add option to restore Verified when a Risk Acceptance expires - #15878

Merged
Maffooch merged 1 commit into
devfrom
cmm/ra-restore-verified-on-expiry
Sep 4, 2026
Merged

feat(risk-acceptance): add option to restore Verified when a Risk Acceptance expires#15878
Maffooch merged 1 commit into
devfrom
cmm/ra-restore-verified-on-expiry

Conversation

@Maffooch

@Maffooch Maffooch commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

[sc-15175]

What

When a Risk Acceptance expires and reactivates its findings, DefectDojo returns them to Active and clears risk_accepted, but it never touches verified. So scanner-imported findings, which are usually unverified while accepted, come back Active only, not "Active, Verified." There was no option to change that, and some teams treat "Active, Verified" as their true-vulnerability signal for metrics.

Change

Add a per-Risk_Acceptance boolean restore_verified_expired (default False). When enabled, expire_now() also sets verified=True on each reactivated finding, so it returns as Active, Verified. It mirrors the existing restart_sla_expired toggle and lives inside the reactivate_expired block, so it only affects findings that actually reactivate on expiry; default-off preserves today's behavior exactly.

The field is exposed on the edit form and API (fields="__all__"), added to the API filter, and shown on the view template. The migration adds the field to the model and its pghistory event mirror and regenerates the audit triggers.

Because the Pro "Risk Acceptances 2.0" workflow delegates expiry to this same expire_now(), the option works for both the classic flow and the 2.0 workflow with no additional wiring.

Tests

Two behavioral tests in unittests/test_risk_acceptance.py: with the toggle off, Verified is left untouched on expiry; with it on, reactivated findings come back Verified. Both pass (the test database builds through the new migration and triggers).

Notes

Requested via a customer support ticket. Base is dev (new setting, ships in the next minor).

When a Risk Acceptance expires and reactivates its findings, DefectDojo
returns them to Active and clears risk_accepted, but never touches Verified --
so scanner-imported findings come back Active only, not "Active, Verified".
There was no way to change that.

Add a per-Risk_Acceptance BooleanField `restore_verified_expired` (default
False). When enabled, expire_now() also sets verified=True on each reactivated
finding, so it returns as Active, Verified. Mirrors the existing
restart_sla_expired toggle, and lives inside the reactivate_expired block so it
only affects findings that actually reactivate.

Because Pro Risk Acceptances 2.0 delegates expiry to the same OSS expire_now(),
this works for both the classic flow and the 2.0 workflow.

Surfaced on the edit form and API (fields="__all__"), the API filter, and the
view template; migration adds the field to the pghistory event mirror and
regenerates its triggers. Adds two behavioral tests (default leaves Verified
untouched; enabled restores it).

Requested via a customer support ticket.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Maffooch Maffooch added this to the 3.3.0 milestone Sep 4, 2026
@github-actions github-actions Bot added New Migration Adding a new migration file. Take care when merging. unittests ui labels Sep 4, 2026
@Maffooch
Maffooch enabled auto-merge (squash) September 4, 2026 22:27
@Maffooch
Maffooch merged commit b48eb1c into dev Sep 4, 2026
47 checks passed
@Maffooch
Maffooch deleted the cmm/ra-restore-verified-on-expiry branch September 4, 2026 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Migration Adding a new migration file. Take care when merging. ui unittests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants