Skip to content

ADD: Minimal sarif output for clamscan#1674

Open
ivanchubb wants to merge 2 commits intoCisco-Talos:mainfrom
ivanchubb:main
Open

ADD: Minimal sarif output for clamscan#1674
ivanchubb wants to merge 2 commits intoCisco-Talos:mainfrom
ivanchubb:main

Conversation

@ivanchubb
Copy link
Copy Markdown

Closes: #1673

This is a PR to add a SARIF format output for clamscan. This feature will help with users who run clamav in CI pipelines and are taking actions based on the output.

This PR Is a pretty minimal implementation and the SARIF schema allows for A LOT more fidelity on the nature of the scan, it's environment, and findings. However, this is my first PR to the repo and I feel like it's big enough already. The next iteration of this would have to involve some changes to how clamscan finds infected files, right now it just logs them to stdout/stderr. In order to get that into a sarif output it'd involve storing those findings in a data structure along with which signature was associated with a positive finding. After that, when formatting, the SARIF ruleID field is a good 1:1 match for signature id.

Additionally, I broke the print_version() function up so that there is now an option to get the db build info without printing to screen as well as adding the --sarif=FILE option and help text.

Note: I put this change in clamscan.c since it had the s_info struct. If it belongs better in output.c or misc.c, I can move it, but since s_info is declared in global.h and none of the files in /common include it already, I figured ya'll wouldn't want it there.

example of the sarif output on a successful run:

image

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.

Feature Request: clamscan optional SARIF output format

1 participant