-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix(dotnet): don't include non-runtime libraries into report for *.deps.json
files
#7039
Merged
knqyf263
merged 10 commits into
aquasecurity:main
from
DmitriyLewen:fix-dotnet-core/add-dev-flag-for-libs-built-into-netcore
Jul 22, 2024
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
298f192
feat(parser): check `Targets` to mark libs as dev
DmitriyLewen c8df60a
test(parser): add testcase with `dev` field
DmitriyLewen 7066c9a
test(fanal): add `id` field
DmitriyLewen e583108
test(integration): update golden file
DmitriyLewen d8dcd12
docs: add info about `--include-dev-deps` flag into .NET page
DmitriyLewen 2725e2c
refactor: remove non-runtime libs
DmitriyLewen 21c6cd3
docs: update coverage page
DmitriyLewen 5799449
docs: remove unused links
DmitriyLewen afe12b4
fix: update incorrect comments
DmitriyLewen ca87c12
test: add `System.Net.Http` and `NETStandard.Library` to test file
DmitriyLewen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,10 +22,11 @@ | |
"Type": "dotnet-core", | ||
"Packages": [ | ||
{ | ||
"ID": "Newtonsoft.Json/9.0.1", | ||
"Name": "Newtonsoft.Json", | ||
"Identifier": { | ||
"PURL": "pkg:nuget/[email protected]", | ||
"UID": "19955f480b8a6340" | ||
"UID": "e678401f5d07418a" | ||
}, | ||
"Version": "9.0.1", | ||
"Layer": {}, | ||
|
@@ -40,10 +41,11 @@ | |
"Vulnerabilities": [ | ||
{ | ||
"VulnerabilityID": "GHSA-5crp-9r3c-p9vr", | ||
"PkgID": "Newtonsoft.Json/9.0.1", | ||
"PkgName": "Newtonsoft.Json", | ||
"PkgIdentifier": { | ||
"PURL": "pkg:nuget/[email protected]", | ||
"UID": "19955f480b8a6340" | ||
"UID": "e678401f5d07418a" | ||
}, | ||
"InstalledVersion": "9.0.1", | ||
"FixedVersion": "13.0.1", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
116 changes: 116 additions & 0 deletions
116
pkg/dependency/parser/dotnet/core_deps/testdata/without-runtime.deps.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
{ | ||
"runtimeTarget": { | ||
"name": ".NETCoreApp,Version=v6.0", | ||
"signature": "" | ||
}, | ||
"compilationOptions": {}, | ||
"targets": { | ||
".NETCoreApp,Version=v6.0": { | ||
"hello2/1.0.0": { | ||
"dependencies": { | ||
"JsonDiffPatch": "2.0.61" | ||
}, | ||
"runtime": { | ||
"hello2.dll": {} | ||
} | ||
}, | ||
"JsonDiffPatch/2.0.61": { | ||
"dependencies": { | ||
"Microsoft.NETCore.App": "1.1.2" | ||
}, | ||
"runtime": { | ||
"lib/netcoreapp1.1/JsonDiffPatch.dll": { | ||
"assemblyVersion": "1.0.0.0", | ||
"fileVersion": "1.0.0.0" | ||
} | ||
} | ||
}, | ||
"Libuv/1.9.1": { | ||
"dependencies": { | ||
"Microsoft.NETCore.Platforms": "1.1.0" | ||
}, | ||
"runtimeTargets": { | ||
"runtimes/debian-x64/native/libuv.so": { | ||
"rid": "debian-x64", | ||
"assetType": "native", | ||
"fileVersion": "0.0.0.0" | ||
}, | ||
"runtimes/fedora-x64/native/libuv.so": { | ||
"rid": "fedora-x64", | ||
"assetType": "native", | ||
"fileVersion": "0.0.0.0" | ||
} | ||
} | ||
}, | ||
"Microsoft.NETCore.App/1.1.2": { | ||
"dependencies": { | ||
"Libuv": "1.9.1", | ||
"System.Collections.Immutable": "1.3.0" | ||
} | ||
}, | ||
"Microsoft.NETCore.Platforms/1.1.0": {}, | ||
"NETStandard.Library/1.6.0": { | ||
"dependencies": { | ||
"System.Net.Http": "4.1.0" | ||
} | ||
}, | ||
"System.Net.Http/4.1.0": {} | ||
} | ||
}, | ||
"libraries": { | ||
"hello2/1.0.0": { | ||
"type": "project", | ||
"serviceable": false, | ||
"sha512": "" | ||
}, | ||
"JsonDiffPatch/2.0.61": { | ||
"type": "package", | ||
"serviceable": true, | ||
"sha512": "sha512-nZ4QtcU3jR+CBT69qcJBvCcWi5uKgPRrrvSMm4V8Z76ljJ/MFo1P55qXk/nQY0q0WC4v94m5qH4SDhovFfci+Q==", | ||
"path": "jsondiffpatch/2.0.61", | ||
"hashPath": "jsondiffpatch.2.0.61.nupkg.sha512" | ||
}, | ||
"Libuv/1.9.1": { | ||
"type": "package", | ||
"serviceable": true, | ||
"sha512": "sha512-uqX2Frwf9PW8MaY7PRNY6HM5BpW1D8oj1EdqzrmbEFD5nH63Yat3aEjN/tws6Tw6Fk7LwmLBvtUh32tTeTaHiA==", | ||
"path": "libuv/1.9.1", | ||
"hashPath": "libuv.1.9.1.nupkg.sha512" | ||
}, | ||
"Microsoft.NETCore.App/1.1.2": { | ||
"type": "package", | ||
"serviceable": true, | ||
"sha512": "sha512-fcN0Ob6rjY7Zu0770cA5l9wRJvj7+ltJPPdryUidejkkhao+y2AYrtezBTlP9nCSFXLmYR9BtaknORT17x8reA==", | ||
"path": "microsoft.netcore.app/1.1.2", | ||
"hashPath": "microsoft.netcore.app.1.1.2.nupkg.sha512" | ||
}, | ||
"Microsoft.NETCore.Platforms/1.1.0": { | ||
"type": "package", | ||
"serviceable": true, | ||
"sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==", | ||
"path": "microsoft.netcore.platforms/1.1.0", | ||
"hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512" | ||
}, | ||
"NETStandard.Library/1.6.0": { | ||
"type": "package", | ||
"serviceable": true, | ||
"sha512": "sha512-ypsCvIdCZ4IoYASJHt6tF2fMo7N30NLgV1EbmC+snO490OMl9FvVxmumw14rhReWU3j3g7BYudG6YCrchwHJlA==", | ||
"path": "netstandard.library/1.6.0", | ||
"hashPath": "netstandard.library.1.6.0.nupkg.sha512" | ||
}, | ||
"System.Collections.Immutable/1.3.0": { | ||
"type": "package", | ||
"serviceable": true, | ||
"sha512": "sha512-zukBRPUuNxwy9m4TGWLxKAnoiMc9+B+8VXeXVyPiBPvOd7yLgAlZ1DlsRWJjMx4VsvhhF2+6q6kO2GRbPja6hA==", | ||
"path": "system.collections.immutable/1.3.0", | ||
"hashPath": "system.collections.immutable.1.3.0.nupkg.sha512" | ||
}, | ||
"System.Net.Http/4.1.0": { | ||
"type": "package", | ||
"serviceable": true, | ||
"sha512": "sha512-ULq9g3SOPVuupt+Y3U+A37coXzdNisB1neFCSKzBwo182u0RDddKJF8I5+HfyXqK6OhJPgeoAwWXrbiUXuRDsg==", | ||
"path": "system.net.http/4.1.0", | ||
"hashPath": "system.net.http.4.1.0.nupkg.sha512" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
Would it be possible to add another testcase that references some of the commonly reported false positives and proves that those aren't flagged? For example - a deps file listing a vulnerable version of
System.Net.Http
etc. Here's a sample deps file:testRuntimeDeps.deps.json
This was created with
This shows that all the old packages (some vulnerable) making up the NETStandard surface area are all excluded when targeting the latest frameworks which provide inbox support for all those package.
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.
Your test file is too large.
So I only inserted
System.Net.Http
andNETStandard.Library
libraries into test file. - ca87c12