[upload-sarif@v3] action completely ignore the `sha` input and using commit hash from `checkout_path` instead

Open
#2,807 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
github-actions, typescript
Domain
ci-cd, security

Research direction

Start in src/upload-sarif-action.ts at line 91 and src/upload-lib.ts at line 605, then trace how the sha input and checkout_path commit are selected. Reproduce the reported upload using the YAML example and inspect the request body. Done means the upload request uses the supplied sha as commit_oid.

Written by the indexing model from the issue text.

Description

  • Usage:
uses: github/codeql-action/upload-sarif@v3
with:
  sarif_file: sarif-results/fix-paths-cpp.sarif
  ref: refs/heads/main
  sha: a8e616ed369f7f74173a13c5489dbae89c3b12
  checkout_path: /runner/_work/parent-repo/build
  • Output from action:
request: {
      method: 'PUT',
      url: 'https://github.com/api/v3/repos/PFO/OpenSIL/code-scanning/analysis',
      headers: {
        accept: 'application/vnd.github.v3+json',
        'user-agent': 'CodeQL-Action/3.22.12 octokit-core.js/3.6.0 Node.js/20.18.0 (linux; x64)',
        authorization: 'token [REDACTED]',
        'content-type': 'application/json; charset=utf-8'
      },
      body: '{"commit_oid":"b0b0efb3f489d6c16d35gsfd4b388173h99e1049","ref":"refs/heads/main","analysis_key":".github/workflows/codeql-nightly.yml:codeql","analysis_name":"CodeQL- Nightly","sarif":"..."}'

From the output, we can see that it is not actually uploading with the commit_oid that we assigned in the sha input.

Looking at the src code of the upload-sarif action:

Dominant language
TypeScript
Stars
1.6k
Forks
493
Avg merge
1d 13h
Merged PRs (30d)
44

Contributor guide

Open the contributing guide

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.

More from github/codeql-action

All issues in github/codeql-action

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.