-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Snyk scanning and upload results (#343)
Fix scanning for all images by correctly setting the platform. Scan results are upload to GitHub code scanning.
- Loading branch information
Showing
2 changed files
with
88 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/python | ||
# GitHub Code Scanning does not allow more than 20 runs per file. We filter out | ||
# empty runs to avoid this limit. Note that the file needs to include at least | ||
# one run. | ||
|
||
import json | ||
|
||
with open("snyk.sarif") as f: | ||
sarif = json.load(f) | ||
|
||
# Remove runs with no results | ||
runs = [run for run in sarif["runs"] if len(run["results"]) > 0] | ||
|
||
# Keep at least one run | ||
runs = runs if len(runs) > 0 else [sarif["runs"][0]] | ||
|
||
sarif["runs"] = runs | ||
|
||
with open("out.sarif", "w") as out: | ||
json.dump(sarif, out, indent=2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters