Skip to content

Commit

Permalink
refactor: delete ListAllPackages
Browse files Browse the repository at this point in the history
Since packages are always included and filtered out on the client side,
we don't havd to send ListAllPackages to the server.

Signed-off-by: knqyf263 <[email protected]>
  • Loading branch information
knqyf263 committed May 28, 2024
1 parent 5ff1a3d commit bc1c51e
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 122 deletions.
1 change: 0 additions & 1 deletion pkg/rpc/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ func (s Scanner) Scan(ctx context.Context, target, artifactKey string, blobKeys
Options: &rpc.ScanOptions{
VulnType: opts.VulnType,
Scanners: xstrings.ToStringSlice(opts.Scanners),
ListAllPackages: opts.ListAllPackages,
LicenseCategories: licenseCategories,
IncludeDevDeps: opts.IncludeDevDeps,
},
Expand Down
5 changes: 2 additions & 3 deletions pkg/scanner/local/scan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,8 @@ func TestScanner_Scan(t *testing.T) {
target: "./result.cdx",
layerIDs: []string{"sha256:5216338b40a7b96416b8b9858974bbe4acc3096ee60acbc4dfb1ee02aecceb10"},
options: types.ScanOptions{
VulnType: []string{types.VulnTypeLibrary},
Scanners: types.Scanners{types.VulnerabilityScanner},
ListAllPackages: true,
VulnType: []string{types.VulnTypeLibrary},
Scanners: types.Scanners{types.VulnerabilityScanner},
},
},
fixtures: []string{"testdata/fixtures/happy.yaml"},
Expand Down
1 change: 0 additions & 1 deletion pkg/types/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ type ScanOptions struct {
Scanners Scanners
ImageConfigScanners Scanners // Scanners for container image configuration
ScanRemovedPackages bool
ListAllPackages bool
LicenseCategories map[types.LicenseCategory][]string
FilePatterns []string
IncludeDevDeps bool
Expand Down
136 changes: 63 additions & 73 deletions rpc/scanner/service.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion rpc/scanner/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ message Licenses {
message ScanOptions {
repeated string vuln_type = 1;
repeated string scanners = 2;
bool list_all_packages = 3;
map<string, Licenses> license_categories = 4;
bool include_dev_deps = 5;

reserved 3; // deleted 'list_all_packages'
}

message ScanResponse {
Expand Down
Loading

0 comments on commit bc1c51e

Please sign in to comment.