@@ -30,7 +30,22 @@ import (
3030var _ VulnerabilitiesClient = osvClient {}
3131
3232type osvClient struct {
33- local bool
33+ local bool
34+ requestUserAgent string
35+ }
36+
37+ type OSVConfig struct {
38+ ExperimentalLocal bool
39+ UserAgent string
40+ }
41+
42+ func NewOSVClient (config * OSVConfig ) VulnerabilitiesClient {
43+ cfg := osvClient {}
44+ if config != nil {
45+ cfg .local = config .ExperimentalLocal
46+ cfg .requestUserAgent = config .UserAgent
47+ }
48+ return cfg
3449}
3550
3651// ListUnfixedVulnerabilities implements VulnerabilityClient.ListUnfixedVulnerabilities.
@@ -54,6 +69,12 @@ func (v osvClient) ListUnfixedVulnerabilities(
5469 if commit != "" {
5570 gitCommits = append (gitCommits , commit )
5671 }
72+
73+ exp := osvscanner.ExperimentalScannerActions {
74+ PluginsEnabled : []string {"python/requirements" },
75+ PluginsDisabled : []string {"python/requirementsenhanceable" },
76+ RequestUserAgent : v .requestUserAgent ,
77+ }
5778 res , err := osvscanner .DoScan (osvscanner.ScannerActions {
5879 DirectoryPaths : directoryPaths ,
5980 IncludeGitRoot : false ,
@@ -62,10 +83,7 @@ func (v osvClient) ListUnfixedVulnerabilities(
6283 CompareOffline : v .local ,
6384 DownloadDatabases : v .local ,
6485 // swap out the transitive requirements scanning for offline extractor
65- ExperimentalScannerActions : osvscanner.ExperimentalScannerActions {
66- PluginsEnabled : []string {"python/requirements" },
67- PluginsDisabled : []string {"python/requirementsenhanceable" },
68- },
86+ ExperimentalScannerActions : exp ,
6987 }) // TODO: Do logging?
7088
7189 response := VulnerabilitiesResponse {}
0 commit comments