-
Notifications
You must be signed in to change notification settings - Fork 34
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
Support Go dependency scanning for pull requests #1012
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this patch is fine, some suggestions inline.
@@ -15,8 +15,8 @@ pull_request: | |||
vulnerability_database_endpoint: https://api.osv.dev/v1/query | |||
package_repository: | |||
url: https://registry.npmjs.org | |||
- name: go | |||
- name: Go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you change the name to start with an uppercase letter? btw I wonder if we should just compare the names in a case-insensitive manner so that we'd match all of go, Go, gO and GO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I understand now, OSV's databases are case-sensitive..I would honestly make the mediator ecosystems case-insensitive.. (but if you disagree, just tell me that it's a bad idea..).
tested with:
curl -X POST -d \
'{"version": "0.0.1",
"package": {"name": "golang.org/x/net", "ecosystem": "Go"}}' \
"https://api.osv.dev/v1/query" | jq
versus:
curl -X POST -d \
'{"version": "0.0.1",
"package": {"name": "golang.org/x/net", "ecosystem": "go"}}' \
"https://api.osv.dev/v1/query" | jq
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the names are case-sensitive and can be found here: https://ossf.github.io/osv-schema/#affectedpackage-field
I've changed it to lower-case mediator-wise, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vulnerability_database_type: osv | ||
vulnerability_database_endpoint: https://vuln.go.dev | ||
vulnerability_database_endpoint: https://api.osv.dev/v1/query |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see, while vuln.dev.go
does export their data in the OSV format, they don't provide the same API. We might want to even serve our own and fetch their database periodically, but..not now.
@@ -29,13 +30,44 @@ func newEcosystemParser(eco DependencyEcosystem) ecosystemParser { | |||
switch eco { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you agree about the case-insensitive comparison, maybe we should change this to strings.ToLower
and lowercase all the dependencies..
oh and it looks like a rebase is in order..too many patches are touching the protobuf structs lately.. |
(you'll want to rebase, then just call |
merged so I can send the next PR atop |
#912
Add Go PR vulnerabilities check
The vulnerability checks were tested against the following PR: #725
Proof of functional testing:
![Screenshot 2023-09-25 at 15 44 31](https://private-user-images.githubusercontent.com/43523832/270346179-a08d3bc2-1564-4504-895c-45e556407842.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUzOTQ2OTYsIm5iZiI6MTcyNTM5NDM5NiwicGF0aCI6Ii80MzUyMzgzMi8yNzAzNDYxNzktYTA4ZDNiYzItMTU2NC00NTA0LTg5NWMtNDVlNTU2NDA3ODQyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTAzVDIwMTMxNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTUxMzIyMDU2NWUxMzkxMmU2YTA3N2YzNTIxZDVlYzI0YTA2NDI1NmFmZDc2NzA3NTgyODAxODM3ZmViMTUzZWImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.g4aTJHFbCw_jVXL-jD0FJUwHJWfzjUSEEa_veqxemic)
Closes #1012