Skip to content

Commit

Permalink
test(table): use relationships
Browse files Browse the repository at this point in the history
Signed-off-by: knqyf263 <[email protected]>
  • Loading branch information
knqyf263 committed Apr 26, 2024
1 parent 5e620b0 commit a0667ed
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 36 deletions.
2 changes: 1 addition & 1 deletion pkg/fanal/types/artifact.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ type Package struct {
Modularitylabel string `json:",omitempty"` // only for Red Hat based distributions
BuildInfo *BuildInfo `json:",omitempty"` // only for Red Hat

Indirect bool `json:",omitempty"` // Deprecated: Use relationship
Indirect bool `json:",omitempty"` // Deprecated: Use relationship. Kept for backward compatibility.
Relationship Relationship `json:",omitempty"`

// Dependencies of this package
Expand Down
72 changes: 37 additions & 35 deletions pkg/report/table/vulnerability_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,38 +171,40 @@ Total: 1 (MEDIUM: 0, HIGH: 1)
Type: "npm",
Packages: []ftypes.Package{
{
ID: "[email protected]",
Name: "node-fetch",
Version: "1.7.3",
Indirect: true,
ID: "[email protected]",
Name: "node-fetch",
Version: "1.7.3",
Relationship: ftypes.RelationshipIndirect,
},
{
ID: "[email protected]",
Name: "isomorphic-fetch",
Version: "2.2.1",
Indirect: true,
ID: "[email protected]",
Name: "isomorphic-fetch",
Version: "2.2.1",
Relationship: ftypes.RelationshipIndirect,
DependsOn: []string{
"[email protected]",
},
},
{
ID: "[email protected]",
Name: "fbjs",
Version: "0.8.18",
Indirect: true,
ID: "[email protected]",
Name: "fbjs",
Version: "0.8.18",
Relationship: ftypes.RelationshipIndirect,
DependsOn: []string{
"[email protected]",
},
},
{
ID: "[email protected]",
Name: "sanitize-html",
Version: "1.20.0",
ID: "[email protected]",
Name: "sanitize-html",
Version: "1.20.0",
Relationship: ftypes.RelationshipDirect,
},
{
ID: "[email protected]",
Name: "styled-components",
Version: "3.1.3",
ID: "[email protected]",
Name: "styled-components",
Version: "3.1.3",
Relationship: ftypes.RelationshipDirect,
DependsOn: []string{
"[email protected]",
},
Expand Down Expand Up @@ -260,41 +262,41 @@ package-lock.json
`,
},
{
name: "happy path with vulnerability origin graph without direct dependency info",
name: "happy path with vulnerability origin graph with unknown relationships",
result: types.Result{
Target: "package-lock.json",
Class: types.ClassLangPkg,
Type: "npm",
Packages: []ftypes.Package{
{
ID: "[email protected]",
Name: "node-fetch",
Version: "1.7.3",
Indirect: true,
ID: "[email protected]",
Name: "node-fetch",
Version: "1.7.3",
Relationship: ftypes.RelationshipUnknown,
},
{
ID: "[email protected]",
Name: "isomorphic-fetch",
Version: "2.2.1",
Indirect: true,
ID: "[email protected]",
Name: "isomorphic-fetch",
Version: "2.2.1",
Relationship: ftypes.RelationshipUnknown,
DependsOn: []string{
"[email protected]",
},
},
{
ID: "[email protected]",
Name: "fbjs",
Version: "0.8.18",
Indirect: true,
ID: "[email protected]",
Name: "fbjs",
Version: "0.8.18",
Relationship: ftypes.RelationshipUnknown,
DependsOn: []string{
"[email protected]",
},
},
{
ID: "[email protected]",
Name: "styled-components",
Version: "3.1.3",
Indirect: true,
ID: "[email protected]",
Name: "styled-components",
Version: "3.1.3",
Relationship: ftypes.RelationshipUnknown,
DependsOn: []string{
"[email protected]",
},
Expand Down

0 comments on commit a0667ed

Please sign in to comment.