Skip to content

Open file link for new modal in new tab

Lorenz van Herwaarden requested to merge open-file-new-tab-new-modal into master

What does this MR do and why?

This MR makes sure the new finding modal opens file links in a new tab. This brings consistency in the behavior between the old and new finding modal.

While the link is on the same domain, we're leaving the current experience because going back would not open the modal automatically. By opening a new tab for the file link, we can leave the modal opened in the previous tab.

Pajamas link behavior states:

A link can use target="_blank" if it's intentional that the user cannot use the browser's back function to return to the reference, and that it's clear to the user they are leaving the current experience.

Screenshots

Modal in MR, but can also be on pipeline security tab

Screenshot_2023-12-22_at_10.00.23

Link opened

Screenshot_2023-12-22_at_10.00.41

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

Setup

  1. You need an EE license
  2. You need to have runners enabled (See $2408961 for setting up a runner)
  3. Import https://gitlab.com/gitlab-org/govern/demos/sandbox/minac/test-remediations
  4. Do not run a pipeline yet on master!
  5. Enable feature flag: echo "Feature.enable(:standalone_finding_modal_merge_request_widget)" | gdk rails c
  6. In the imported test-remediations project
    1. go to reports/sast.json and remove both entries in vulnerabilities, leaving effectively an empty array
    2. commit and push this to master
    3. now, in reports/sast.json, add the removed vulnerabilities back again, but commit and push to a new branch, and create a merge request.

Validate

  1. Go to the created merge request
  2. Expand the security scanning widget
  3. Click on a finding
  4. **Click the file link and validate it opens a new tab **
Edited by Lorenz van Herwaarden

Merge request reports