Add dismissal reason to vulnerability details head

What does this MR do and why?

This MR introduces a new feature flag for dismissing a vulnerability with a reason: dismissal_reason

This MR adds the dismissal reason (if any) to the vulnerability details head. The feature flag needs to be enabled to be able to show this. It's part of the epic &4942 (closed).

It also updates the spec to test for all possible dismissal reasons.

Screenshots or screen recordings

Screenshot_2023-02-20_at_15.48.33

How to set up and validate locally

You'll need an EE license

  1. enable feature flag echo "Feature.enable(:dismissal_reason)" | rails c
  2. import security-reports
  3. you'll need to create a vulnerability which has been dismissed with a reason, one way of doing this (patch for this: fake-dismissal-reason.patch):
    1. add dismissalReason: 'USED_IN_TESTS' to the payload on line 53 in ee/app/assets/javascripts/vulnerabilities/constants.js
    2. add $dismissalReason: VulnerabilityDismissalReason on line 4 and add dismissalReason: $dismissalReason to the input on line 5 in ee/app/assets/javascripts/security_dashboard/graphql/mutations/vulnerability_dismiss.mutation.graphql
    3. go to any vulnerability details page of security-reports
    4. change status to dismiss
    5. refresh page
  4. validate that the header displays "Dismissed: Used in tests"

Note

This MR does not handle providing the dismissal reason. In addition, when testing the steps to validate and create a vulnerability with a dismissal reason, the graphql response does not yet provide the dismissalReason. This will be tackled in another MR. Only after refreshing the page is the dismissalReason provided (via initialVulnerability).

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Closes #296920 (closed)

Edited by Lorenz van Herwaarden

Merge request reports

Loading