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 Support #937

Closed
anthturner opened this issue Jan 20, 2022 · 6 comments · Fixed by #946
Closed

SARIF Output Support #937

anthturner opened this issue Jan 20, 2022 · 6 comments · Fixed by #946
Labels
kind/enhancement This issue is related to a new feature or request

Comments

@anthturner
Copy link
Contributor

anthturner commented Jan 20, 2022

What would you like to be added:

An output formatting module which generates SARIF files ( https://github.com/microsoft/sarif-tutorials ).

SARIF is a fairly new OASIS standard to help integrate and chain together the results of many static analysis tools on the same target.

The biggest difference between SARIF output and the current JSON output is the addition of a dictionary of all rules from all engines. Most of the rest of the changes are semantic or basic structural adjustments.

Why is this needed:

Similar to the output formatting for JSON or Sonarqube, it would be useful for Horusec to output SARIF documents as well, to integrate with things like GitHub's security dashboard natively.

More info on that can be found here: https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/sarif-support-for-code-scanning

While conversion from reports into SARIF files is possible (and is currently my workaround via a large regular expression), it would be better served closer to the Horusec application itself to avoid syntax changes breaking the converter.

@matheusalcantarazup
Copy link
Contributor

Hi @anthturner this is a good suggestion. We are going to study the possibility of adding this new output format. Feel free if you want to contribute something, it would be a pleasure to help you.

@matheusalcantarazup matheusalcantarazup added kind/improvement This issue is not a Bug nor a Feature kind/enhancement This issue is related to a new feature or request and removed kind/improvement This issue is not a Bug nor a Feature labels Jan 21, 2022
@anthturner
Copy link
Contributor Author

Go is one of the languages I'm less familiar with. I have messed around with adding bindings for new output format but still have a ways to go until I get anything that actually works. I'll take more time on it this weekend.

If you'd like, I can fork and start work on this item, and we can collaborate on getting it working as desired. (Or if it's easier, I can work from a branch on this repo; your choice)

Thanks for the response!

@matheusalcantarazup
Copy link
Contributor

For outside contributors we suggest to fork the repository and open a PR. Fell free to make any question here or on a PR.

The code that make the reports live on internal/controllers/printresults package, we basically make a switch case here to decide how we should process the results.

You can read the function that process the results as a Sonarqube output here, its very simple. The code that create the Sonarqube output format lives on internal/services/sonarqube package.

On CONTRIBUTING.md we have some steps that should be done by contributors and BUILD.md contains the dependencies and commands necessary to build and test Horusec, fell free to make any question, and thanks for your interest.

@anthturner
Copy link
Contributor Author

Took a shot at creating this. As noted in the PR there are still some gaps which are mostly all data-based now, such as not all RuleIDs being present.

That said, it's neat to see this working with this standardized output.

@anthturner
Copy link
Contributor Author

@matheusalcantarazup (or other)...

Would appreciate some thoughts on my idea to supplement the RuleID on formatters which don't have it. anthturner@71f2b49

I'd like to extend this across the board but want to get at least a vague thumbs up on the general direction before I put in the larger effort.

@matheusalcantarazup
Copy link
Contributor

Would appreciate some thoughts on my idea to supplement the RuleID on formatters which don't have it. anthturner@71f2b49

I'd like to extend this across the board but want to get at least a vague thumbs up on the general direction before I put in the larger effort.

I think that would be better open another issue for further discussion. Can you please open?

@wiliansilvazup wiliansilvazup linked a pull request Jan 24, 2022 that will close this issue
matheusalcantarazup pushed a commit that referenced this issue Feb 2, 2022
Fixes #937 

Signed-off-by: Anthony Turner <225599+anthturner@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement This issue is related to a new feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants