Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple modes of operation for vulnerability policies #669

Merged
merged 12 commits into from
Jun 5, 2024

Conversation

sahibamittal
Copy link
Collaborator

@sahibamittal sahibamittal commented May 1, 2024

Description

At the moment, vulnerability policies are "enforced" as soon as they are created in the system.

There may be situations however, in which policies are supposed to be deployed, but not enforced. Add a mandatory field 'mode of operation' to define the same :

  1. Disabled: Don't do anything with it, don't even consider it for evaluation.
  2. Log: Evaluate policy, but don't take action, and log the outcome instead.
  3. Apply: Apply policy analysis, perform db transactions and send notifications.

Addressed Issue

DependencyTrack/hyades#957

Checklist

  • I have read and understand the contributing guidelines
  • This PR fixes a defect, and I have provided tests to verify that the fix is effective
  • This PR implements an enhancement, and I have provided tests to verify that it works as intended
  • This PR introduces changes to the database model, and I have updated the migration changelog accordingly
  • This PR introduces new or alters existing behavior, and I have updated the documentation accordingly

Copy link

codacy-production bot commented May 2, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
-0.03% (target: -1.00%) 85.00% (target: 70.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (4a0987b) 19568 15947 81.50%
Head commit (f2042f5) 19593 (+25) 15962 (+15) 81.47% (-0.03%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#669) 20 17 85.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy will stop sending the deprecated coverage status from June 5th, 2024. Learn more

@sahibamittal sahibamittal marked this pull request as ready for review May 2, 2024 13:11
@nscuro
Copy link
Member

nscuro commented May 29, 2024

@sahibamittal There are still a few TODOs in here, should we convert this PR to Draft for now?

@sahibamittal sahibamittal marked this pull request as ready for review May 31, 2024 14:02
@sahibamittal sahibamittal requested a review from nscuro June 4, 2024 16:15
@nscuro nscuro added this to the 5.5.0 milestone Jun 5, 2024
@nscuro nscuro added the enhancement New feature or request label Jun 5, 2024
@nscuro nscuro changed the title Issue 957 vuln policy modes of operation Support multiple modes of operation for vulnerability policies Jun 5, 2024
@nscuro nscuro merged commit b04373b into main Jun 5, 2024
8 checks passed
@nscuro nscuro deleted the issue-957-vuln-policy-modes-of-operation branch June 5, 2024 11:48
nscuro added a commit to DependencyTrack/hyades that referenced this pull request Jun 6, 2024
The `operationMode` field in vulnerability policies is mandatory as of DependencyTrack/hyades-apiserver#669.

Signed-off-by: nscuro <nscuro@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants