Skip to content

Fix: Don't omit 'run' if empty and fix omitted 'kind' and 'level' attributes in result#106

Merged
owenrumney merged 2 commits intoowenrumney:mainfrom
attiasas:fix/for-github-and-other-omits
Aug 27, 2025
Merged

Fix: Don't omit 'run' if empty and fix omitted 'kind' and 'level' attributes in result#106
owenrumney merged 2 commits intoowenrumney:mainfrom
attiasas:fix/for-github-and-other-omits

Conversation

@attiasas
Copy link
Copy Markdown
Contributor

Following:

Causing a lot of issues, if we are trying to unmarshal a report generated not by this tool or library (for example component written in other languages). making changes and then marshaling it.


We should not omit empty Runs:

if you try to upload to Github

Run github/codeql-action/upload-sarif@v3
Uploading code scanning results
Error details: instance requires property "runs"
Error: Unable to upload "jfrog_sast.sarif" as it is not valid SARIF:
- instance requires property "runs"

also mentioned in spec that is required:

'level' and 'kind' attributes can be calculated if omitted based on the spec:

If we are loading a report with those missing attributes and marshal again, we are not even getting the default values and only "" (since not omitted).

Error details: instance.runs[1].results[3].kind is not one of enum values: notApplicable,pass,fail,review,open,informational
Error details: instance.runs[1].results[3].level is not one of enum values: none,note,warning,error

I'm suggesting those values should be omitted. Github can also proccess them if omitted.

@attiasas attiasas changed the title Fix: run Fix: Don't omit 'run' if empty and fix omitted 'kind' and 'level' attributes in result Aug 27, 2025
Copy link
Copy Markdown
Owner

@owenrumney owenrumney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THanks @attiasas - this makes sense. I need to do a review of other places where the default is set by go-sarif but may not be set in other tools.

I'll merge this and do a new release in the meantime, thanks

@owenrumney owenrumney merged commit ecbe797 into owenrumney:main Aug 27, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants