-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
implement nodejs fetcher #175
Conversation
The implementation does the following things:
@jzelinskie @Quentin-M PTAL |
if err != nil { | ||
log.Errorf("could not download Node's update: %s", err) | ||
return resp, cerrors.ErrCouldNotDownload | ||
} |
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.
defer r.Body.Close()
Thanks @jzelinskie for the review, commit 'e0a450d' fixes all the issues mentioned in your comment. The commit 'e4b50f1' fixes a similar 'io reader close' issue in other fetchers. |
870b40d
to
fcd22f1
Compare
4375903
to
e4b50f1
Compare
|
||
const ( | ||
url = "https://api.nodesecurity.io/advisories" | ||
cveURLPrefix = "http://cve.mitre.org/cgi-bin/cvename.cgi?name=" |
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.
Could/Should we give a link back to nodesecurity.io?
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.
Especially if we could see the specific version ranges then!
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 use 'cve.mitres.org' because one CVE may links to multiple advisories.
ping @jzelinskie |
cveURLPrefix = "http://cve.mitre.org/cgi-bin/cvename.cgi?name=" | ||
updaterFlag = "nodejsUpdater" | ||
defaultNodejsVersion = "all" | ||
//FIXME: Add a suffix when an advisory is fixed `after` a certain version. |
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.
Does this still need to be fixed?
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'll remove the 'FIXME'. I added 'FIXME' just to remind it needs a better way to check if a package is vulnerable.
In current fetchers, if a package's version is recorded as '1.0.1', it means the security issue will be fixed when the package version '>=' 1.0.1. But in nodejs, it is more complicated. Sometimes, it should '>=' 1.0.1, sometimes it should '>' 1.0.1.
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.
updated
ovs := getOperVersions(version) | ||
for _, ov := range ovs { | ||
if ov.Oper == ">" { | ||
if curVersion, err := types.NewVersion(ov.Version + defaultVersionSuffix); err != nil { |
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'm not sure how I feel about this. If we invent this version and people query the API, won't the FixedIn package always be $version-1, which isn't a real package, but one we made up? That's pretty confusing for end users.
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 a thorough solution is changing the current 'version' from types.NewVersion to a full description string like ">=2.5.0 <= 3.0.0 || >=3.1.0". It could solve both this issue and false-positive issue.
It may not necessary to System package managers, but useful for 'Application updaters' and 'Library package managers'.
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.
Add a type 'fixedInVersions' to FeatureVersion. WIP
Signed-off-by: liang chenye <liangchenye@huawei.com>
Signed-off-by: liang chenye <liangchenye@huawei.com>
Signed-off-by: liang chenye <liangchenye@huawei.com>
Signed-off-by: liang chenye <liangchenye@huawei.com>
The commit 'cb42892: add FixedInVersions to check affected packages' made the following changes:
|
If I may chime in here, WDYT about supporting Snyk with this integration? Can use the open source VulnDB (https://github.com/snyk/vulndb) as a source. Using Snyk will open up the possibility of supporting patches for the (frequent) case of vulnerabilities you can't upgrade away. More on that here: https://snyk.io/docs/security/#snyk-s-process-for-creating-patches It's online, but can also consider using Snyk's API when finding issues, to get more detailed remediation advice. Snyk's DB is AGPL licensed, which makes it fine for internal use. Either way, it's no more restrictive than Node Security's terms of use: https://nodesecurity.io/tos |
One more note - you pointed out you drop all the issues with no CVE. |
@liangchenye what do you think about @guypod's proposal? We've discussed the topic a little bit with NodeSecurity and they aren't 100% clear on how they want their data to be licensed in scenarios like this. |
Here what's nsp's attorney would like us to add to Clair's license if we were to use their database. tl;dr Use of Clair in a paid product would require a separate, paid licensing with nsp.
|
I never think of the license issue :( From my point of view, SnykDB is a better choose to be the 'default nodejs fetcher' in this case. @jzelinskie I agree with 'not to drop non-CVE' vulns, it helps users to better understand their security status. We can add this to README.md to mention about it: Clair is not only a CVE scanner and |
@Quentin-M @jzelinskie is SnykDB OK for you, I'll change to that implementation. Another question is do we plan to provide a document ('implementation.md' for example) to list third-party fetchers? |
Looks like the nsp licensing issue will soon be resolved upstream https://nodejs.org/en/blog/announcements/nodejs-security-project |
This PR is very out of date. I'm going to close it. |
Implement nodejs fetcher by parsing api.nodesecurity.io/advisories.
Cache the last 'updated_at' time of advisories to send a valid 'update' notification.
(#40)
One problem is: there might be more than one fixed/affected package versions in a nodejs advisory.
For example: https://nodesecurity.io/advisories/77
The current Feature seems not be able to handle this.
Signed-off-by: liang chenye liangchenye@huawei.com