scanoss 1.25.0__py3-none-any.whl → 1.25.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.
- scanoss/__init__.py +1 -1
- scanoss/data/build_date.txt +1 -1
- scanoss/inspection/copyleft.py +27 -2
- scanoss/inspection/policy_check.py +27 -50
- scanoss/inspection/undeclared_component.py +49 -15
- {scanoss-1.25.0.dist-info → scanoss-1.25.1.dist-info}/METADATA +1 -1
- {scanoss-1.25.0.dist-info → scanoss-1.25.1.dist-info}/RECORD +11 -11
- {scanoss-1.25.0.dist-info → scanoss-1.25.1.dist-info}/WHEEL +0 -0
- {scanoss-1.25.0.dist-info → scanoss-1.25.1.dist-info}/entry_points.txt +0 -0
- {scanoss-1.25.0.dist-info → scanoss-1.25.1.dist-info}/licenses/LICENSE +0 -0
- {scanoss-1.25.0.dist-info → scanoss-1.25.1.dist-info}/top_level.txt +0 -0
scanoss/__init__.py
CHANGED
scanoss/data/build_date.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
date:
|
|
1
|
+
date: 20250612124028, utime: 1749732028
|
scanoss/inspection/copyleft.py
CHANGED
|
@@ -23,7 +23,8 @@ SPDX-License-Identifier: MIT
|
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
25
|
import json
|
|
26
|
-
from typing import
|
|
26
|
+
from typing import Any, Dict
|
|
27
|
+
|
|
27
28
|
from .policy_check import PolicyCheck, PolicyStatus
|
|
28
29
|
|
|
29
30
|
|
|
@@ -33,7 +34,7 @@ class Copyleft(PolicyCheck):
|
|
|
33
34
|
Inspects components for copyleft licenses
|
|
34
35
|
"""
|
|
35
36
|
|
|
36
|
-
def __init__(
|
|
37
|
+
def __init__( # noqa: PLR0913
|
|
37
38
|
self,
|
|
38
39
|
debug: bool = False,
|
|
39
40
|
trace: bool = True,
|
|
@@ -158,6 +159,30 @@ class Copyleft(PolicyCheck):
|
|
|
158
159
|
self.print_debug(f'Copyleft components: {filtered_components}')
|
|
159
160
|
return filtered_components
|
|
160
161
|
|
|
162
|
+
def _get_components(self):
|
|
163
|
+
"""
|
|
164
|
+
Extract and process components from results and their dependencies.
|
|
165
|
+
|
|
166
|
+
This method performs the following steps:
|
|
167
|
+
1. Validates that `self.results` is loaded. Returns `None` if not.
|
|
168
|
+
2. Extracts file, snippet, and dependency components into a dictionary.
|
|
169
|
+
3. Converts components to a list and processes their licenses.
|
|
170
|
+
|
|
171
|
+
:return: A list of processed components with license data, or `None` if `self.results` is not set.
|
|
172
|
+
"""
|
|
173
|
+
if self.results is None:
|
|
174
|
+
return None
|
|
175
|
+
|
|
176
|
+
components: dict = {}
|
|
177
|
+
# Extract component and license data from file and dependency results. Both helpers mutate `components`
|
|
178
|
+
self._get_components_data(self.results, components)
|
|
179
|
+
self._get_dependencies_data(self.results, components)
|
|
180
|
+
# Convert to list and process licenses
|
|
181
|
+
results_list = list(components.values())
|
|
182
|
+
for component in results_list:
|
|
183
|
+
component['licenses'] = list(component['licenses'].values())
|
|
184
|
+
return results_list
|
|
185
|
+
|
|
161
186
|
def run(self):
|
|
162
187
|
"""
|
|
163
188
|
Run the copyleft license inspection process.
|
|
@@ -166,6 +166,30 @@ class PolicyCheck(ScanossBase):
|
|
|
166
166
|
"""
|
|
167
167
|
pass
|
|
168
168
|
|
|
169
|
+
@abstractmethod
|
|
170
|
+
def _get_components(self):
|
|
171
|
+
"""
|
|
172
|
+
Retrieve and process components from the preloaded results.
|
|
173
|
+
|
|
174
|
+
This method performs the following steps:
|
|
175
|
+
1. Checks if the results have been previously loaded (self.results).
|
|
176
|
+
2. Extracts and processes components from the loaded results.
|
|
177
|
+
|
|
178
|
+
:return: A list of processed components, or None if an error occurred during any step.
|
|
179
|
+
|
|
180
|
+
Possible reasons for returning None include:
|
|
181
|
+
- Results not loaded (self.results is None)
|
|
182
|
+
- Failure to extract components from the results
|
|
183
|
+
|
|
184
|
+
Note:
|
|
185
|
+
- This method assumes that the results have been previously loaded and stored in self.results.
|
|
186
|
+
- Implementations must extract components (e.g. via `_get_components_data`,
|
|
187
|
+
`_get_dependencies_data`, or other helpers).
|
|
188
|
+
- If `self.results` is `None`, simply return `None`.
|
|
189
|
+
"""
|
|
190
|
+
pass
|
|
191
|
+
|
|
192
|
+
|
|
169
193
|
def _append_component(
|
|
170
194
|
self, components: Dict[str, Any], new_component: Dict[str, Any], id: str, status: str
|
|
171
195
|
) -> Dict[str, Any]:
|
|
@@ -223,6 +247,9 @@ class PolicyCheck(ScanossBase):
|
|
|
223
247
|
if not component_id:
|
|
224
248
|
self.print_debug(f'WARNING: Result missing id. Skipping: {c}')
|
|
225
249
|
continue
|
|
250
|
+
## Skip dependency
|
|
251
|
+
if component_id == ComponentID.DEPENDENCY.value:
|
|
252
|
+
continue
|
|
226
253
|
status = c.get('status')
|
|
227
254
|
if not status:
|
|
228
255
|
self.print_debug(f'WARNING: Result missing status. Skipping: {c}')
|
|
@@ -280,33 +307,6 @@ class PolicyCheck(ScanossBase):
|
|
|
280
307
|
# End of result loop
|
|
281
308
|
return components
|
|
282
309
|
|
|
283
|
-
def _get_components_from_results(self, results: Dict[str, Any]) -> list or None:
|
|
284
|
-
"""
|
|
285
|
-
Process the results dictionary to extract and format component information.
|
|
286
|
-
|
|
287
|
-
This function iterates through the results dictionary, identifying components from
|
|
288
|
-
different sources (files, snippets, and dependencies). It consolidates this information
|
|
289
|
-
into a list of unique components, each with its associated licenses and other details.
|
|
290
|
-
|
|
291
|
-
:param results: A dictionary containing the raw results of a component scan
|
|
292
|
-
:return: A list of dictionaries, each representing a unique component with its details
|
|
293
|
-
"""
|
|
294
|
-
if results is None:
|
|
295
|
-
self.print_stderr('ERROR: Results cannot be empty')
|
|
296
|
-
return None
|
|
297
|
-
|
|
298
|
-
components = {}
|
|
299
|
-
# Extract file and snippet components
|
|
300
|
-
components = self._get_components_data(results, components)
|
|
301
|
-
# Extract dependency components
|
|
302
|
-
components = self._get_dependencies_data(results, components)
|
|
303
|
-
# Convert to list and process licenses
|
|
304
|
-
results_list = list(components.values())
|
|
305
|
-
for component in results_list:
|
|
306
|
-
component['licenses'] = list(component['licenses'].values())
|
|
307
|
-
|
|
308
|
-
return results_list
|
|
309
|
-
|
|
310
310
|
def generate_table(self, headers, rows, centered_columns=None):
|
|
311
311
|
"""
|
|
312
312
|
Generate a Markdown table.
|
|
@@ -411,29 +411,6 @@ class PolicyCheck(ScanossBase):
|
|
|
411
411
|
self.print_stderr(f'ERROR: Problem parsing input JSON: {e}')
|
|
412
412
|
return None
|
|
413
413
|
|
|
414
|
-
def _get_components(self):
|
|
415
|
-
"""
|
|
416
|
-
Retrieve and process components from the preloaded results.
|
|
417
|
-
|
|
418
|
-
This method performs the following steps:
|
|
419
|
-
1. Checks if the results have been previously loaded (self.results).
|
|
420
|
-
2. Extracts and processes components from the loaded results.
|
|
421
|
-
|
|
422
|
-
:return: A list of processed components, or None if an error occurred during any step.
|
|
423
|
-
Possible reasons for returning None include:
|
|
424
|
-
- Results not loaded (self.results is None)
|
|
425
|
-
- Failure to extract components from the results
|
|
426
|
-
|
|
427
|
-
Note:
|
|
428
|
-
- This method assumes that the results have been previously loaded and stored in self.results.
|
|
429
|
-
- If results is None, the method returns None without performing any further operations.
|
|
430
|
-
- The actual processing of components is delegated to the _get_components_from_results method.
|
|
431
|
-
"""
|
|
432
|
-
if self.results is None:
|
|
433
|
-
return None
|
|
434
|
-
components = self._get_components_from_results(self.results)
|
|
435
|
-
return components
|
|
436
|
-
|
|
437
414
|
#
|
|
438
415
|
# End of PolicyCheck Class
|
|
439
416
|
#
|
|
@@ -23,7 +23,8 @@ SPDX-License-Identifier: MIT
|
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
25
|
import json
|
|
26
|
-
from typing import
|
|
26
|
+
from typing import Any, Dict
|
|
27
|
+
|
|
27
28
|
from .policy_check import PolicyCheck, PolicyStatus
|
|
28
29
|
|
|
29
30
|
|
|
@@ -33,7 +34,7 @@ class UndeclaredComponent(PolicyCheck):
|
|
|
33
34
|
Inspects for undeclared components
|
|
34
35
|
"""
|
|
35
36
|
|
|
36
|
-
def __init__(
|
|
37
|
+
def __init__( # noqa: PLR0913
|
|
37
38
|
self,
|
|
38
39
|
debug: bool = False,
|
|
39
40
|
trace: bool = True,
|
|
@@ -73,7 +74,7 @@ class UndeclaredComponent(PolicyCheck):
|
|
|
73
74
|
:return: List of undeclared components
|
|
74
75
|
"""
|
|
75
76
|
if components is None:
|
|
76
|
-
self.print_debug(
|
|
77
|
+
self.print_debug('WARNING: No components provided!')
|
|
77
78
|
return None
|
|
78
79
|
undeclared_components = []
|
|
79
80
|
for component in components:
|
|
@@ -87,25 +88,35 @@ class UndeclaredComponent(PolicyCheck):
|
|
|
87
88
|
"""
|
|
88
89
|
Get a summary of the undeclared components.
|
|
89
90
|
|
|
91
|
+
:param components: List of all components
|
|
92
|
+
:return: Component summary markdown
|
|
93
|
+
"""
|
|
94
|
+
|
|
95
|
+
"""
|
|
96
|
+
Get a summary of the undeclared components.
|
|
97
|
+
|
|
90
98
|
:param components: List of all components
|
|
91
99
|
:return: Component summary markdown
|
|
92
100
|
"""
|
|
93
101
|
if len(components) > 0:
|
|
102
|
+
json_content = json.dumps(self._generate_scanoss_file(components), indent=2)
|
|
103
|
+
|
|
94
104
|
if self.sbom_format == 'settings':
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
.
|
|
98
|
-
|
|
105
|
+
return (
|
|
106
|
+
f'{len(components)} undeclared component(s) were found.\n'
|
|
107
|
+
f'Add the following snippet into your `scanoss.json` file\n'
|
|
108
|
+
f'{{code:json}}\n'
|
|
109
|
+
f'{json_content}\n'
|
|
110
|
+
f'{{code}}\n'
|
|
99
111
|
)
|
|
100
|
-
return f'{len(components)} undeclared component(s) were found.\nAdd the following snippet into your `scanoss.json` file\n{{code:json}}\n{json.dumps(self._generate_scanoss_file(components), indent=2)}\n{{code}}\n'
|
|
101
112
|
else:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
.
|
|
105
|
-
|
|
113
|
+
return (
|
|
114
|
+
f'{len(components)} undeclared component(s) were found.\n'
|
|
115
|
+
f'Add the following snippet into your `sbom.json` file\n'
|
|
116
|
+
f'{{code:json}}\n'
|
|
117
|
+
f'{json_content}\n'
|
|
118
|
+
f'{{code}}\n'
|
|
106
119
|
)
|
|
107
|
-
return f'{len(components)} undeclared component(s) were found.\nAdd the following snippet into your `sbom.json` file\n{{code:json}}\n{json.dumps(self._generate_scanoss_file(components), indent=2)}\n{{code}}\n'
|
|
108
|
-
|
|
109
120
|
return f'{len(components)} undeclared component(s) were found.\\n'
|
|
110
121
|
|
|
111
122
|
def _get_summary(self, components: list) -> str:
|
|
@@ -190,7 +201,7 @@ class UndeclaredComponent(PolicyCheck):
|
|
|
190
201
|
"""
|
|
191
202
|
unique_components = {}
|
|
192
203
|
if components is None:
|
|
193
|
-
self.print_stderr(
|
|
204
|
+
self.print_stderr('WARNING: No components provided!')
|
|
194
205
|
return []
|
|
195
206
|
|
|
196
207
|
for component in components:
|
|
@@ -225,6 +236,29 @@ class UndeclaredComponent(PolicyCheck):
|
|
|
225
236
|
|
|
226
237
|
return sbom
|
|
227
238
|
|
|
239
|
+
def _get_components(self):
|
|
240
|
+
"""
|
|
241
|
+
Extract and process components from file results only.
|
|
242
|
+
|
|
243
|
+
This method performs the following steps:
|
|
244
|
+
1. Validates if `self.results` is loaded. Returns `None` if not loaded.
|
|
245
|
+
2. Extracts file and snippet components into a dictionary.
|
|
246
|
+
3. Converts the components dictionary into a list of components.
|
|
247
|
+
4. Processes the licenses for each component by converting them into a list.
|
|
248
|
+
|
|
249
|
+
:return: A list of processed components with their licenses, or `None` if `self.results` is not set.
|
|
250
|
+
"""
|
|
251
|
+
if self.results is None:
|
|
252
|
+
return None
|
|
253
|
+
components: dict = {}
|
|
254
|
+
# Extract file and snippet components
|
|
255
|
+
components = self._get_components_data(self.results, components)
|
|
256
|
+
# Convert to list and process licenses
|
|
257
|
+
results_list = list(components.values())
|
|
258
|
+
for component in results_list:
|
|
259
|
+
component['licenses'] = list(component['licenses'].values())
|
|
260
|
+
return results_list
|
|
261
|
+
|
|
228
262
|
def run(self):
|
|
229
263
|
"""
|
|
230
264
|
Run the undeclared component inspection process.
|
|
@@ -4,7 +4,7 @@ protoc_gen_swagger/options/annotations_pb2.py,sha256=b25EDD6gssUWnFby9gxgcpLIROT
|
|
|
4
4
|
protoc_gen_swagger/options/annotations_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXHDCNMhZD2VXqocC9l_gk,159
|
|
5
5
|
protoc_gen_swagger/options/openapiv2_pb2.py,sha256=vYElGp8E1vGHszvWqX97zNG9GFJ7u2QcdK9ouq0XdyI,14939
|
|
6
6
|
protoc_gen_swagger/options/openapiv2_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXHDCNMhZD2VXqocC9l_gk,159
|
|
7
|
-
scanoss/__init__.py,sha256=
|
|
7
|
+
scanoss/__init__.py,sha256=zoc5i9zIZ6i9BDBRPHBqmnNWz1ctPZAr9pCu2Pamvlg,1146
|
|
8
8
|
scanoss/cli.py,sha256=SAB0xuHjEEw20YtYAPSZwrQaVf4JUsm8NRcVArMzd4U,69099
|
|
9
9
|
scanoss/components.py,sha256=b0R9DdKuXqyQiw5nZZwjQ6NJXBr1U9gyx1RI2FP9ozA,14511
|
|
10
10
|
scanoss/constants.py,sha256=FWCZG8gQputKwV7XwvW1GuwDXL4wDLQyVRGdwygg578,320
|
|
@@ -57,14 +57,14 @@ scanoss/api/vulnerabilities/__init__.py,sha256=IFrDk_DTJgKSZmmU-nuLXuq_s8sQZlrSC
|
|
|
57
57
|
scanoss/api/vulnerabilities/v2/__init__.py,sha256=IFrDk_DTJgKSZmmU-nuLXuq_s8sQZlrSCHhIDMJT4r0,1122
|
|
58
58
|
scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2.py,sha256=CFhF80av8tenGvn9AIsGEtRJPuV2dC_syA5JLZb2lDw,5464
|
|
59
59
|
scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2_grpc.py,sha256=HlS4k4Zmx6RIAqaO9I96jD-eyF5yU6Xx04pVm7pdqOg,6864
|
|
60
|
-
scanoss/data/build_date.txt,sha256=
|
|
60
|
+
scanoss/data/build_date.txt,sha256=DgM1g6ceMq5HR3AeQ6XArgq0PfNCFKqT1ujuejYzZaI,40
|
|
61
61
|
scanoss/data/scanoss-settings-schema.json,sha256=ClkRYAkjAN0Sk704G8BE_Ok006oQ6YnIGmX84CF8h9w,8798
|
|
62
62
|
scanoss/data/spdx-exceptions.json,sha256=s7UTYxC7jqQXr11YBlIWYCNwN6lRDFTR33Y8rpN_dA4,17953
|
|
63
63
|
scanoss/data/spdx-licenses.json,sha256=A6Z0q82gaTLtnopBfzeIVZjJFxkdRW1g2TuumQc-lII,228794
|
|
64
64
|
scanoss/inspection/__init__.py,sha256=0hjb5ktavp7utJzFhGMPImPaZiHWgilM2HwvTp5lXJE,1122
|
|
65
|
-
scanoss/inspection/copyleft.py,sha256=
|
|
66
|
-
scanoss/inspection/policy_check.py,sha256=
|
|
67
|
-
scanoss/inspection/undeclared_component.py,sha256=
|
|
65
|
+
scanoss/inspection/copyleft.py,sha256=lOOq3-HwIvYVd0a_A0o2pG-m0rtFBHxXjEBLtHpRJto,8671
|
|
66
|
+
scanoss/inspection/policy_check.py,sha256=ldUcKBXD74P4ldO417GP5PqJHE-BagDPBDOK-e3KZco,16009
|
|
67
|
+
scanoss/inspection/undeclared_component.py,sha256=7WRLdDSf_XWtDMlvKRo3nvBy_041gQ2xR2zXqFCzmz0,11155
|
|
68
68
|
scanoss/inspection/utils/license_utils.py,sha256=Zb6QLmVJb86lKCwZyBsmwakyAtY1SXa54kUyyKmWMqA,5093
|
|
69
69
|
scanoss/scanners/__init__.py,sha256=D4C0lWLuNp8k_BjQZEc07WZcUgAvriVwQWOk063b0ZU,1122
|
|
70
70
|
scanoss/scanners/container_scanner.py,sha256=leP4roes6B9B95F49mJ0P_F8WcKCQkvJgk9azWyJrjg,16294
|
|
@@ -76,9 +76,9 @@ scanoss/utils/abstract_presenter.py,sha256=teiDTxBj5jBMCk2T8i4l1BJPf_u4zBLWrtCTF
|
|
|
76
76
|
scanoss/utils/crc64.py,sha256=TMrwQimSdE6imhFOUL7oAG6Kxu-8qMpGWMuMg8QpSVs,3169
|
|
77
77
|
scanoss/utils/file.py,sha256=62cA9a17TU9ZvfA3FY5HY4-QOajJeSrc8S6xLA_f-3M,2980
|
|
78
78
|
scanoss/utils/simhash.py,sha256=6iu8DOcecPAY36SZjCOzrrLMT9oIE7-gI6QuYwUQ7B0,5793
|
|
79
|
-
scanoss-1.25.
|
|
80
|
-
scanoss-1.25.
|
|
81
|
-
scanoss-1.25.
|
|
82
|
-
scanoss-1.25.
|
|
83
|
-
scanoss-1.25.
|
|
84
|
-
scanoss-1.25.
|
|
79
|
+
scanoss-1.25.1.dist-info/licenses/LICENSE,sha256=LLUaXoiyOroIbr5ubAyrxBOwSRLTm35ETO2FmLpy8QQ,1074
|
|
80
|
+
scanoss-1.25.1.dist-info/METADATA,sha256=yIG7_hq018z-_68-M0jwt6hSb3oK5yol9Wku4k3m2V4,6060
|
|
81
|
+
scanoss-1.25.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
82
|
+
scanoss-1.25.1.dist-info/entry_points.txt,sha256=Uy28xnaDL5KQ7V77sZD5VLDXPNxYYzSr5tsqtiXVzAs,48
|
|
83
|
+
scanoss-1.25.1.dist-info/top_level.txt,sha256=V11PrQ6Pnrc-nDF9xnisnJ8e6-i7HqSIKVNqduRWcL8,27
|
|
84
|
+
scanoss-1.25.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|