scanoss 1.31.4__py3-none-any.whl → 1.32.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scanoss/__init__.py +1 -1
- scanoss/api/common/v2/scanoss_common_pb2.py +47 -22
- scanoss/api/common/v2/scanoss_common_pb2_grpc.py +20 -0
- scanoss/api/components/v2/scanoss_components_pb2.py +54 -43
- scanoss/api/components/v2/scanoss_components_pb2_grpc.py +77 -16
- scanoss/api/cryptography/v2/scanoss_cryptography_pb2.py +58 -47
- scanoss/api/cryptography/v2/scanoss_cryptography_pb2_grpc.py +105 -24
- scanoss/api/dependencies/v2/scanoss_dependencies_pb2.py +48 -37
- scanoss/api/dependencies/v2/scanoss_dependencies_pb2_grpc.py +63 -12
- scanoss/api/geoprovenance/v2/scanoss_geoprovenance_pb2.py +42 -31
- scanoss/api/geoprovenance/v2/scanoss_geoprovenance_pb2_grpc.py +63 -12
- scanoss/api/licenses/__init__.py +23 -0
- scanoss/api/licenses/v2/__init__.py +23 -0
- scanoss/api/licenses/v2/scanoss_licenses_pb2.py +84 -0
- scanoss/api/licenses/v2/scanoss_licenses_pb2_grpc.py +302 -0
- scanoss/api/scanning/v2/scanoss_scanning_pb2.py +30 -19
- scanoss/api/scanning/v2/scanoss_scanning_pb2_grpc.py +49 -8
- scanoss/api/semgrep/v2/scanoss_semgrep_pb2.py +34 -23
- scanoss/api/semgrep/v2/scanoss_semgrep_pb2_grpc.py +49 -8
- scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2.py +78 -31
- scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2_grpc.py +282 -18
- scanoss/cli.py +8 -3
- scanoss/components.py +27 -8
- scanoss/data/build_date.txt +1 -1
- scanoss/inspection/dependency_track/project_violation.py +9 -8
- scanoss/scanner.py +3 -0
- scanoss/scanossapi.py +22 -24
- scanoss/scanossgrpc.py +196 -64
- scanoss/services/dependency_track_service.py +1 -1
- scanoss/threadeddependencies.py +19 -18
- {scanoss-1.31.4.dist-info → scanoss-1.32.0.dist-info}/METADATA +2 -1
- {scanoss-1.31.4.dist-info → scanoss-1.32.0.dist-info}/RECORD +36 -32
- {scanoss-1.31.4.dist-info → scanoss-1.32.0.dist-info}/WHEEL +0 -0
- {scanoss-1.31.4.dist-info → scanoss-1.32.0.dist-info}/entry_points.txt +0 -0
- {scanoss-1.31.4.dist-info → scanoss-1.32.0.dist-info}/licenses/LICENSE +0 -0
- {scanoss-1.31.4.dist-info → scanoss-1.32.0.dist-info}/top_level.txt +0 -0
|
@@ -1,14 +1,34 @@
|
|
|
1
1
|
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
2
|
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
3
|
import grpc
|
|
4
|
+
import warnings
|
|
4
5
|
|
|
5
6
|
from scanoss.api.common.v2 import scanoss_common_pb2 as scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2
|
|
6
7
|
from scanoss.api.vulnerabilities.v2 import scanoss_vulnerabilities_pb2 as scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2
|
|
7
8
|
|
|
9
|
+
GRPC_GENERATED_VERSION = '1.73.1'
|
|
10
|
+
GRPC_VERSION = grpc.__version__
|
|
11
|
+
_version_not_supported = False
|
|
12
|
+
|
|
13
|
+
try:
|
|
14
|
+
from grpc._utilities import first_version_is_lower
|
|
15
|
+
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
|
16
|
+
except ImportError:
|
|
17
|
+
_version_not_supported = True
|
|
18
|
+
|
|
19
|
+
if _version_not_supported:
|
|
20
|
+
raise RuntimeError(
|
|
21
|
+
f'The grpc package installed is at version {GRPC_VERSION},'
|
|
22
|
+
+ f' but the generated code in scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2_grpc.py depends on'
|
|
23
|
+
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
|
24
|
+
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
|
25
|
+
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
|
26
|
+
)
|
|
27
|
+
|
|
8
28
|
|
|
9
29
|
class VulnerabilitiesStub(object):
|
|
10
30
|
"""
|
|
11
|
-
|
|
31
|
+
Vulnerability Service Definition
|
|
12
32
|
"""
|
|
13
33
|
|
|
14
34
|
def __init__(self, channel):
|
|
@@ -21,40 +41,125 @@ class VulnerabilitiesStub(object):
|
|
|
21
41
|
'/scanoss.api.vulnerabilities.v2.Vulnerabilities/Echo',
|
|
22
42
|
request_serializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.EchoRequest.SerializeToString,
|
|
23
43
|
response_deserializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.EchoResponse.FromString,
|
|
24
|
-
)
|
|
44
|
+
_registered_method=True)
|
|
25
45
|
self.GetCpes = channel.unary_unary(
|
|
26
46
|
'/scanoss.api.vulnerabilities.v2.Vulnerabilities/GetCpes',
|
|
27
47
|
request_serializer=scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.VulnerabilityRequest.SerializeToString,
|
|
28
48
|
response_deserializer=scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.CpeResponse.FromString,
|
|
29
|
-
)
|
|
49
|
+
_registered_method=True)
|
|
50
|
+
self.GetComponentCpes = channel.unary_unary(
|
|
51
|
+
'/scanoss.api.vulnerabilities.v2.Vulnerabilities/GetComponentCpes',
|
|
52
|
+
request_serializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.ComponentRequest.SerializeToString,
|
|
53
|
+
response_deserializer=scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.ComponentCpesResponse.FromString,
|
|
54
|
+
_registered_method=True)
|
|
55
|
+
self.GetComponentsCpes = channel.unary_unary(
|
|
56
|
+
'/scanoss.api.vulnerabilities.v2.Vulnerabilities/GetComponentsCpes',
|
|
57
|
+
request_serializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.ComponentsRequest.SerializeToString,
|
|
58
|
+
response_deserializer=scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.ComponentsCpesResponse.FromString,
|
|
59
|
+
_registered_method=True)
|
|
30
60
|
self.GetVulnerabilities = channel.unary_unary(
|
|
31
61
|
'/scanoss.api.vulnerabilities.v2.Vulnerabilities/GetVulnerabilities',
|
|
32
62
|
request_serializer=scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.VulnerabilityRequest.SerializeToString,
|
|
33
63
|
response_deserializer=scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.VulnerabilityResponse.FromString,
|
|
34
|
-
)
|
|
64
|
+
_registered_method=True)
|
|
65
|
+
self.GetComponentVulnerabilities = channel.unary_unary(
|
|
66
|
+
'/scanoss.api.vulnerabilities.v2.Vulnerabilities/GetComponentVulnerabilities',
|
|
67
|
+
request_serializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.ComponentRequest.SerializeToString,
|
|
68
|
+
response_deserializer=scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.ComponentVulnerabilityResponse.FromString,
|
|
69
|
+
_registered_method=True)
|
|
70
|
+
self.GetComponentsVulnerabilities = channel.unary_unary(
|
|
71
|
+
'/scanoss.api.vulnerabilities.v2.Vulnerabilities/GetComponentsVulnerabilities',
|
|
72
|
+
request_serializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.ComponentsRequest.SerializeToString,
|
|
73
|
+
response_deserializer=scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.ComponentsVulnerabilityResponse.FromString,
|
|
74
|
+
_registered_method=True)
|
|
35
75
|
|
|
36
76
|
|
|
37
77
|
class VulnerabilitiesServicer(object):
|
|
38
78
|
"""
|
|
39
|
-
|
|
79
|
+
Vulnerability Service Definition
|
|
40
80
|
"""
|
|
41
81
|
|
|
42
82
|
def Echo(self, request, context):
|
|
43
|
-
"""
|
|
83
|
+
"""
|
|
84
|
+
Returns the same message that was sent, used for health checks and connectivity testing
|
|
44
85
|
"""
|
|
45
86
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
46
87
|
context.set_details('Method not implemented!')
|
|
47
88
|
raise NotImplementedError('Method not implemented!')
|
|
48
89
|
|
|
49
90
|
def GetCpes(self, request, context):
|
|
50
|
-
"""
|
|
91
|
+
"""
|
|
92
|
+
Get CPEs (Common Platform Enumeration) associated with a PURL - legacy endpoint.
|
|
93
|
+
|
|
94
|
+
Legacy method for retrieving Common Platform Enumeration identifiers
|
|
95
|
+
associated with software components. Use GetComponentCpes instead.
|
|
96
|
+
"""
|
|
97
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
98
|
+
context.set_details('Method not implemented!')
|
|
99
|
+
raise NotImplementedError('Method not implemented!')
|
|
100
|
+
|
|
101
|
+
def GetComponentCpes(self, request, context):
|
|
102
|
+
"""
|
|
103
|
+
Get CPEs (Common Platform Enumeration) associated with a single software component.
|
|
104
|
+
|
|
105
|
+
Returns Common Platform Enumeration identifiers that match the specified component.
|
|
106
|
+
CPEs are used to identify IT platforms in vulnerability databases and enable
|
|
107
|
+
vulnerability scanning and assessment.
|
|
108
|
+
|
|
109
|
+
See: https://github.com/scanoss/papi/blob/main/protobuf/scanoss/api/vulnerabilities/v2/README.md?tab=readme-ov-file#getcomponentcpes
|
|
110
|
+
"""
|
|
111
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
112
|
+
context.set_details('Method not implemented!')
|
|
113
|
+
raise NotImplementedError('Method not implemented!')
|
|
114
|
+
|
|
115
|
+
def GetComponentsCpes(self, request, context):
|
|
116
|
+
"""
|
|
117
|
+
Get CPEs (Common Platform Enumeration) associated with multiple software components.
|
|
118
|
+
|
|
119
|
+
Returns Common Platform Enumeration identifiers for multiple components in a single request.
|
|
120
|
+
CPEs are used to identify IT platforms in vulnerability databases and enable
|
|
121
|
+
vulnerability scanning and assessment.
|
|
122
|
+
|
|
123
|
+
See: https://github.com/scanoss/papi/blob/main/protobuf/scanoss/api/vulnerabilities/v2/README.md?tab=readme-ov-file#getcomponentscpes
|
|
51
124
|
"""
|
|
52
125
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
53
126
|
context.set_details('Method not implemented!')
|
|
54
127
|
raise NotImplementedError('Method not implemented!')
|
|
55
128
|
|
|
56
129
|
def GetVulnerabilities(self, request, context):
|
|
57
|
-
"""
|
|
130
|
+
"""
|
|
131
|
+
Get vulnerability details - legacy endpoint.
|
|
132
|
+
|
|
133
|
+
Legacy method for retrieving vulnerability information for software components.
|
|
134
|
+
Use GetComponentVulnerabilities or GetComponentsVulnerabilities instead.
|
|
135
|
+
"""
|
|
136
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
137
|
+
context.set_details('Method not implemented!')
|
|
138
|
+
raise NotImplementedError('Method not implemented!')
|
|
139
|
+
|
|
140
|
+
def GetComponentVulnerabilities(self, request, context):
|
|
141
|
+
"""
|
|
142
|
+
Get vulnerability information for a single software component.
|
|
143
|
+
|
|
144
|
+
Analyzes the component and returns known vulnerabilities including CVE details,
|
|
145
|
+
severity scores, publication dates, and other security metadata.
|
|
146
|
+
Vulnerability data is sourced from various security databases and feeds.
|
|
147
|
+
|
|
148
|
+
See: https://github.com/scanoss/papi/blob/main/protobuf/scanoss/api/vulnerabilities/v2/README.md?tab=readme-ov-file#getcomponentvulnerabilities
|
|
149
|
+
"""
|
|
150
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
151
|
+
context.set_details('Method not implemented!')
|
|
152
|
+
raise NotImplementedError('Method not implemented!')
|
|
153
|
+
|
|
154
|
+
def GetComponentsVulnerabilities(self, request, context):
|
|
155
|
+
"""
|
|
156
|
+
Get vulnerability information for multiple software components in a single request.
|
|
157
|
+
|
|
158
|
+
Analyzes multiple components and returns known vulnerabilities for each including CVE details,
|
|
159
|
+
severity scores, publication dates, and other security metadata.
|
|
160
|
+
Vulnerability data is sourced from various security databases and feeds.
|
|
161
|
+
|
|
162
|
+
See: https://github.com/scanoss/papi/blob/main/protobuf/scanoss/api/vulnerabilities/v2/README.md?tab=readme-ov-file#getcomponentsvulnerabilities
|
|
58
163
|
"""
|
|
59
164
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
60
165
|
context.set_details('Method not implemented!')
|
|
@@ -73,21 +178,42 @@ def add_VulnerabilitiesServicer_to_server(servicer, server):
|
|
|
73
178
|
request_deserializer=scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.VulnerabilityRequest.FromString,
|
|
74
179
|
response_serializer=scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.CpeResponse.SerializeToString,
|
|
75
180
|
),
|
|
181
|
+
'GetComponentCpes': grpc.unary_unary_rpc_method_handler(
|
|
182
|
+
servicer.GetComponentCpes,
|
|
183
|
+
request_deserializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.ComponentRequest.FromString,
|
|
184
|
+
response_serializer=scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.ComponentCpesResponse.SerializeToString,
|
|
185
|
+
),
|
|
186
|
+
'GetComponentsCpes': grpc.unary_unary_rpc_method_handler(
|
|
187
|
+
servicer.GetComponentsCpes,
|
|
188
|
+
request_deserializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.ComponentsRequest.FromString,
|
|
189
|
+
response_serializer=scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.ComponentsCpesResponse.SerializeToString,
|
|
190
|
+
),
|
|
76
191
|
'GetVulnerabilities': grpc.unary_unary_rpc_method_handler(
|
|
77
192
|
servicer.GetVulnerabilities,
|
|
78
193
|
request_deserializer=scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.VulnerabilityRequest.FromString,
|
|
79
194
|
response_serializer=scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.VulnerabilityResponse.SerializeToString,
|
|
80
195
|
),
|
|
196
|
+
'GetComponentVulnerabilities': grpc.unary_unary_rpc_method_handler(
|
|
197
|
+
servicer.GetComponentVulnerabilities,
|
|
198
|
+
request_deserializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.ComponentRequest.FromString,
|
|
199
|
+
response_serializer=scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.ComponentVulnerabilityResponse.SerializeToString,
|
|
200
|
+
),
|
|
201
|
+
'GetComponentsVulnerabilities': grpc.unary_unary_rpc_method_handler(
|
|
202
|
+
servicer.GetComponentsVulnerabilities,
|
|
203
|
+
request_deserializer=scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.ComponentsRequest.FromString,
|
|
204
|
+
response_serializer=scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.ComponentsVulnerabilityResponse.SerializeToString,
|
|
205
|
+
),
|
|
81
206
|
}
|
|
82
207
|
generic_handler = grpc.method_handlers_generic_handler(
|
|
83
208
|
'scanoss.api.vulnerabilities.v2.Vulnerabilities', rpc_method_handlers)
|
|
84
209
|
server.add_generic_rpc_handlers((generic_handler,))
|
|
210
|
+
server.add_registered_method_handlers('scanoss.api.vulnerabilities.v2.Vulnerabilities', rpc_method_handlers)
|
|
85
211
|
|
|
86
212
|
|
|
87
213
|
# This class is part of an EXPERIMENTAL API.
|
|
88
214
|
class Vulnerabilities(object):
|
|
89
215
|
"""
|
|
90
|
-
|
|
216
|
+
Vulnerability Service Definition
|
|
91
217
|
"""
|
|
92
218
|
|
|
93
219
|
@staticmethod
|
|
@@ -101,11 +227,21 @@ class Vulnerabilities(object):
|
|
|
101
227
|
wait_for_ready=None,
|
|
102
228
|
timeout=None,
|
|
103
229
|
metadata=None):
|
|
104
|
-
return grpc.experimental.unary_unary(
|
|
230
|
+
return grpc.experimental.unary_unary(
|
|
231
|
+
request,
|
|
232
|
+
target,
|
|
233
|
+
'/scanoss.api.vulnerabilities.v2.Vulnerabilities/Echo',
|
|
105
234
|
scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.EchoRequest.SerializeToString,
|
|
106
235
|
scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.EchoResponse.FromString,
|
|
107
|
-
options,
|
|
108
|
-
|
|
236
|
+
options,
|
|
237
|
+
channel_credentials,
|
|
238
|
+
insecure,
|
|
239
|
+
call_credentials,
|
|
240
|
+
compression,
|
|
241
|
+
wait_for_ready,
|
|
242
|
+
timeout,
|
|
243
|
+
metadata,
|
|
244
|
+
_registered_method=True)
|
|
109
245
|
|
|
110
246
|
@staticmethod
|
|
111
247
|
def GetCpes(request,
|
|
@@ -118,11 +254,75 @@ class Vulnerabilities(object):
|
|
|
118
254
|
wait_for_ready=None,
|
|
119
255
|
timeout=None,
|
|
120
256
|
metadata=None):
|
|
121
|
-
return grpc.experimental.unary_unary(
|
|
257
|
+
return grpc.experimental.unary_unary(
|
|
258
|
+
request,
|
|
259
|
+
target,
|
|
260
|
+
'/scanoss.api.vulnerabilities.v2.Vulnerabilities/GetCpes',
|
|
122
261
|
scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.VulnerabilityRequest.SerializeToString,
|
|
123
262
|
scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.CpeResponse.FromString,
|
|
124
|
-
options,
|
|
125
|
-
|
|
263
|
+
options,
|
|
264
|
+
channel_credentials,
|
|
265
|
+
insecure,
|
|
266
|
+
call_credentials,
|
|
267
|
+
compression,
|
|
268
|
+
wait_for_ready,
|
|
269
|
+
timeout,
|
|
270
|
+
metadata,
|
|
271
|
+
_registered_method=True)
|
|
272
|
+
|
|
273
|
+
@staticmethod
|
|
274
|
+
def GetComponentCpes(request,
|
|
275
|
+
target,
|
|
276
|
+
options=(),
|
|
277
|
+
channel_credentials=None,
|
|
278
|
+
call_credentials=None,
|
|
279
|
+
insecure=False,
|
|
280
|
+
compression=None,
|
|
281
|
+
wait_for_ready=None,
|
|
282
|
+
timeout=None,
|
|
283
|
+
metadata=None):
|
|
284
|
+
return grpc.experimental.unary_unary(
|
|
285
|
+
request,
|
|
286
|
+
target,
|
|
287
|
+
'/scanoss.api.vulnerabilities.v2.Vulnerabilities/GetComponentCpes',
|
|
288
|
+
scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.ComponentRequest.SerializeToString,
|
|
289
|
+
scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.ComponentCpesResponse.FromString,
|
|
290
|
+
options,
|
|
291
|
+
channel_credentials,
|
|
292
|
+
insecure,
|
|
293
|
+
call_credentials,
|
|
294
|
+
compression,
|
|
295
|
+
wait_for_ready,
|
|
296
|
+
timeout,
|
|
297
|
+
metadata,
|
|
298
|
+
_registered_method=True)
|
|
299
|
+
|
|
300
|
+
@staticmethod
|
|
301
|
+
def GetComponentsCpes(request,
|
|
302
|
+
target,
|
|
303
|
+
options=(),
|
|
304
|
+
channel_credentials=None,
|
|
305
|
+
call_credentials=None,
|
|
306
|
+
insecure=False,
|
|
307
|
+
compression=None,
|
|
308
|
+
wait_for_ready=None,
|
|
309
|
+
timeout=None,
|
|
310
|
+
metadata=None):
|
|
311
|
+
return grpc.experimental.unary_unary(
|
|
312
|
+
request,
|
|
313
|
+
target,
|
|
314
|
+
'/scanoss.api.vulnerabilities.v2.Vulnerabilities/GetComponentsCpes',
|
|
315
|
+
scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.ComponentsRequest.SerializeToString,
|
|
316
|
+
scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.ComponentsCpesResponse.FromString,
|
|
317
|
+
options,
|
|
318
|
+
channel_credentials,
|
|
319
|
+
insecure,
|
|
320
|
+
call_credentials,
|
|
321
|
+
compression,
|
|
322
|
+
wait_for_ready,
|
|
323
|
+
timeout,
|
|
324
|
+
metadata,
|
|
325
|
+
_registered_method=True)
|
|
126
326
|
|
|
127
327
|
@staticmethod
|
|
128
328
|
def GetVulnerabilities(request,
|
|
@@ -135,8 +335,72 @@ class Vulnerabilities(object):
|
|
|
135
335
|
wait_for_ready=None,
|
|
136
336
|
timeout=None,
|
|
137
337
|
metadata=None):
|
|
138
|
-
return grpc.experimental.unary_unary(
|
|
338
|
+
return grpc.experimental.unary_unary(
|
|
339
|
+
request,
|
|
340
|
+
target,
|
|
341
|
+
'/scanoss.api.vulnerabilities.v2.Vulnerabilities/GetVulnerabilities',
|
|
139
342
|
scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.VulnerabilityRequest.SerializeToString,
|
|
140
343
|
scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.VulnerabilityResponse.FromString,
|
|
141
|
-
options,
|
|
142
|
-
|
|
344
|
+
options,
|
|
345
|
+
channel_credentials,
|
|
346
|
+
insecure,
|
|
347
|
+
call_credentials,
|
|
348
|
+
compression,
|
|
349
|
+
wait_for_ready,
|
|
350
|
+
timeout,
|
|
351
|
+
metadata,
|
|
352
|
+
_registered_method=True)
|
|
353
|
+
|
|
354
|
+
@staticmethod
|
|
355
|
+
def GetComponentVulnerabilities(request,
|
|
356
|
+
target,
|
|
357
|
+
options=(),
|
|
358
|
+
channel_credentials=None,
|
|
359
|
+
call_credentials=None,
|
|
360
|
+
insecure=False,
|
|
361
|
+
compression=None,
|
|
362
|
+
wait_for_ready=None,
|
|
363
|
+
timeout=None,
|
|
364
|
+
metadata=None):
|
|
365
|
+
return grpc.experimental.unary_unary(
|
|
366
|
+
request,
|
|
367
|
+
target,
|
|
368
|
+
'/scanoss.api.vulnerabilities.v2.Vulnerabilities/GetComponentVulnerabilities',
|
|
369
|
+
scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.ComponentRequest.SerializeToString,
|
|
370
|
+
scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.ComponentVulnerabilityResponse.FromString,
|
|
371
|
+
options,
|
|
372
|
+
channel_credentials,
|
|
373
|
+
insecure,
|
|
374
|
+
call_credentials,
|
|
375
|
+
compression,
|
|
376
|
+
wait_for_ready,
|
|
377
|
+
timeout,
|
|
378
|
+
metadata,
|
|
379
|
+
_registered_method=True)
|
|
380
|
+
|
|
381
|
+
@staticmethod
|
|
382
|
+
def GetComponentsVulnerabilities(request,
|
|
383
|
+
target,
|
|
384
|
+
options=(),
|
|
385
|
+
channel_credentials=None,
|
|
386
|
+
call_credentials=None,
|
|
387
|
+
insecure=False,
|
|
388
|
+
compression=None,
|
|
389
|
+
wait_for_ready=None,
|
|
390
|
+
timeout=None,
|
|
391
|
+
metadata=None):
|
|
392
|
+
return grpc.experimental.unary_unary(
|
|
393
|
+
request,
|
|
394
|
+
target,
|
|
395
|
+
'/scanoss.api.vulnerabilities.v2.Vulnerabilities/GetComponentsVulnerabilities',
|
|
396
|
+
scanoss_dot_api_dot_common_dot_v2_dot_scanoss__common__pb2.ComponentsRequest.SerializeToString,
|
|
397
|
+
scanoss_dot_api_dot_vulnerabilities_dot_v2_dot_scanoss__vulnerabilities__pb2.ComponentsVulnerabilityResponse.FromString,
|
|
398
|
+
options,
|
|
399
|
+
channel_credentials,
|
|
400
|
+
insecure,
|
|
401
|
+
call_credentials,
|
|
402
|
+
compression,
|
|
403
|
+
wait_for_ready,
|
|
404
|
+
timeout,
|
|
405
|
+
metadata,
|
|
406
|
+
_registered_method=True)
|
scanoss/cli.py
CHANGED
|
@@ -308,6 +308,7 @@ def setup_args() -> None: # noqa: PLR0912, PLR0915
|
|
|
308
308
|
help='Retrieve vulnerabilities for the given components',
|
|
309
309
|
)
|
|
310
310
|
c_vulns.set_defaults(func=comp_vulns)
|
|
311
|
+
c_vulns.add_argument('--grpc', action='store_true', help='Enable gRPC support')
|
|
311
312
|
|
|
312
313
|
# Component Sub-command: component semgrep
|
|
313
314
|
c_semgrep = comp_sub.add_parser(
|
|
@@ -796,9 +797,9 @@ def setup_args() -> None: # noqa: PLR0912, PLR0915
|
|
|
796
797
|
p_inspect_dt_project_violation.add_argument(
|
|
797
798
|
'--format', '-f',
|
|
798
799
|
required=False,
|
|
799
|
-
choices=['json', 'md'],
|
|
800
|
+
choices=['json', 'md', 'jira_md'],
|
|
800
801
|
default='json',
|
|
801
|
-
help='Output format: json (default) or
|
|
802
|
+
help='Output format: json (default), md (Markdown) or jira_md (JIRA Markdown)'
|
|
802
803
|
)
|
|
803
804
|
p_inspect_dt_project_violation.add_argument(
|
|
804
805
|
'--timeout', '-M',
|
|
@@ -964,7 +965,7 @@ def setup_args() -> None: # noqa: PLR0912, PLR0915
|
|
|
964
965
|
p.add_argument(
|
|
965
966
|
'--apiurl', type=str, help='SCANOSS API URL (optional - default: https://api.osskb.org/scan/direct)'
|
|
966
967
|
)
|
|
967
|
-
p.add_argument('--
|
|
968
|
+
p.add_argument('--grpc', action='store_true', help='Enable gRPC support')
|
|
968
969
|
|
|
969
970
|
# Global Scan/Fingerprint filter options
|
|
970
971
|
for p in [p_scan, p_wfp]:
|
|
@@ -1055,6 +1056,7 @@ def setup_args() -> None: # noqa: PLR0912, PLR0915
|
|
|
1055
1056
|
type=str,
|
|
1056
1057
|
help='Headers to be sent on request (e.g., -hdr "Name: Value") - can be used multiple times',
|
|
1057
1058
|
)
|
|
1059
|
+
p.add_argument('--ignore-cert-errors', action='store_true', help='Ignore certificate errors')
|
|
1058
1060
|
|
|
1059
1061
|
# Syft options
|
|
1060
1062
|
for p in [p_cs, p_dep]:
|
|
@@ -1418,6 +1420,7 @@ def scan(parser, args): # noqa: PLR0912, PLR0915
|
|
|
1418
1420
|
strip_snippet_ids=args.strip_snippet,
|
|
1419
1421
|
scan_settings=scan_settings,
|
|
1420
1422
|
req_headers=process_req_headers(args.header),
|
|
1423
|
+
use_grpc=args.grpc
|
|
1421
1424
|
)
|
|
1422
1425
|
if args.wfp:
|
|
1423
1426
|
if not scanner.is_file_or_snippet_scan():
|
|
@@ -2144,6 +2147,8 @@ def comp_vulns(parser, args):
|
|
|
2144
2147
|
pac=pac_file,
|
|
2145
2148
|
timeout=args.timeout,
|
|
2146
2149
|
req_headers=process_req_headers(args.header),
|
|
2150
|
+
ignore_cert_errors=args.ignore_cert_errors,
|
|
2151
|
+
use_grpc=args.grpc,
|
|
2147
2152
|
)
|
|
2148
2153
|
if not comps.get_vulnerabilities(args.input, args.purl, args.output):
|
|
2149
2154
|
sys.exit(1)
|
scanoss/components.py
CHANGED
|
@@ -52,6 +52,8 @@ class Components(ScanossBase):
|
|
|
52
52
|
ca_cert: str = None,
|
|
53
53
|
pac: PACFile = None,
|
|
54
54
|
req_headers: dict = None,
|
|
55
|
+
ignore_cert_errors: bool = False,
|
|
56
|
+
use_grpc: bool = False,
|
|
55
57
|
):
|
|
56
58
|
"""
|
|
57
59
|
Handle all component style requests
|
|
@@ -66,6 +68,9 @@ class Components(ScanossBase):
|
|
|
66
68
|
:param grpc_proxy: Specific gRPC proxy (optional)
|
|
67
69
|
:param ca_cert: TLS client certificate (optional)
|
|
68
70
|
:param pac: Proxy Auto-Config file (optional)
|
|
71
|
+
:param req_headers: Additional headers to send with requests (optional)
|
|
72
|
+
:param ignore_cert_errors: Ignore TLS certificate errors (optional)
|
|
73
|
+
:param use_grpc: Use gRPC instead of HTTP (optional)
|
|
69
74
|
"""
|
|
70
75
|
super().__init__(debug, trace, quiet)
|
|
71
76
|
ver_details = Scanner.version_details()
|
|
@@ -82,14 +87,28 @@ class Components(ScanossBase):
|
|
|
82
87
|
grpc_proxy=grpc_proxy,
|
|
83
88
|
timeout=timeout,
|
|
84
89
|
req_headers=req_headers,
|
|
90
|
+
ignore_cert_errors=ignore_cert_errors,
|
|
91
|
+
use_grpc=use_grpc,
|
|
85
92
|
)
|
|
86
93
|
|
|
87
|
-
def
|
|
94
|
+
def load_comps(self, json_file: Optional[str] = None, purls: Optional[List[str]] = None)-> Optional[dict]:
|
|
95
|
+
"""
|
|
96
|
+
Load the specified components and return a dictionary
|
|
97
|
+
|
|
98
|
+
:param json_file: JSON Components file (optional)
|
|
99
|
+
:param purls: list pf PURLs (optional)
|
|
100
|
+
:return: Components Request dictionary or None
|
|
101
|
+
"""
|
|
102
|
+
return self.load_purls(json_file, purls, 'components')
|
|
103
|
+
|
|
104
|
+
def load_purls(self, json_file: Optional[str] = None, purls: Optional[List[str]] = None, field:str = 'purls'
|
|
105
|
+
) -> Optional[dict]:
|
|
88
106
|
"""
|
|
89
107
|
Load the specified purls and return a dictionary
|
|
90
108
|
|
|
91
109
|
:param json_file: JSON PURL file (optional)
|
|
92
110
|
:param purls: list of PURLs (optional)
|
|
111
|
+
:param field: Name of the dictionary field to store the purls in (default: 'purls')
|
|
93
112
|
:return: PURL Request dictionary or None
|
|
94
113
|
"""
|
|
95
114
|
if json_file:
|
|
@@ -109,14 +128,14 @@ class Components(ScanossBase):
|
|
|
109
128
|
parsed_purls = []
|
|
110
129
|
for p in purls:
|
|
111
130
|
parsed_purls.append({'purl': p})
|
|
112
|
-
purl_request = {
|
|
131
|
+
purl_request = {field: parsed_purls}
|
|
113
132
|
else:
|
|
114
133
|
self.print_stderr('ERROR: No purls specified to process.')
|
|
115
134
|
return None
|
|
116
|
-
purl_count = len(purl_request.get(
|
|
117
|
-
self.print_debug(f'Parsed
|
|
135
|
+
purl_count = len(purl_request.get(field, []))
|
|
136
|
+
self.print_debug(f'Parsed {field} ({purl_count}): {purl_request}')
|
|
118
137
|
if purl_count == 0:
|
|
119
|
-
self.print_stderr('ERROR: No
|
|
138
|
+
self.print_stderr(f'ERROR: No {field} parsed from request.')
|
|
120
139
|
return None
|
|
121
140
|
return purl_request
|
|
122
141
|
|
|
@@ -142,8 +161,8 @@ class Components(ScanossBase):
|
|
|
142
161
|
"""
|
|
143
162
|
Open the given filename if requested, otherwise return STDOUT
|
|
144
163
|
|
|
145
|
-
:param filename:
|
|
146
|
-
:return:
|
|
164
|
+
:param filename: filename to open or None to return STDOUT
|
|
165
|
+
:return: file descriptor or None
|
|
147
166
|
"""
|
|
148
167
|
file = sys.stdout
|
|
149
168
|
if filename:
|
|
@@ -202,7 +221,7 @@ class Components(ScanossBase):
|
|
|
202
221
|
:return: True on success, False otherwise
|
|
203
222
|
"""
|
|
204
223
|
success = False
|
|
205
|
-
purls_request = self.
|
|
224
|
+
purls_request = self.load_comps(json_file, purls)
|
|
206
225
|
if purls_request is None or len(purls_request) == 0:
|
|
207
226
|
return False
|
|
208
227
|
file = self._open_file_or_sdtout(output_file)
|
scanoss/data/build_date.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
date:
|
|
1
|
+
date: 20250901122016, utime: 1756729216
|
|
@@ -34,7 +34,6 @@ PROCESSING_RETRY_DELAY = 5 # seconds
|
|
|
34
34
|
DEFAULT_TIME_OUT = 300.0
|
|
35
35
|
MILLISECONDS_TO_SECONDS = 1000
|
|
36
36
|
|
|
37
|
-
|
|
38
37
|
"""
|
|
39
38
|
Dependency Track project violation policy check implementation.
|
|
40
39
|
|
|
@@ -43,6 +42,7 @@ It retrieves, processes, and formats policy violations from a Dependency Track i
|
|
|
43
42
|
for a specific project.
|
|
44
43
|
"""
|
|
45
44
|
|
|
45
|
+
|
|
46
46
|
class ResolvedLicenseDict(TypedDict):
|
|
47
47
|
"""TypedDict for resolved license information from Dependency Track."""
|
|
48
48
|
uuid: str
|
|
@@ -125,7 +125,7 @@ class DependencyTrackProjectViolationPolicyCheck(PolicyCheck[PolicyViolationDict
|
|
|
125
125
|
This class handles retrieving, processing, and formatting policy violations
|
|
126
126
|
from a Dependency Track instance for a specific project.
|
|
127
127
|
"""
|
|
128
|
-
|
|
128
|
+
|
|
129
129
|
def __init__( # noqa: PLR0913
|
|
130
130
|
self,
|
|
131
131
|
debug: bool = False,
|
|
@@ -161,13 +161,13 @@ class DependencyTrackProjectViolationPolicyCheck(PolicyCheck[PolicyViolationDict
|
|
|
161
161
|
timeout: Timeout for processing in seconds (default: 300)
|
|
162
162
|
"""
|
|
163
163
|
super().__init__(debug, trace, quiet, format_type, status, 'dependency-track', output)
|
|
164
|
-
self.url = url
|
|
165
164
|
self.api_key = api_key
|
|
166
165
|
self.project_id = project_id
|
|
167
166
|
self.project_name = project_name
|
|
168
167
|
self.project_version = project_version
|
|
169
168
|
self.upload_token = upload_token
|
|
170
169
|
self.timeout = timeout
|
|
170
|
+
self.url = url.strip().rstrip('/') if url else None
|
|
171
171
|
self.dep_track_service = DependencyTrackService(self.api_key, self.url, debug=debug, trace=trace, quiet=quiet)
|
|
172
172
|
|
|
173
173
|
def _json(self, project_violations: list[PolicyViolationDict]) -> Dict[str, Any]:
|
|
@@ -230,7 +230,7 @@ class DependencyTrackProjectViolationPolicyCheck(PolicyCheck[PolicyViolationDict
|
|
|
230
230
|
if not dt_project:
|
|
231
231
|
self.print_stderr('Warning: No project details supplied. Returning False.')
|
|
232
232
|
return False
|
|
233
|
-
|
|
233
|
+
|
|
234
234
|
# Safely extract and normalise timestamp values to numeric types
|
|
235
235
|
def _safe_timestamp(field, value=None, default=0) -> float:
|
|
236
236
|
"""Convert timestamp value to float, handling string/numeric types safely."""
|
|
@@ -241,7 +241,7 @@ class DependencyTrackProjectViolationPolicyCheck(PolicyCheck[PolicyViolationDict
|
|
|
241
241
|
except (ValueError, TypeError):
|
|
242
242
|
self.print_stderr(f'Warning: Invalid timestamp for {field}, value: {value}, using default: {default}')
|
|
243
243
|
return float(default)
|
|
244
|
-
|
|
244
|
+
|
|
245
245
|
last_import = _safe_timestamp('lastBomImport', dt_project.get('lastBomImport'), 0)
|
|
246
246
|
last_vulnerability_analysis = _safe_timestamp('lastVulnerabilityAnalysis',
|
|
247
247
|
dt_project.get('lastVulnerabilityAnalysis'), 0
|
|
@@ -372,7 +372,7 @@ class DependencyTrackProjectViolationPolicyCheck(PolicyCheck[PolicyViolationDict
|
|
|
372
372
|
"""
|
|
373
373
|
type_priority = {'SECURITY': 3, 'LICENSE': 2, 'OTHER': 1}
|
|
374
374
|
return sorted(
|
|
375
|
-
violations,
|
|
375
|
+
violations,
|
|
376
376
|
key=lambda x: -type_priority.get(x.get('type', 'OTHER'), 1)
|
|
377
377
|
)
|
|
378
378
|
|
|
@@ -424,8 +424,9 @@ class DependencyTrackProjectViolationPolicyCheck(PolicyCheck[PolicyViolationDict
|
|
|
424
424
|
rows.append(row)
|
|
425
425
|
# End for loop
|
|
426
426
|
return {
|
|
427
|
-
"details": f'### Dependency Track Project Violations\n{table_generator(headers, rows, c_cols)}\n'
|
|
428
|
-
|
|
427
|
+
"details": f'### Dependency Track Project Violations\n{table_generator(headers, rows, c_cols)}\n\n'
|
|
428
|
+
f'View project in Dependency Track [here]({self.url}/projects/{self.project_id}).\n',
|
|
429
|
+
"summary": f'{len(project_violations)} policy violations were found.\n'
|
|
429
430
|
}
|
|
430
431
|
|
|
431
432
|
def run(self) -> int:
|
scanoss/scanner.py
CHANGED
|
@@ -107,6 +107,7 @@ class Scanner(ScanossBase):
|
|
|
107
107
|
skip_md5_ids=None,
|
|
108
108
|
scan_settings: 'ScanossSettings | None' = None,
|
|
109
109
|
req_headers: dict = None,
|
|
110
|
+
use_grpc: bool = False,
|
|
110
111
|
):
|
|
111
112
|
"""
|
|
112
113
|
Initialise scanning class, including Winnowing, ScanossApi, ThreadedScanning
|
|
@@ -173,6 +174,8 @@ class Scanner(ScanossBase):
|
|
|
173
174
|
pac=pac,
|
|
174
175
|
grpc_proxy=grpc_proxy,
|
|
175
176
|
req_headers=self.req_headers,
|
|
177
|
+
ignore_cert_errors=ignore_cert_errors,
|
|
178
|
+
use_grpc=use_grpc
|
|
176
179
|
)
|
|
177
180
|
self.threaded_deps = ThreadedDependencies(sc_deps, grpc_api, debug=debug, quiet=quiet, trace=trace)
|
|
178
181
|
self.nb_threads = nb_threads
|