Skip to content

Code scanning alert doesn't find file in repository #34

Closed

Description

@adangel

When uploading the SARIF file to code-ql, the file in the repository is not found:

Preview unavailable

Sorry, we couldn't find this file in the repository.

grafik


Workaround

Add the following step before upload-sarif:

      - name: Relativize SARIF
        shell: bash
        run: |
          jq ".runs[0].results[].locations[].physicalLocation.artifactLocation.uri |= sub(\"${GITHUB_WORKSPACE}/\"; \"\")" pmd-report.sarif > pmd-report2.sarif
          mv -f pmd-report2.sarif pmd-report.sarif

Activity

  1. added
    bug
    on Dec 20, 2021
  2. adangel commented on Dec 20, 2021

    @adangel
    MemberAuthor

    It seems, that the upload-sarif actions actually has a parameter for this: https://github.com/github/codeql-action/blob/249c7ffce1bd9ae683a22f2e0b82253a31562477/upload-sarif/action.yml#L12-L15

    However, checkout_path doesn't seem to be working as expected... so we simply relativize the paths ourselves (as we did already for the build annotations).

  3. added this to the next milestone on Dec 20, 2021
  4. added a commit that references this issue on Dec 20, 2021
    ecd6f0c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions