Skip to content

Vulnerability Details: Fix code-snippet rendering issue

What does this MR do and why?

It resolves an issue which prevents vulnerable code to being rendered on the vulnerability details page.

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.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
Screenshot_2024-02-12_at_11.10.05_am Screenshot_2024-02-12_at_11.09.55_am

How to set up and validate locally

Apply the following patch

snippet.patch

Set Chrome DevTools to override responses of the local GraphQL endpoint to return

https://developer.chrome.com/docs/devtools/overrides

{
  "data": {
    "project": {
      "id": "gid://gitlab/Project/278964",
      "repository": {
        "blobs": {
          "nodes": [
            {
              "id": "gid://gitlab/Blob/08d3b6ed1bf8dc03bac97a32d56b9ac7ea9ff022",
              "rawTextBlob": "this is some code that should show up\nand this one two if the end_line is set to 2\n",
              "language": "markdown",
              "__typename": "RepositoryBlob"
            }
          ],
          "__typename": "RepositoryBlobConnection"
        },
        "__typename": "Repository"
      },
      "__typename": "Project"
    }
  }
}

Related to #441408 (closed)

Edited by David Pisek

Merge request reports