scanoss 1.25.0__tar.gz → 1.25.1__tar.gz
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-1.25.0/src/scanoss.egg-info → scanoss-1.25.1}/PKG-INFO +1 -1
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/__init__.py +1 -1
- scanoss-1.25.1/src/scanoss/data/build_date.txt +1 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/inspection/copyleft.py +27 -2
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/inspection/policy_check.py +27 -50
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/inspection/undeclared_component.py +49 -15
- {scanoss-1.25.0 → scanoss-1.25.1/src/scanoss.egg-info}/PKG-INFO +1 -1
- {scanoss-1.25.0 → scanoss-1.25.1}/tests/test_policy_inspect.py +10 -46
- scanoss-1.25.0/src/scanoss/data/build_date.txt +0 -1
- {scanoss-1.25.0 → scanoss-1.25.1}/LICENSE +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/PACKAGE.md +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/README.md +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/pyproject.toml +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/setup.cfg +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/protoc_gen_swagger/__init__.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/protoc_gen_swagger/options/__init__.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/protoc_gen_swagger/options/annotations_pb2.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/protoc_gen_swagger/options/annotations_pb2_grpc.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/protoc_gen_swagger/options/openapiv2_pb2.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/protoc_gen_swagger/options/openapiv2_pb2_grpc.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/__init__.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/common/__init__.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/common/v2/__init__.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/common/v2/scanoss_common_pb2.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/common/v2/scanoss_common_pb2_grpc.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/components/__init__.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/components/v2/__init__.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/components/v2/scanoss_components_pb2.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/components/v2/scanoss_components_pb2_grpc.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/cryptography/v2/scanoss_cryptography_pb2.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/cryptography/v2/scanoss_cryptography_pb2_grpc.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/dependencies/__init__.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/dependencies/v2/__init__.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/dependencies/v2/scanoss_dependencies_pb2.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/dependencies/v2/scanoss_dependencies_pb2_grpc.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/geoprovenance/__init__.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/geoprovenance/v2/__init__.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/geoprovenance/v2/scanoss_geoprovenance_pb2.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/geoprovenance/v2/scanoss_geoprovenance_pb2_grpc.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/scanning/__init__.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/scanning/v2/__init__.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/scanning/v2/scanoss_scanning_pb2.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/scanning/v2/scanoss_scanning_pb2_grpc.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/semgrep/__init__.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/semgrep/v2/__init__.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/semgrep/v2/scanoss_semgrep_pb2.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/semgrep/v2/scanoss_semgrep_pb2_grpc.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/vulnerabilities/__init__.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/vulnerabilities/v2/__init__.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2_grpc.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/cli.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/components.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/constants.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/cryptography.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/csvoutput.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/cyclonedx.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/data/scanoss-settings-schema.json +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/data/spdx-exceptions.json +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/data/spdx-licenses.json +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/file_filters.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/filecount.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/inspection/__init__.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/inspection/utils/license_utils.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/results.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/scancodedeps.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/scanner.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/scanners/__init__.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/scanners/container_scanner.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/scanners/folder_hasher.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/scanners/scanner_config.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/scanners/scanner_hfh.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/scanoss_settings.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/scanossapi.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/scanossbase.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/scanossgrpc.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/scanpostprocessor.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/scantype.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/spdxlite.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/threadeddependencies.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/threadedscanning.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/utils/__init__.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/utils/abstract_presenter.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/utils/crc64.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/utils/file.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/utils/simhash.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/winnowing.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss.egg-info/SOURCES.txt +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss.egg-info/dependency_links.txt +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss.egg-info/entry_points.txt +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss.egg-info/requires.txt +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss.egg-info/top_level.txt +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/tests/test_csv_output.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/tests/test_file_filters.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/tests/test_scan_post_processor.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/tests/test_spdxlite.py +0 -0
- {scanoss-1.25.0 → scanoss-1.25.1}/tests/test_winnowing.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
date: 20250612124028, utime: 1749732028
|
|
@@ -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.
|
|
@@ -179,7 +179,7 @@ class MyTestCase(unittest.TestCase):
|
|
|
179
179
|
status, results = undeclared.run()
|
|
180
180
|
details = json.loads(results['details'])
|
|
181
181
|
summary = results['summary']
|
|
182
|
-
expected_summary_output = """
|
|
182
|
+
expected_summary_output = """3 undeclared component(s) were found.
|
|
183
183
|
Add the following snippet into your `sbom.json` file
|
|
184
184
|
```json
|
|
185
185
|
{
|
|
@@ -189,17 +189,11 @@ class MyTestCase(unittest.TestCase):
|
|
|
189
189
|
},
|
|
190
190
|
{
|
|
191
191
|
"purl": "pkg:github/scanoss/wfp"
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
"purl": "pkg:npm/%40electron/rebuild"
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
"purl": "pkg:npm/%40emotion/react"
|
|
198
192
|
}
|
|
199
193
|
]
|
|
200
194
|
}```
|
|
201
195
|
"""
|
|
202
|
-
self.assertEqual(len(details['components']),
|
|
196
|
+
self.assertEqual(len(details['components']), 3)
|
|
203
197
|
self.assertEqual(
|
|
204
198
|
re.sub(r'\s|\\(?!`)|\\(?=`)', '', summary), re.sub(r'\s|\\(?!`)|\\(?=`)', '', expected_summary_output)
|
|
205
199
|
)
|
|
@@ -222,11 +216,9 @@ class MyTestCase(unittest.TestCase):
|
|
|
222
216
|
| - | - | - |
|
|
223
217
|
| pkg:github/scanoss/scanner.c | 1.3.3 | BSD-2-Clause - GPL-2.0-only |
|
|
224
218
|
| pkg:github/scanoss/scanner.c | 1.1.4 | GPL-2.0-only |
|
|
225
|
-
| pkg:github/scanoss/wfp | 6afc1f6 | Zlib - GPL-2.0-only |
|
|
226
|
-
| pkg:npm/%40electron/rebuild | 3.7.0 | MIT |
|
|
227
|
-
| pkg:npm/%40emotion/react | 11.13.3 | MIT | """
|
|
219
|
+
| pkg:github/scanoss/wfp | 6afc1f6 | Zlib - GPL-2.0-only | """
|
|
228
220
|
|
|
229
|
-
expected_summary_output = """
|
|
221
|
+
expected_summary_output = """3 undeclared component(s) were found.
|
|
230
222
|
Add the following snippet into your `sbom.json` file
|
|
231
223
|
```json
|
|
232
224
|
{
|
|
@@ -236,13 +228,7 @@ class MyTestCase(unittest.TestCase):
|
|
|
236
228
|
},
|
|
237
229
|
{
|
|
238
230
|
"purl": "pkg:github/scanoss/wfp"
|
|
239
|
-
}
|
|
240
|
-
{
|
|
241
|
-
"purl": "pkg:npm/%40electron/rebuild"
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
"purl": "pkg:npm/%40emotion/react"
|
|
245
|
-
}
|
|
231
|
+
}
|
|
246
232
|
]
|
|
247
233
|
}```
|
|
248
234
|
"""
|
|
@@ -273,11 +259,9 @@ class MyTestCase(unittest.TestCase):
|
|
|
273
259
|
| - | - | - |
|
|
274
260
|
| pkg:github/scanoss/scanner.c | 1.3.3 | BSD-2-Clause - GPL-2.0-only |
|
|
275
261
|
| pkg:github/scanoss/scanner.c | 1.1.4 | GPL-2.0-only |
|
|
276
|
-
| pkg:github/scanoss/wfp | 6afc1f6 | Zlib - GPL-2.0-only |
|
|
277
|
-
| pkg:npm/%40electron/rebuild | 3.7.0 | MIT |
|
|
278
|
-
| pkg:npm/%40emotion/react | 11.13.3 | MIT | """
|
|
262
|
+
| pkg:github/scanoss/wfp | 6afc1f6 | Zlib - GPL-2.0-only | """
|
|
279
263
|
|
|
280
|
-
expected_summary_output = """
|
|
264
|
+
expected_summary_output = """3 undeclared component(s) were found.
|
|
281
265
|
Add the following snippet into your `scanoss.json` file
|
|
282
266
|
|
|
283
267
|
```json
|
|
@@ -289,12 +273,6 @@ class MyTestCase(unittest.TestCase):
|
|
|
289
273
|
},
|
|
290
274
|
{
|
|
291
275
|
"purl": "pkg:github/scanoss/wfp"
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
"purl": "pkg:npm/%40electron/rebuild"
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
"purl": "pkg:npm/%40emotion/react"
|
|
298
276
|
}
|
|
299
277
|
]
|
|
300
278
|
}
|
|
@@ -322,7 +300,7 @@ class MyTestCase(unittest.TestCase):
|
|
|
322
300
|
status, results = undeclared.run()
|
|
323
301
|
details = json.loads(results['details'])
|
|
324
302
|
summary = results['summary']
|
|
325
|
-
expected_summary_output = """
|
|
303
|
+
expected_summary_output = """3 undeclared component(s) were found.
|
|
326
304
|
Add the following snippet into your `scanoss.json` file
|
|
327
305
|
|
|
328
306
|
```json
|
|
@@ -334,19 +312,13 @@ class MyTestCase(unittest.TestCase):
|
|
|
334
312
|
},
|
|
335
313
|
{
|
|
336
314
|
"purl": "pkg:github/scanoss/wfp"
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
"purl": "pkg:npm/%40electron/rebuild"
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
"purl": "pkg:npm/%40emotion/react"
|
|
343
315
|
}
|
|
344
316
|
]
|
|
345
317
|
}
|
|
346
318
|
}
|
|
347
319
|
```"""
|
|
348
320
|
self.assertEqual(status, 0)
|
|
349
|
-
self.assertEqual(len(details['components']),
|
|
321
|
+
self.assertEqual(len(details['components']), 3)
|
|
350
322
|
self.assertEqual(
|
|
351
323
|
re.sub(r'\s|\\(?!`)|\\(?=`)', '', summary), re.sub(r'\s|\\(?!`)|\\(?=`)', '', expected_summary_output)
|
|
352
324
|
)
|
|
@@ -363,10 +335,8 @@ class MyTestCase(unittest.TestCase):
|
|
|
363
335
|
|pkg:github/scanoss/scanner.c|1.3.3|BSD-2-Clause - GPL-2.0-only|
|
|
364
336
|
|pkg:github/scanoss/scanner.c|1.1.4|GPL-2.0-only|
|
|
365
337
|
|pkg:github/scanoss/wfp|6afc1f6|Zlib - GPL-2.0-only|
|
|
366
|
-
|pkg:npm/%40electron/rebuild|3.7.0|MIT|
|
|
367
|
-
|pkg:npm/%40emotion/react|11.13.3|MIT|
|
|
368
338
|
"""
|
|
369
|
-
expected_summary_output = """
|
|
339
|
+
expected_summary_output = """3 undeclared component(s) were found.
|
|
370
340
|
Add the following snippet into your `scanoss.json` file
|
|
371
341
|
{code:json}
|
|
372
342
|
{
|
|
@@ -377,12 +347,6 @@ Add the following snippet into your `scanoss.json` file
|
|
|
377
347
|
},
|
|
378
348
|
{
|
|
379
349
|
"purl": "pkg:github/scanoss/wfp"
|
|
380
|
-
},
|
|
381
|
-
{
|
|
382
|
-
"purl": "pkg:npm/%40electron/rebuild"
|
|
383
|
-
},
|
|
384
|
-
{
|
|
385
|
-
"purl": "pkg:npm/%40emotion/react"
|
|
386
350
|
}
|
|
387
351
|
]
|
|
388
352
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
date: 20250610161304, utime: 1749571984
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/components/v2/scanoss_components_pb2_grpc.py
RENAMED
|
File without changes
|
{scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/cryptography/v2/scanoss_cryptography_pb2.py
RENAMED
|
File without changes
|
{scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/cryptography/v2/scanoss_cryptography_pb2_grpc.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/dependencies/v2/scanoss_dependencies_pb2.py
RENAMED
|
File without changes
|
{scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/dependencies/v2/scanoss_dependencies_pb2_grpc.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/geoprovenance/v2/scanoss_geoprovenance_pb2.py
RENAMED
|
File without changes
|
{scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/geoprovenance/v2/scanoss_geoprovenance_pb2_grpc.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scanoss-1.25.0 → scanoss-1.25.1}/src/scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|