-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(PackageURL):add package URL for library scan result #1862
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
Merged
shino
merged 15 commits into
future-architect:master
from
TsubasaKanemitsu:packageurl-library
Mar 7, 2024
Merged
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
dacd00c
add: package url in model.Library
TsubasaKanemitsu 6908843
feat(trivy-to-vuls): add purl for library scan result
TsubasaKanemitsu 584a441
feat(scanner/library): add purl for lockfile scan result
TsubasaKanemitsu c202d84
fix: model.Library test
TsubasaKanemitsu b4cf9ce
fix: trivy-to-vuls test data
TsubasaKanemitsu 54667fe
fix: panic case to generate purl
TsubasaKanemitsu e179206
fix: add blank line
TsubasaKanemitsu 390f694
fix: trivy-to-vuls for using Trivy version 0.49.0 or earlier
TsubasaKanemitsu 8f83c52
fix: remove comment
TsubasaKanemitsu a5b9cd3
fix: remove print
TsubasaKanemitsu 9dd8f39
fix: testcase for Package.Identifier does not exist version
TsubasaKanemitsu 3d1b62d
fix: add blank line
TsubasaKanemitsu 3bae877
fix: expected libs
TsubasaKanemitsu ec67d2c
fix: PackageURL -> PURL
TsubasaKanemitsu eeea8f3
fix: blank line
TsubasaKanemitsu 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 hidden or 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 |
---|---|---|
|
@@ -136,6 +136,9 @@ var redisTrivy = []byte(` | |
"Packages": [ | ||
{ | ||
"Name": "adduser", | ||
"Identifier": { | ||
"PURL": "pkg:deb/debian/[email protected]?arch=all\u0026distro=debian-10.10" | ||
}, | ||
"Version": "3.118", | ||
"SrcName": "adduser", | ||
"SrcVersion": "3.118", | ||
|
@@ -145,6 +148,9 @@ var redisTrivy = []byte(` | |
}, | ||
{ | ||
"Name": "apt", | ||
"Identifier": { | ||
"PURL": "pkg:deb/debian/[email protected]?arch=amd64\u0026distro=debian-10.10" | ||
}, | ||
"Version": "1.8.2.3", | ||
"SrcName": "apt", | ||
"SrcVersion": "1.8.2.3", | ||
|
@@ -154,6 +160,9 @@ var redisTrivy = []byte(` | |
}, | ||
{ | ||
"Name": "bsdutils", | ||
"Identifier": { | ||
"PURL": "pkg:deb/debian/[email protected]?arch=amd64\u0026distro=debian-10.10\u0026epoch=1" | ||
}, | ||
"Version": "1:2.33.1-0.1", | ||
"SrcName": "util-linux", | ||
"SrcVersion": "2.33.1-0.1", | ||
|
@@ -163,6 +172,9 @@ var redisTrivy = []byte(` | |
}, | ||
{ | ||
"Name": "pkgA", | ||
"Identifier": { | ||
"PURL": "pkg:deb/debian/[email protected]?arch=amd64\u0026distro=debian-10.10\u0026epoch=1" | ||
}, | ||
"Version": "1:2.33.1-0.1", | ||
"SrcName": "util-linux", | ||
"SrcVersion": "2.33.1-0.1", | ||
|
@@ -308,16 +320,25 @@ var strutsTrivy = []byte(` | |
"Packages": [ | ||
{ | ||
"Name": "oro:oro", | ||
"Identifier": { | ||
"PURL": "pkg:maven/oro/[email protected]" | ||
}, | ||
"Version": "2.0.7", | ||
"Layer": {} | ||
}, | ||
{ | ||
"Name": "struts:struts", | ||
"Identifier": { | ||
"PURL": "pkg:maven/struts/[email protected]" | ||
}, | ||
"Version": "1.2.7", | ||
"Layer": {} | ||
}, | ||
{ | ||
"Name": "commons-beanutils:commons-beanutils", | ||
"Identifier": { | ||
"PURL": "pkg:maven/commons-beanutils/[email protected]" | ||
}, | ||
"Version": "1.7.0", | ||
"Layer": {} | ||
} | ||
|
@@ -459,16 +480,19 @@ var strutsSR = &models.ScanResult{ | |
LockfilePath: "Java", | ||
Libs: []models.Library{ | ||
{ | ||
Name: "commons-beanutils:commons-beanutils", | ||
Version: "1.7.0", | ||
Name: "commons-beanutils:commons-beanutils", | ||
PackageURL: "pkg:maven/commons-beanutils/[email protected]", | ||
Version: "1.7.0", | ||
}, | ||
{ | ||
Name: "oro:oro", | ||
Version: "2.0.7", | ||
Name: "oro:oro", | ||
PackageURL: "pkg:maven/oro/[email protected]", | ||
Version: "2.0.7", | ||
}, | ||
{ | ||
Name: "struts:struts", | ||
Version: "1.2.7", | ||
Name: "struts:struts", | ||
PackageURL: "pkg:maven/struts/[email protected]", | ||
Version: "1.2.7", | ||
}, | ||
}, | ||
}, | ||
|
@@ -540,6 +564,9 @@ var osAndLibTrivy = []byte(` | |
"Packages": [ | ||
{ | ||
"Name": "libgnutls30", | ||
"Identifier": { | ||
"PURL": "pkg:deb/debian/[email protected]?arch=amd64\u0026distro=debian-10.2" | ||
}, | ||
"Version": "3.6.7-4", | ||
"SrcName": "gnutls28", | ||
"SrcVersion": "3.6.7-4", | ||
|
@@ -594,6 +621,9 @@ var osAndLibTrivy = []byte(` | |
"Packages": [ | ||
{ | ||
"Name": "activesupport", | ||
"Identifier": { | ||
"PURL": "pkg:gem/[email protected]" | ||
}, | ||
"Version": "6.0.2.1", | ||
"License": "MIT", | ||
"Layer": { | ||
|
@@ -715,9 +745,10 @@ var osAndLibSR = &models.ScanResult{ | |
LockfilePath: "Ruby", | ||
Libs: []models.Library{ | ||
{ | ||
Name: "activesupport", | ||
Version: "6.0.2.1", | ||
FilePath: "var/lib/gems/2.5.0/specifications/activesupport-6.0.2.1.gemspec", | ||
Name: "activesupport", | ||
Version: "6.0.2.1", | ||
PackageURL: "pkg:gem/[email protected]", | ||
FilePath: "var/lib/gems/2.5.0/specifications/activesupport-6.0.2.1.gemspec", | ||
}, | ||
}, | ||
}, | ||
|
@@ -1010,9 +1041,10 @@ var osAndLib2SR = &models.ScanResult{ | |
LockfilePath: "Ruby", | ||
Libs: []models.Library{ | ||
{ | ||
Name: "activesupport", | ||
Version: "6.0.2.1", | ||
FilePath: "var/lib/gems/2.5.0/specifications/activesupport-6.0.2.1.gemspec", | ||
Name: "activesupport", | ||
Version: "6.0.2.1", | ||
PackageURL: "", | ||
FilePath: "var/lib/gems/2.5.0/specifications/activesupport-6.0.2.1.gemspec", | ||
}, | ||
}, | ||
}, | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -23,17 +23,19 @@ func TestLibraryScanners_Find(t *testing.T) { | |
LockfilePath: "/pathA", | ||
Libs: []Library{ | ||
{ | ||
Name: "libA", | ||
Version: "1.0.0", | ||
Name: "libA", | ||
Version: "1.0.0", | ||
PackageURL: "scheme/type/namespace/[email protected]?qualifiers#subpath", | ||
}, | ||
}, | ||
}, | ||
}, | ||
args: args{"/pathA", "libA"}, | ||
want: map[string]Library{ | ||
"/pathA": { | ||
Name: "libA", | ||
Version: "1.0.0", | ||
Name: "libA", | ||
Version: "1.0.0", | ||
PackageURL: "scheme/type/namespace/[email protected]?qualifiers#subpath", | ||
}, | ||
}, | ||
}, | ||
|
@@ -44,26 +46,29 @@ func TestLibraryScanners_Find(t *testing.T) { | |
LockfilePath: "/pathA", | ||
Libs: []Library{ | ||
{ | ||
Name: "libA", | ||
Version: "1.0.0", | ||
Name: "libA", | ||
Version: "1.0.0", | ||
PackageURL: "scheme/type/namespace/[email protected]?qualifiers#subpath", | ||
}, | ||
}, | ||
}, | ||
{ | ||
LockfilePath: "/pathB", | ||
Libs: []Library{ | ||
{ | ||
Name: "libA", | ||
Version: "1.0.5", | ||
Name: "libA", | ||
Version: "1.0.5", | ||
PackageURL: "scheme/type/namespace/[email protected]?qualifiers#subpath", | ||
}, | ||
}, | ||
}, | ||
}, | ||
args: args{"/pathA", "libA"}, | ||
want: map[string]Library{ | ||
"/pathA": { | ||
Name: "libA", | ||
Version: "1.0.0", | ||
Name: "libA", | ||
Version: "1.0.0", | ||
PackageURL: "scheme/type/namespace/[email protected]?qualifiers#subpath", | ||
}, | ||
}, | ||
}, | ||
|
@@ -74,8 +79,9 @@ func TestLibraryScanners_Find(t *testing.T) { | |
LockfilePath: "/pathA", | ||
Libs: []Library{ | ||
{ | ||
Name: "libA", | ||
Version: "1.0.0", | ||
Name: "libA", | ||
Version: "1.0.0", | ||
PackageURL: "scheme/type/namespace/[email protected]?qualifiers#subpath", | ||
}, | ||
}, | ||
}, | ||
|
This file contains hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.