Skip to content

[BUG] artifactLocation.uri in SARIF output is missing a leading / #3289

@thecmdradama

Description

@thecmdradama

Description of the issue

When using the SARIF output type with the SARIF SAST Scans Tab extension in Azure DevOps, the failing rules that are shown under the scans tab have a broken url (Leads to a completely blank page). This seems to be caused by a missing / from the artifactLocation.uri in the generated SARIF output.

For example:

Current URL: https://dev.azure.com/sampleOrg/projectName/_git/repoName?path=path/to/file/with/issue.bicepparam&version={sha}&line=1&lineEnd=2&lineStartColumn=1
Correct URL: https://dev.azure.com/sampleOrg/projectName/_git/repoName?path=/path/to/file/with/issue.bicepparam&version={sha}&line=1&lineEnd=2&lineStartColumn=1

Not sure if there's something I should have set in the options via the ps-rule.yaml file or if this is a relatively simple bug in the sarif generator.

Thanks

Error messages

No response

Reproduction

  1. Install the SARIF SAST Scans Tab extension in Azure DevOps if not already present.
  2. Trigger an Azure Pipeline that runs a scan of any .bicepparam file which will output the result as a SARIF file
  3. Ensure that the pipeline uploads the SARIF file as an artifact.
  4. Go to the Scans tab and click on a link for a failing rule.
  5. Append a / at the start of the path in the URL.

Version of PSRule

2.9.0

How are you running PSRule

Azure Pipelines

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETPull requests that update .net codefeature: outputIssues that affect output and results

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions