#2833·reviewdog

SARIF locations using artifact index lose their file path

Author: strawberry-little-bearCreated Sep 27, 2026Updated Sep 27, 2026

The SARIF parser ignores artifactLocation.index when resolving a result's file path.

SARIF allows a location to refer to an artifact either directly with uri or indirectly with an index into the run's artifacts array. The current parser only reads uri and uriBaseId in getPath (parser/sarif.go), so a valid location like this loses the file name:

json
{
  "runs": [
    {
      "artifacts": [
        { "location": { "uri": "src/index-fixture.go" } }
      ],
      "results": [
        {
          "message": { "text": "fixture finding" },
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": { "index": 0 },
                "region": { "startLine": 7 }
              }
            }
          ]
        }
      ]
    }
  ]
}

With this input, run.artifacts[0].location.uri is src/index-fixture.go, but the result's physicalLocation.artifactLocation contains only {"index": 0}. The current path-resolution code leaves the URI empty, so the diagnostic is emitted without the source path (and any fix keyed by that path cannot be associated with the finding).

I would expect the parser to resolve an artifact index through run.artifacts first, then apply the same URI/base-URI handling used for direct locations. An out-of-range index should also produce a clear error rather than silently yielding an empty path.

This matters for SARIF producers that de-duplicate artifact locations and use the standard run.artifacts table instead of repeating a URI in every result.