Skip to content

Fix dismissed vulnerability comment updates

What does this MR do?

Context

We are using the data from requests to two different endpoints to populate the vulnerability-details modal:

  1. Security Report (security-reports/-/merge_requests/{id}/sast_reports)
  2. Vulnerability Feedback (security-reports/-/vulnerability_feedback?category=sast)

Both request's response data is used within the vuex-state:

  1. state.modal.vulnerability.dismissal_feedback
  2. state.modal.vulnerability.dismissalFeedback

Within the modal we use .dismissal_feedback first and if that is not available then we fall back to .dismissalFeedback

Issue

It looks like the first endpoint is cached but the second one is not.

When a new dismissal gets created the first endpoint will include it until the cache expires, so the data from the second endpoint (state.vulnerability.dismissalFeedback) is used. Everything works as expected.

Once the first endpoint's response includes the dismissal feedback (and state.vulnerability.dismissal_feedback is used) we run into the caching problem and updates to comments, etc. will not be reflected in the UI until cache expiry.

Proposed solution

Use .dismissal_feedback as a fallback and use .dismissalFeedback when it is available.

Considerations

The modal is also used on the security dashboards, where we only populate .dismissal_feedback. The proposed change will not affect this, since we use .dismissal_feedback as a fallback.

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Related to #118818 (closed)

Edited by David Pisek

Merge request reports