-
Notifications
You must be signed in to change notification settings - Fork 7
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
Enable warnings/vulnerabilities ignore possibility through an .ignore file #4
Comments
What I propose for this task, is to split it up into three milestones. Then, we could deliver the value piece by piece. Milestone 1 - Basics WarningsYou'll be able to ignore: {
"warnings": {
"unsafe-stmt": ["lodash.difference", "regenerator-runtime"]
}
} Milestone 2 - VulnsYou'll be able to ignore: {
"vulnerabilities": {
"@npmcli/arborist": "<2.8.2",
"next": ">=12.0.0 <12.0.5",
"node-fetch": "*"
}
} Milestone 3 - Detailed WarningsSo instead of basic usage, you could: {
"warnings": {
"unsafe-stmt": [
{
"package": "famous-lib",
"files": ["obfuscated.js"]
}
]
}
} cc @antoine-coulon for that one I'd prefer to stick to the |
Hey @tony-go 👋
I am not sure I understood this statement. {
"package": "famous-lib",
"warnings": [
{
"kind": "obfuscated-code",
"location": [
[0, 0],
[0, 0]
],
"value": "trojan-source",
"file": "obfuscated.js"
}
]
} comes from So about the Milestone 3, you're right it could be what you mentioned, but I'm not sure about specifying "value" and "location", as these parameters are quite implementation details and are not visible in the public API of {
"warnings": {
"unsafe-stmt": [
{
"package": "famous-lib",
- "location": [
- [0, 0],
- [0, 0]
- ],
- "value": "trojan-source",
"file": "obfuscated.js"
}
]
}
} Potentially for each {
"warnings": {
"unsafe-stmt": [
{
"package": "famous-lib",
"files": ["obfuscated.js", "lib/other-file.js"]
}
]
}
} What do you think? |
@antoine-coulon I correct my comment, I'll start with that ^^ |
Proposal
This proposal was initially kindly suggested by @RomainLanz and @targos
The main idea is to provide a way to ignore some
vulnerabilities
for specific dependencies and/orwarnings
for specific modules.Take for example these following reported warnings:
The goal would be to be able to specify through an
.ignore
file some ignore patterns:.nsci-ignore
Which would result in the following reporting outcome:
After that, we could even consider a lower level of granularity by specifying paths to files that should be ignored for a given warning.
Take the following warnings:
.nsci-ignore
This would totally ignore the three warnings above.
In the same spirit as for the
warnings
, we could provide a way to ignore vulnerabilities for specific dependencies.Take for instance the following vulnerabilities from @npmcli/arborist, next and node-fetch:
By providing the following ignore patterns, we could get rid of the vulnerability check for any given dependencies (with any valid SemVer) in the dependency tree.
.nsci-ignore
The
.ignore
configuration above would simply ignore checks for the given SemVer of @npmcli/arborist, next and node-fetch.Implementation
Big picture
First, it would require to enhance the Nsci.Configuration object (which is used when interpreting the @nodesecure/scanner payload) by reflecting the content of the
.ignore
file.The process of ignoring should be introduced just before the Interpretation of the @nodesecure/scanner payload.
Given that the Interpretation step uses an Array of dependency warnings/vulnerabilities (provided by the Extraction step), we should:
Detailled
- Warnings
Given the following ignore patterns:
.nsci-ignore
and the following warning:
EDIT:
.nsci-ignoreexample of js-x-ray warningThe ignore pattern here allows us to ignore this warning by simply looking at the warning's root "package" and "kind". For RegEx patterns on files, the "file" property should be useful.
- Vulnerabilities
Given the following ignore patterns:
and the following vulnerability:
We can filter the vulnerability by matching the SemVer defined within the .nsci-ignore against the "vulnerableRanges" SemVer Array.
The text was updated successfully, but these errors were encountered: