DataDog / guarddog

:snake: :mag: GuardDog is a CLI tool to Identify malicious PyPI and npm packages
https://securitylabs.datadoghq.com/articles/guarddog-identify-malicious-pypi-packages/
Apache License 2.0
585 stars 43 forks source link

[SINT-2119] Support Go ecosystem #413

Closed juliendoutre closed 1 month ago

juliendoutre commented 2 months ago

Purpose

This PR introduces support for a new ecosystem in guarddog: Golang.

To limit the dependency on external toolchains, I chose not to use the go binary to perform go get or go list operations. This came with a couple of caveats I left as TODOs in the code:

In order to test this new addition, I simply extended the shady-links semgrep rule to Golang. We can then later think of additional heuristics specific to Go.

Testing

I added tests for the two new scanners added in this PR.

One can test the new feature with:

$ guarddog --log-level debug go scan github.com/aws/aws-sdk-go-v2
$ guarddog --log-level debug go scan github.com/aws/aws-sdk-go-v2 --version v1.30.3
$ guarddog --log-level debug go verify ~/dd/KubeHound/go.mod # you first wanna make sure you cloned thehttps://github.com/DataDog/KubeHound repo