Skip to content

upload-sarif: Better error message when run.results is missing #420

Closed

Description

@adityasharad

Some third-party SARIF producer tools incorrectly create a run without a results object when the tool succeeds and finds no results, when they should be populating results with an empty array. This is on the tool to fix, but we can provide a better error message in this case, instead of an unhelpful crash in the upload-sarif Action:

Uploading sarif files: ["filename.sarif"]
Error: Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
  at countResultsInSarif (/home/runner/work/_actions/github/codeql-action/v1/lib/upload-lib.js:121:35)
  at uploadFiles (/home/runner/work/_actions/github/codeql-action/v1/lib/upload-lib.js:214:30)
  at Object.uploadFromActions (/home/runner/work/_actions/github/codeql-action/v1/lib/upload-lib.js:91:18)
  at processTicksAndRejections (internal/process/task_queues.js:93:5)
  at async run (/home/runner/work/_actions/github/codeql-action/v1/lib/upload-sarif-action.js:34:29)
  at async runWrapper (/home/runner/work/_actions/github/codeql-action/v1/lib/upload-sarif-action.js:46:9)

Activity

  1. aeisenberg commented on Mar 15, 2021

    @aeisenberg
    Contributor

    Just want to make sure that this does not affect the codeql github upload-results command since we are only expecting it to be used for codeql.

  2. adityasharad commented on Mar 15, 2021

    @adityasharad
    ContributorAuthor

    Worth checking how the CLI handles this case (and adding a test) - I expect it will give a SARIF validation error, which is correct.

  3. self-assigned this
    on Mar 17, 2021
  4. aeisenberg commented on Mar 17, 2021

    @aeisenberg
    Contributor

    Fixed in #426

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions