Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
RFC: audit assertions #422
base: main
Are you sure you want to change the base?
RFC: audit assertions #422
Changes from 6 commits
4a3b46d
6d811c2
ec911ef
8d74811
f52a657
3ffb4bf
d45d871
6e22fb4
04fb085
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
(nit) Why module not package? I thought NPM calls them packages everywhere.
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.
Indeed; a module is a file; vulns are reported against packages.
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.
Deep dive on the granularity used for targeting vulnerabilities/dependencies.
TL;DR: module+id may not be enough for the most widespread usecase.
If assertions are only identified by Advisory ID and module name, it makes only one kind of assertions possible - counter-claims by the maintainer on CVEs reported against the package.
While this is simple to define and immensely valuable for the particular usecase, I'd argue it's not the majority usecase.
What seems more likely is a major package with active maintainers depends (directly or not) on a small package with hobby-level support. Now a CVE reported against the small package is more likely to be a result of a script scanning for potentially vulnerable code and on top of that - it's often the case that the small package is not used by the major package in a way that's exploitable (or at all). And last but not least, it's the major package that's likely to have the resources to investigate.
Specific example of a relationship with a vulnerable package:
Imagine a valid CVE for a small package A which is an indirect dependency of a large and popular package B.
The vulnerability is there and no valid counter-claim can be made for package A.
Package B though has a dependency Q in dependency W that only uses package A for one functionality that B never uses (Q is a toolbox style library)
Maintainer of A is not in a position to counter anything (report is valid). Maintainer of B needs to assert that the specific path in their dependencies: B:W>Q>A with specific CVE ID is not affecting the operations of package B.
The ability to declare a vulnerable dependency is not affecting a major package is what can make a noticeable dent in the number of vulnerabilities reported by npm audit even without counter-claims being widely adopted. And it's not my main usecase - it's the first thing I heard when I talked to Package Maintenance WG a while back.
I'm
close topublishing the initial proposal for the format to store and exchange counter-claims (I call them decisions, because they're a bit more than a boolean with explanation).openjs-foundation/pkg-vuln-collab-space#11
I suggest assertions accept:
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 what this gets at is that there may other tools that will want to use the "asserted" data. The npm repository seems like a reasonable option for the data as it already the source of truth for the package itself. A few ideas off the top of my head:
allow other tools to leverage the data.
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 would assume this data would be included with existing package metadata and therefore accessible how people already access package metadata.
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.
Agree here mostly. To get the broader industry support I think this needs to be successful, we will need a well documented schema and set of api's. This feedback is something I have heard from multiple people.
I think the schema and api to load these counter claims needs to be platform agnostic. I think that even "publish this to the npm registry" should be an implementation detail for npm. Preferably npm would just build a client for this contract, or at maybe we need an "extensions" to the api so that npm could say "instead of a GET request to your provider server, install package
foo
and read fileclaims.json
". Again, this is just rough ideas.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.
@naugtur links to your work as prior art would be good here.
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 working on a clean schema to PR to pkg collab space. Maybe I'll finish on Friday.
I thought this RFC is kept as a historical record. I should create a new one or rewrite this totally.
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.
The closest that I'm aware of is Snyk's "Runtime prioritization":
One way of defining "impactful" could be "is an affected function called by the dependency: if it isn't, then it's presumably not an 'impactful' vulnerability".
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 wait, it's a different RFC 😅
I'll share links soon then. Thx
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.
This explains plans and links to most of the stuff
https://dev.to/naugtur/do-you-need-help-with-your-npm-audit-3olf
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.
And a direct link to the tool
https://www.npmjs.com/package/npm-audit-resolver
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.
Format for storing and exchanging assertions/decisions/resolutions/thingies
openjs-foundation/pkg-vuln-collab-space#11