microsoft / microsoft/sarif-web-component

Web viewer does not respect UriBaseIds for navigating to relative file paths

Open
#8 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
108
Forks
36
Avg merge
5d 15h
Merged PRs (30d)
3

Description

Repro steps:

Sarif sample to repro this issue:

{
  "$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.5.json",
  "version": "2.1.0",
  "runs": [
    {
      "results": [
        {
          "ruleId": "rule01",
          "level": "error",
          "message": {
            "text": "test text."
          },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": ".config/CredScanSuppressions.json",
                  "uriBaseId": "TARGETROOT",
                  "index": 0
                },
                "region": {
                  "startColumn": 10,
                  "endColumn": 147,
                  "snippet": {
                    "text": "Test text."
                  }
                }
              }
            }
          ]
        }
      ],
      "tool": {
        "driver": {
          "name": "Code Analysis"
        }
      },
      "originalUriBaseIds": {
        "TARGETROOT": {
          "uri": "https://dev.azure.com/mseng/_git/AzureDevOps?path="
        }
      },
      "artifacts": [
        {
          "location": {
            "uri": ".config/CredScanSuppressions.json",
            "uriBaseId": "TARGETROOT"
          }
        }
      ],
      "columnKind": "utf16CodeUnits"
    }
  ]
}

Expected behavior:

On clicking the file path, we should navigate to the proper URL relative to the value of uriBaseID.
e.g. in above exampl, it shoulde be:

https://dev.azure.com/mseng/_git/AzureDevOps?path=.config/CredScanSuppressions.json

Actual behavior:

Incorrect navigation URL is created relative to the sarif view website instead.

image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the web viewer's file-path click and navigation handling, using the SARIF sample in the issue to trace how artifactLocation.uri and uriBaseId are resolved. Done means clicking .config/CredScanSuppressions.json navigates to the URL formed from the TARGETROOT base and relative path rather than the viewer website.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.