scanoss 1.19.6__py3-none-any.whl → 1.20.1__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.
- protoc_gen_swagger/__init__.py +13 -13
- protoc_gen_swagger/options/__init__.py +13 -13
- protoc_gen_swagger/options/annotations_pb2.py +12 -9
- protoc_gen_swagger/options/annotations_pb2_grpc.py +1 -1
- protoc_gen_swagger/options/openapiv2_pb2.py +98 -96
- protoc_gen_swagger/options/openapiv2_pb2_grpc.py +1 -1
- scanoss/__init__.py +18 -18
- scanoss/api/__init__.py +17 -17
- scanoss/api/common/__init__.py +17 -17
- scanoss/api/common/v2/__init__.py +17 -17
- scanoss/api/common/v2/scanoss_common_pb2.py +18 -18
- scanoss/api/common/v2/scanoss_common_pb2_grpc.py +1 -1
- scanoss/api/components/__init__.py +17 -17
- scanoss/api/components/v2/__init__.py +17 -17
- scanoss/api/components/v2/scanoss_components_pb2.py +48 -38
- scanoss/api/components/v2/scanoss_components_pb2_grpc.py +142 -96
- scanoss/api/cryptography/v2/scanoss_cryptography_pb2.py +22 -16
- scanoss/api/cryptography/v2/scanoss_cryptography_pb2_grpc.py +75 -49
- scanoss/api/dependencies/__init__.py +17 -17
- scanoss/api/dependencies/v2/__init__.py +17 -17
- scanoss/api/dependencies/v2/scanoss_dependencies_pb2.py +30 -24
- scanoss/api/dependencies/v2/scanoss_dependencies_pb2_grpc.py +75 -49
- scanoss/api/provenance/__init__.py +23 -0
- scanoss/api/provenance/v2/__init__.py +23 -0
- scanoss/api/provenance/v2/scanoss_provenance_pb2.py +42 -0
- scanoss/api/provenance/v2/scanoss_provenance_pb2_grpc.py +108 -0
- scanoss/api/scanning/__init__.py +17 -17
- scanoss/api/scanning/v2/__init__.py +17 -17
- scanoss/api/scanning/v2/scanoss_scanning_pb2.py +10 -8
- scanoss/api/scanning/v2/scanoss_scanning_pb2_grpc.py +40 -32
- scanoss/api/semgrep/__init__.py +17 -17
- scanoss/api/semgrep/v2/__init__.py +17 -17
- scanoss/api/semgrep/v2/scanoss_semgrep_pb2.py +22 -18
- scanoss/api/semgrep/v2/scanoss_semgrep_pb2_grpc.py +71 -49
- scanoss/api/vulnerabilities/__init__.py +17 -17
- scanoss/api/vulnerabilities/v2/__init__.py +17 -17
- scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2.py +37 -27
- scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2_grpc.py +109 -72
- scanoss/cli.py +578 -264
- scanoss/components.py +99 -48
- scanoss/csvoutput.py +83 -56
- scanoss/cyclonedx.py +48 -46
- scanoss/data/build_date.txt +1 -1
- scanoss/file_filters.py +13 -15
- scanoss/filecount.py +43 -36
- scanoss/inspection/__init__.py +17 -17
- scanoss/inspection/copyleft.py +71 -58
- scanoss/inspection/policy_check.py +76 -53
- scanoss/inspection/undeclared_component.py +98 -75
- scanoss/inspection/utils/license_utils.py +66 -44
- scanoss/results.py +51 -60
- scanoss/scancodedeps.py +61 -38
- scanoss/scanner.py +203 -135
- scanoss/scanoss_settings.py +5 -3
- scanoss/scanossapi.py +98 -69
- scanoss/scanossbase.py +19 -19
- scanoss/scanossgrpc.py +107 -51
- scanoss/scanpostprocessor.py +9 -6
- scanoss/scantype.py +22 -21
- scanoss/spdxlite.py +265 -171
- scanoss/threadeddependencies.py +91 -61
- scanoss/threadedscanning.py +37 -31
- scanoss/utils/file.py +4 -4
- scanoss/winnowing.py +111 -47
- {scanoss-1.19.6.dist-info → scanoss-1.20.1.dist-info}/METADATA +1 -1
- scanoss-1.20.1.dist-info/RECORD +74 -0
- scanoss-1.19.6.dist-info/RECORD +0 -70
- {scanoss-1.19.6.dist-info → scanoss-1.20.1.dist-info}/LICENSE +0 -0
- {scanoss-1.19.6.dist-info → scanoss-1.20.1.dist-info}/WHEEL +0 -0
- {scanoss-1.19.6.dist-info → scanoss-1.20.1.dist-info}/entry_points.txt +0 -0
- {scanoss-1.19.6.dist-info → scanoss-1.20.1.dist-info}/top_level.txt +0 -0
scanoss/scanossgrpc.py
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"""
|
|
2
|
-
|
|
2
|
+
SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
Copyright (c) 2021, SCANOSS
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
|
14
|
+
all copies or substantial portions of the Software.
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
THE SOFTWARE.
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
25
|
import os
|
|
@@ -37,21 +37,27 @@ from .api.components.v2.scanoss_components_pb2_grpc import ComponentsStub
|
|
|
37
37
|
from .api.cryptography.v2.scanoss_cryptography_pb2_grpc import CryptographyStub
|
|
38
38
|
from .api.dependencies.v2.scanoss_dependencies_pb2_grpc import DependenciesStub
|
|
39
39
|
from .api.vulnerabilities.v2.scanoss_vulnerabilities_pb2_grpc import VulnerabilitiesStub
|
|
40
|
+
from .api.provenance.v2.scanoss_provenance_pb2_grpc import ProvenanceStub
|
|
40
41
|
from .api.semgrep.v2.scanoss_semgrep_pb2_grpc import SemgrepStub
|
|
41
42
|
from .api.cryptography.v2.scanoss_cryptography_pb2 import AlgorithmResponse
|
|
42
43
|
from .api.dependencies.v2.scanoss_dependencies_pb2 import DependencyRequest, DependencyResponse
|
|
43
44
|
from .api.common.v2.scanoss_common_pb2 import EchoRequest, EchoResponse, StatusResponse, StatusCode, PurlRequest
|
|
44
45
|
from .api.vulnerabilities.v2.scanoss_vulnerabilities_pb2 import VulnerabilityResponse
|
|
45
46
|
from .api.semgrep.v2.scanoss_semgrep_pb2 import SemgrepResponse
|
|
46
|
-
from .api.components.v2.scanoss_components_pb2 import (
|
|
47
|
-
|
|
47
|
+
from .api.components.v2.scanoss_components_pb2 import (
|
|
48
|
+
CompSearchRequest,
|
|
49
|
+
CompSearchResponse,
|
|
50
|
+
CompVersionRequest,
|
|
51
|
+
CompVersionResponse,
|
|
52
|
+
)
|
|
53
|
+
from .api.provenance.v2.scanoss_provenance_pb2 import ProvenanceResponse
|
|
48
54
|
from .scanossbase import ScanossBase
|
|
49
55
|
from . import __version__
|
|
50
56
|
|
|
51
|
-
DEFAULT_URL =
|
|
52
|
-
DEFAULT_URL2 =
|
|
53
|
-
SCANOSS_GRPC_URL = os.environ.get(
|
|
54
|
-
SCANOSS_API_KEY = os.environ.get(
|
|
57
|
+
DEFAULT_URL = 'https://api.osskb.org' # default free service URL
|
|
58
|
+
DEFAULT_URL2 = 'https://api.scanoss.com' # default premium service URL
|
|
59
|
+
SCANOSS_GRPC_URL = os.environ.get('SCANOSS_GRPC_URL') if os.environ.get('SCANOSS_GRPC_URL') else DEFAULT_URL
|
|
60
|
+
SCANOSS_API_KEY = os.environ.get('SCANOSS_API_KEY') if os.environ.get('SCANOSS_API_KEY') else ''
|
|
55
61
|
|
|
56
62
|
|
|
57
63
|
class ScanossGrpc(ScanossBase):
|
|
@@ -59,9 +65,20 @@ class ScanossGrpc(ScanossBase):
|
|
|
59
65
|
Client for gRPC functionality
|
|
60
66
|
"""
|
|
61
67
|
|
|
62
|
-
def __init__(
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
def __init__(
|
|
69
|
+
self,
|
|
70
|
+
url: str = None,
|
|
71
|
+
debug: bool = False,
|
|
72
|
+
trace: bool = False,
|
|
73
|
+
quiet: bool = False,
|
|
74
|
+
ca_cert: str = None,
|
|
75
|
+
api_key: str = None,
|
|
76
|
+
ver_details: str = None,
|
|
77
|
+
timeout: int = 600,
|
|
78
|
+
proxy: str = None,
|
|
79
|
+
grpc_proxy: str = None,
|
|
80
|
+
pac: PACFile = None,
|
|
81
|
+
):
|
|
65
82
|
"""
|
|
66
83
|
|
|
67
84
|
:param url:
|
|
@@ -80,7 +97,7 @@ class ScanossGrpc(ScanossBase):
|
|
|
80
97
|
super().__init__(debug, trace, quiet)
|
|
81
98
|
self.url = url if url else SCANOSS_GRPC_URL
|
|
82
99
|
self.api_key = api_key if api_key else SCANOSS_API_KEY
|
|
83
|
-
if self.api_key and not url and not os.environ.get(
|
|
100
|
+
if self.api_key and not url and not os.environ.get('SCANOSS_GRPC_URL'):
|
|
84
101
|
self.url = DEFAULT_URL2 # API key specific and no alternative URL, so use the default premium
|
|
85
102
|
self.url = self.url.lower()
|
|
86
103
|
self.orig_url = self.url # Used for proxy lookup
|
|
@@ -113,6 +130,7 @@ class ScanossGrpc(ScanossBase):
|
|
|
113
130
|
self.dependencies_stub = DependenciesStub(grpc.insecure_channel(self.url))
|
|
114
131
|
self.semgrep_stub = SemgrepStub(grpc.insecure_channel(self.url))
|
|
115
132
|
self.vuln_stub = VulnerabilitiesStub(grpc.insecure_channel(self.url))
|
|
133
|
+
self.provenance_stub = ProvenanceStub(grpc.insecure_channel(self.url))
|
|
116
134
|
else:
|
|
117
135
|
if ca_cert is not None:
|
|
118
136
|
credentials = grpc.ssl_channel_credentials(cert_data) # secure with specified certificate
|
|
@@ -123,6 +141,7 @@ class ScanossGrpc(ScanossBase):
|
|
|
123
141
|
self.dependencies_stub = DependenciesStub(grpc.secure_channel(self.url, credentials))
|
|
124
142
|
self.semgrep_stub = SemgrepStub(grpc.secure_channel(self.url, credentials))
|
|
125
143
|
self.vuln_stub = VulnerabilitiesStub(grpc.secure_channel(self.url, credentials))
|
|
144
|
+
self.provenance_stub = ProvenanceStub(grpc.secure_channel(self.url, credentials))
|
|
126
145
|
|
|
127
146
|
@classmethod
|
|
128
147
|
def _load_cert(cls, cert_file: str) -> bytes:
|
|
@@ -143,8 +162,9 @@ class ScanossGrpc(ScanossBase):
|
|
|
143
162
|
metadata.append(('x-request-id', request_id)) # Set a Request ID
|
|
144
163
|
resp = self.dependencies_stub.Echo(EchoRequest(message=message), metadata=metadata, timeout=3)
|
|
145
164
|
except Exception as e:
|
|
146
|
-
self.print_stderr(
|
|
147
|
-
|
|
165
|
+
self.print_stderr(
|
|
166
|
+
f'ERROR: {e.__class__.__name__} Problem encountered sending gRPC message (rqId: {request_id}): {e}'
|
|
167
|
+
)
|
|
148
168
|
else:
|
|
149
169
|
# self.print_stderr(f'resp: {resp} - call: {call}')
|
|
150
170
|
# response_id = ""
|
|
@@ -176,8 +196,9 @@ class ScanossGrpc(ScanossBase):
|
|
|
176
196
|
metadata.append(('x-request-id', request_id)) # Set a Request ID
|
|
177
197
|
resp = self.crypto_stub.Echo(EchoRequest(message=message), metadata=metadata, timeout=3)
|
|
178
198
|
except Exception as e:
|
|
179
|
-
self.print_stderr(
|
|
180
|
-
|
|
199
|
+
self.print_stderr(
|
|
200
|
+
f'ERROR: {e.__class__.__name__} Problem encountered sending gRPC message (rqId: {request_id}): {e}'
|
|
201
|
+
)
|
|
181
202
|
else:
|
|
182
203
|
if resp:
|
|
183
204
|
return resp.message
|
|
@@ -206,7 +227,7 @@ class ScanossGrpc(ScanossBase):
|
|
|
206
227
|
request_id = str(uuid.uuid4())
|
|
207
228
|
resp: DependencyResponse
|
|
208
229
|
try:
|
|
209
|
-
files_json = dependencies.get(
|
|
230
|
+
files_json = dependencies.get('files')
|
|
210
231
|
if files_json is None or len(files_json) == 0:
|
|
211
232
|
self.print_stderr(f'ERROR: No dependency data supplied to send to gRPC service.')
|
|
212
233
|
return None
|
|
@@ -217,8 +238,9 @@ class ScanossGrpc(ScanossBase):
|
|
|
217
238
|
self.print_debug(f'Sending dependency data for decoration (rqId: {request_id})...')
|
|
218
239
|
resp = self.dependencies_stub.GetDependencies(request, metadata=metadata, timeout=self.timeout)
|
|
219
240
|
except Exception as e:
|
|
220
|
-
self.print_stderr(
|
|
221
|
-
|
|
241
|
+
self.print_stderr(
|
|
242
|
+
f'ERROR: {e.__class__.__name__} Problem encountered sending gRPC message (rqId: {request_id}): {e}'
|
|
243
|
+
)
|
|
222
244
|
else:
|
|
223
245
|
if resp:
|
|
224
246
|
if not self._check_status_response(resp.status, request_id):
|
|
@@ -244,8 +266,9 @@ class ScanossGrpc(ScanossBase):
|
|
|
244
266
|
self.print_debug(f'Sending crypto data for decoration (rqId: {request_id})...')
|
|
245
267
|
resp = self.crypto_stub.GetAlgorithms(request, metadata=metadata, timeout=self.timeout)
|
|
246
268
|
except Exception as e:
|
|
247
|
-
self.print_stderr(
|
|
248
|
-
|
|
269
|
+
self.print_stderr(
|
|
270
|
+
f'ERROR: {e.__class__.__name__} Problem encountered sending gRPC message (rqId: {request_id}): {e}'
|
|
271
|
+
)
|
|
249
272
|
else:
|
|
250
273
|
if resp:
|
|
251
274
|
if not self._check_status_response(resp.status, request_id):
|
|
@@ -273,8 +296,9 @@ class ScanossGrpc(ScanossBase):
|
|
|
273
296
|
self.print_debug(f'Sending crypto data for decoration (rqId: {request_id})...')
|
|
274
297
|
resp = self.vuln_stub.GetVulnerabilities(request, metadata=metadata, timeout=self.timeout)
|
|
275
298
|
except Exception as e:
|
|
276
|
-
self.print_stderr(
|
|
277
|
-
|
|
299
|
+
self.print_stderr(
|
|
300
|
+
f'ERROR: {e.__class__.__name__} Problem encountered sending gRPC message (rqId: {request_id}): {e}'
|
|
301
|
+
)
|
|
278
302
|
else:
|
|
279
303
|
if resp:
|
|
280
304
|
if not self._check_status_response(resp.status, request_id):
|
|
@@ -302,8 +326,9 @@ class ScanossGrpc(ScanossBase):
|
|
|
302
326
|
self.print_debug(f'Sending semgrep data for decoration (rqId: {request_id})...')
|
|
303
327
|
resp = self.semgrep_stub.GetIssues(request, metadata=metadata, timeout=self.timeout)
|
|
304
328
|
except Exception as e:
|
|
305
|
-
self.print_stderr(
|
|
306
|
-
|
|
329
|
+
self.print_stderr(
|
|
330
|
+
f'ERROR: {e.__class__.__name__} Problem encountered sending gRPC message (rqId: {request_id}): {e}'
|
|
331
|
+
)
|
|
307
332
|
else:
|
|
308
333
|
if resp:
|
|
309
334
|
if not self._check_status_response(resp.status, request_id):
|
|
@@ -331,8 +356,9 @@ class ScanossGrpc(ScanossBase):
|
|
|
331
356
|
self.print_debug(f'Sending component search data (rqId: {request_id})...')
|
|
332
357
|
resp = self.comp_search_stub.SearchComponents(request, metadata=metadata, timeout=self.timeout)
|
|
333
358
|
except Exception as e:
|
|
334
|
-
self.print_stderr(
|
|
335
|
-
|
|
359
|
+
self.print_stderr(
|
|
360
|
+
f'ERROR: {e.__class__.__name__} Problem encountered sending gRPC message (rqId: {request_id}): {e}'
|
|
361
|
+
)
|
|
336
362
|
else:
|
|
337
363
|
if resp:
|
|
338
364
|
if not self._check_status_response(resp.status, request_id):
|
|
@@ -360,8 +386,9 @@ class ScanossGrpc(ScanossBase):
|
|
|
360
386
|
self.print_debug(f'Sending component version data (rqId: {request_id})...')
|
|
361
387
|
resp = self.comp_search_stub.GetComponentVersions(request, metadata=metadata, timeout=self.timeout)
|
|
362
388
|
except Exception as e:
|
|
363
|
-
self.print_stderr(
|
|
364
|
-
|
|
389
|
+
self.print_stderr(
|
|
390
|
+
f'ERROR: {e.__class__.__name__} Problem encountered sending gRPC message (rqId: {request_id}): {e}'
|
|
391
|
+
)
|
|
365
392
|
else:
|
|
366
393
|
if resp:
|
|
367
394
|
if not self._check_status_response(resp.status, request_id):
|
|
@@ -383,13 +410,15 @@ class ScanossGrpc(ScanossBase):
|
|
|
383
410
|
self.print_debug(f'Checking response status (rqId: {request_id}): {status_response}')
|
|
384
411
|
status_code: StatusCode = status_response.status
|
|
385
412
|
if status_code > 1:
|
|
413
|
+
ret_val = False # default to failed
|
|
386
414
|
msg = "Unsuccessful"
|
|
387
415
|
if status_code == 2:
|
|
388
416
|
msg = "Succeeded with warnings"
|
|
417
|
+
ret_val = True # No need to fail as it succeeded with warnings
|
|
389
418
|
elif status_code == 3:
|
|
390
|
-
msg =
|
|
419
|
+
msg = 'Failed with warnings'
|
|
391
420
|
self.print_stderr(f'{msg} (rqId: {request_id} - status: {status_code}): {status_response.message}')
|
|
392
|
-
return
|
|
421
|
+
return ret_val
|
|
393
422
|
return True
|
|
394
423
|
|
|
395
424
|
def _get_proxy_config(self):
|
|
@@ -400,20 +429,47 @@ class ScanossGrpc(ScanossBase):
|
|
|
400
429
|
"""
|
|
401
430
|
if self.grpc_proxy:
|
|
402
431
|
self.print_debug(f'Setting GRPC (grpc_proxy) proxy...')
|
|
403
|
-
os.environ[
|
|
432
|
+
os.environ['grpc_proxy'] = self.grpc_proxy
|
|
404
433
|
elif self.proxy:
|
|
405
434
|
self.print_debug(f'Setting GRPC (http_proxy/https_proxy) proxies...')
|
|
406
|
-
os.environ[
|
|
407
|
-
os.environ[
|
|
435
|
+
os.environ['http_proxy'] = self.proxy
|
|
436
|
+
os.environ['https_proxy'] = self.proxy
|
|
408
437
|
elif self.pac:
|
|
409
438
|
self.print_debug(f'Attempting to get GRPC proxy details from PAC for {self.orig_url}...')
|
|
410
439
|
resolver = ProxyResolver(self.pac)
|
|
411
440
|
proxies = resolver.get_proxy_for_requests(self.orig_url)
|
|
412
441
|
if proxies:
|
|
413
442
|
self.print_trace(f'Setting proxies: {proxies}')
|
|
414
|
-
os.environ[
|
|
415
|
-
os.environ[
|
|
443
|
+
os.environ['http_proxy'] = proxies.get('http') or ''
|
|
444
|
+
os.environ['https_proxy'] = proxies.get('https') or ''
|
|
416
445
|
|
|
446
|
+
def get_provenance_json(self, purls: dict) -> dict:
|
|
447
|
+
"""
|
|
448
|
+
Client function to call the rpc for GetComponentProvenance
|
|
449
|
+
:param purls: Message to send to the service
|
|
450
|
+
:return: Server response or None
|
|
451
|
+
"""
|
|
452
|
+
if not purls:
|
|
453
|
+
self.print_stderr(f'ERROR: No message supplied to send to gRPC service.')
|
|
454
|
+
return None
|
|
455
|
+
request_id = str(uuid.uuid4())
|
|
456
|
+
resp: ProvenanceResponse
|
|
457
|
+
try:
|
|
458
|
+
request = ParseDict(purls, PurlRequest()) # Parse the JSON/Dict into the purl request object
|
|
459
|
+
metadata = self.metadata[:]
|
|
460
|
+
metadata.append(('x-request-id', request_id)) # Set a Request ID
|
|
461
|
+
self.print_debug(f'Sending data for provenance decoration (rqId: {request_id})...')
|
|
462
|
+
resp = self.provenance_stub.GetComponentProvenance(request, metadata=metadata, timeout=self.timeout)
|
|
463
|
+
except Exception as e:
|
|
464
|
+
self.print_stderr(f'ERROR: {e.__class__.__name__} Problem encountered sending gRPC message '
|
|
465
|
+
f'(rqId: {request_id}): {e}')
|
|
466
|
+
else:
|
|
467
|
+
if resp:
|
|
468
|
+
if not self._check_status_response(resp.status, request_id):
|
|
469
|
+
return None
|
|
470
|
+
resp_dict = MessageToDict(resp, preserving_proto_field_name=True) # Convert gRPC response to a dict
|
|
471
|
+
return resp_dict
|
|
472
|
+
return None
|
|
417
473
|
#
|
|
418
474
|
# End of ScanossGrpc Class
|
|
419
475
|
#
|
scanoss/scanpostprocessor.py
CHANGED
|
@@ -207,8 +207,9 @@ class ScanPostProcessor(ScanossBase):
|
|
|
207
207
|
|
|
208
208
|
return result
|
|
209
209
|
|
|
210
|
-
def _should_replace_result(
|
|
211
|
-
|
|
210
|
+
def _should_replace_result(
|
|
211
|
+
self, result_path: str, result: dict, to_replace_entries: List[BomEntry]
|
|
212
|
+
) -> Tuple[bool, str]:
|
|
212
213
|
"""
|
|
213
214
|
Check if a result should be replaced based on the SCANOSS settings
|
|
214
215
|
|
|
@@ -278,14 +279,16 @@ class ScanPostProcessor(ScanossBase):
|
|
|
278
279
|
:return:
|
|
279
280
|
"""
|
|
280
281
|
message = (
|
|
281
|
-
f
|
|
282
|
-
f
|
|
283
|
-
f
|
|
282
|
+
f'{_get_match_type_message(result_path, bom_entry, action)} \n'
|
|
283
|
+
f'Details:\n'
|
|
284
|
+
f' - PURLs: {", ".join(result_purls)}\n'
|
|
284
285
|
f" - Path: '{result_path}'\n"
|
|
285
286
|
)
|
|
286
287
|
if action == 'Replacing':
|
|
287
288
|
message += f" - {action} with '{bom_entry.get('replace_with')}'"
|
|
288
289
|
self.print_debug(message)
|
|
290
|
+
|
|
291
|
+
|
|
289
292
|
#
|
|
290
293
|
# End of ScanPostProcessor Class
|
|
291
|
-
#
|
|
294
|
+
#
|
scanoss/scantype.py
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"""
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
2
|
+
SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2021, SCANOSS
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
|
14
|
+
all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
THE SOFTWARE.
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
25
|
from enum import Enum
|
|
@@ -29,6 +29,7 @@ class ScanType(Enum):
|
|
|
29
29
|
"""
|
|
30
30
|
Octal Enum class describing all the scanning options
|
|
31
31
|
"""
|
|
32
|
+
|
|
32
33
|
SCAN_FILES = 1
|
|
33
34
|
SCAN_SNIPPETS = 2
|
|
34
35
|
SCAN_DEPENDENCIES = 4
|