Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SARIF output violates the spec and puts all locations into one result #90

Closed
valentinas opened this issue Sep 9, 2024 · 4 comments · Fixed by lightspeed-security/mobsfscan#1

Comments

@valentinas
Copy link

Hi,

I have encountered an issue where I want to use mobsfscan with GitHub Code Scanning. GitHub needs the output to be in SARIF format, but mobsfscan produces SARIF that has all instances of the same type of vulnerability inside one "result" object with multiple "locations" objects.

This goes against the SARIF spec, which states that:

The locations array SHALL NOT be used to specify distinct occurrences of the same result which can be corrected independently.

Because of this GitHub only displays the first instance of each vulnerability.

ls-valentinas-bakaitis added a commit to lightspeed-security/mobsfscan that referenced this issue Sep 10, 2024
@heltoft
Copy link

heltoft commented Oct 9, 2024

This fix would be very appreciated - is it possible to get some action on this? I see there is a open pull request for it.

I ran into the same issue and created a workaround that can be used until the issue is resolved.
In case it is useful to others the workaround is to run the mobsfscan output through jq to modify the output to get the expected result:

cat mobsfscan_output.sarif | \
jq '.runs |= map(.results |= map(.locations[] as $loc | .locations = [$loc] | .))' \
> fixed_mobsfscan_output.sarif

@ajinabraham
Copy link
Member

I am working on a libsast performance update. This will be addressed along with that.

@ajinabraham
Copy link
Member

I bumped the libsast version. Can you update this PR accordingly?

@valentinas
Copy link
Author

Yep, will do now

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 a pull request may close this issue.

3 participants