scanoss 1.17.0__tar.gz → 1.17.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.17.0/src/scanoss.egg-info → scanoss-1.17.1}/PKG-INFO +1 -1
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/__init__.py +1 -1
- scanoss-1.17.1/src/scanoss/data/build_date.txt +1 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/inspection/copyleft.py +4 -4
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/inspection/undeclared_component.py +4 -4
- scanoss-1.17.1/src/scanoss/inspection/utils/markdown_utils.py +23 -0
- scanoss-1.17.1/src/scanoss/inspection/utils/result_utils.py +79 -0
- {scanoss-1.17.0 → scanoss-1.17.1/src/scanoss.egg-info}/PKG-INFO +1 -1
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss.egg-info/SOURCES.txt +3 -1
- scanoss-1.17.0/src/scanoss/data/build_date.txt +0 -1
- {scanoss-1.17.0 → scanoss-1.17.1}/LICENSE +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/PACKAGE.md +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/README.md +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/pyproject.toml +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/setup.cfg +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/protoc_gen_swagger/__init__.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/protoc_gen_swagger/options/__init__.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/protoc_gen_swagger/options/annotations_pb2.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/protoc_gen_swagger/options/annotations_pb2_grpc.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/protoc_gen_swagger/options/openapiv2_pb2.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/protoc_gen_swagger/options/openapiv2_pb2_grpc.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/__init__.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/common/__init__.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/common/v2/__init__.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/common/v2/scanoss_common_pb2.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/common/v2/scanoss_common_pb2_grpc.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/components/__init__.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/components/v2/__init__.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/components/v2/scanoss_components_pb2.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/components/v2/scanoss_components_pb2_grpc.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/cryptography/v2/scanoss_cryptography_pb2.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/cryptography/v2/scanoss_cryptography_pb2_grpc.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/dependencies/__init__.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/dependencies/v2/__init__.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/dependencies/v2/scanoss_dependencies_pb2.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/dependencies/v2/scanoss_dependencies_pb2_grpc.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/scanning/__init__.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/scanning/v2/__init__.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/scanning/v2/scanoss_scanning_pb2.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/scanning/v2/scanoss_scanning_pb2_grpc.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/semgrep/__init__.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/semgrep/v2/__init__.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/semgrep/v2/scanoss_semgrep_pb2.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/semgrep/v2/scanoss_semgrep_pb2_grpc.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/vulnerabilities/__init__.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/vulnerabilities/v2/__init__.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2_grpc.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/cli.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/components.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/csvoutput.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/cyclonedx.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/data/spdx-exceptions.json +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/data/spdx-licenses.json +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/filecount.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/inspection/__init__.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/inspection/policy_check.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/inspection/utils/license_utils.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/results.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/scancodedeps.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/scanner.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/scanoss_settings.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/scanossapi.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/scanossbase.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/scanossgrpc.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/scanpostprocessor.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/scantype.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/spdxlite.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/threadeddependencies.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/threadedscanning.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/winnowing.py +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss.egg-info/dependency_links.txt +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss.egg-info/entry_points.txt +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss.egg-info/requires.txt +0 -0
- {scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
date: 20241024162611, utime: 1729787171
|
|
@@ -69,8 +69,8 @@ class Copyleft(PolicyCheck):
|
|
|
69
69
|
if len(components) > 0:
|
|
70
70
|
details = { 'components': components }
|
|
71
71
|
return {
|
|
72
|
-
'details': json.dumps(details, indent=2),
|
|
73
|
-
'summary': f'{len(components)} component(s) with copyleft licenses were found
|
|
72
|
+
'details': f'{json.dumps(details, indent=2)}\n',
|
|
73
|
+
'summary': f'{len(components)} component(s) with copyleft licenses were found.\n'
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
def _markdown(self, components: list) -> Dict[str,Any]:
|
|
@@ -96,8 +96,8 @@ class Copyleft(PolicyCheck):
|
|
|
96
96
|
# End license loop
|
|
97
97
|
# End component loop
|
|
98
98
|
return {
|
|
99
|
-
'details': f'### Copyleft licenses\n{self.generate_table(headers,rows,centered_columns)}',
|
|
100
|
-
'summary' : f'{len(components)} component(s) with copyleft licenses were found
|
|
99
|
+
'details': f'### Copyleft licenses\n{self.generate_table(headers,rows,centered_columns)}\n',
|
|
100
|
+
'summary' : f'{len(components)} component(s) with copyleft licenses were found.\n'
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
def _filter_components_with_copyleft_licenses(self, components: list) -> list:
|
|
@@ -78,8 +78,8 @@ class UndeclaredComponent(PolicyCheck):
|
|
|
78
78
|
"""
|
|
79
79
|
summary = f'{len(components)} undeclared component(s) were found.\n'
|
|
80
80
|
if len(components) > 0:
|
|
81
|
-
summary += (f'
|
|
82
|
-
f'
|
|
81
|
+
summary += (f'Add the following snippet into your `sbom.json` file\n'
|
|
82
|
+
f'\n```json\n{json.dumps(self._generate_sbom_file(components), indent=2)}\n```\n')
|
|
83
83
|
return summary
|
|
84
84
|
|
|
85
85
|
def _json(self, components: list) -> Dict[str, Any]:
|
|
@@ -93,7 +93,7 @@ class UndeclaredComponent(PolicyCheck):
|
|
|
93
93
|
if len(components) > 0:
|
|
94
94
|
details = {'components': components}
|
|
95
95
|
return {
|
|
96
|
-
'details': json.dumps(details, indent=2),
|
|
96
|
+
'details': f'{json.dumps(details, indent=2)}\n',
|
|
97
97
|
'summary': self._get_summary(components),
|
|
98
98
|
}
|
|
99
99
|
|
|
@@ -111,7 +111,7 @@ class UndeclaredComponent(PolicyCheck):
|
|
|
111
111
|
licenses = " - ".join(lic.get('spdxid', 'Unknown') for lic in component['licenses'])
|
|
112
112
|
rows.append([component['purl'], component['version'], licenses])
|
|
113
113
|
return {
|
|
114
|
-
'details': f'### Undeclared components\n{self.generate_table(headers,rows)}',
|
|
114
|
+
'details': f'### Undeclared components\n{self.generate_table(headers,rows)}\n',
|
|
115
115
|
'summary': self._get_summary(components),
|
|
116
116
|
}
|
|
117
117
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
def generate_table(headers, rows, centered_columns=None):
|
|
2
|
+
"""
|
|
3
|
+
Generate Markdown table
|
|
4
|
+
:param headers: List of headers
|
|
5
|
+
:param rows: Rows
|
|
6
|
+
:param centered_columns: List with centered columns
|
|
7
|
+
"""
|
|
8
|
+
COL_SEP = ' | '
|
|
9
|
+
centered_column_set = set(centered_columns or [])
|
|
10
|
+
def create_separator(header, index):
|
|
11
|
+
if centered_columns is None:
|
|
12
|
+
return '-'
|
|
13
|
+
return ':-:' if index in centered_column_set else '-'
|
|
14
|
+
|
|
15
|
+
row_separator = COL_SEP + COL_SEP.join(
|
|
16
|
+
create_separator(header, index) for index, header in enumerate(headers)
|
|
17
|
+
) + COL_SEP
|
|
18
|
+
|
|
19
|
+
table_rows = [COL_SEP + COL_SEP.join(headers) + COL_SEP]
|
|
20
|
+
table_rows.append(row_separator)
|
|
21
|
+
table_rows.extend(COL_SEP + COL_SEP.join(row) + COL_SEP for row in rows)
|
|
22
|
+
|
|
23
|
+
return '\n'.join(table_rows)
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
from typing import Dict, Any
|
|
3
|
+
|
|
4
|
+
from scanoss.inspection.utils.license_utils import license_util
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ComponentID(Enum):
|
|
8
|
+
FILE = "file"
|
|
9
|
+
SNIPPET = "snippet"
|
|
10
|
+
DEPENDENCY = "dependency"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _append_component(components: Dict[str, Any], new_component: Dict[str, Any]) -> Dict[str, Any]:
|
|
14
|
+
"""
|
|
15
|
+
Append a new component to the components dictionary.
|
|
16
|
+
|
|
17
|
+
This function creates a new entry in the components dictionary for the given component,
|
|
18
|
+
or updates an existing entry if the component already exists. It also processes the
|
|
19
|
+
licenses associated with the component.
|
|
20
|
+
|
|
21
|
+
:param components: The existing dictionary of components
|
|
22
|
+
:param new_component: The new component to be added or updated
|
|
23
|
+
:return: The updated components dictionary
|
|
24
|
+
"""
|
|
25
|
+
component_key = f"{new_component['purl'][0]}@{new_component['version']}"
|
|
26
|
+
components[component_key] = {
|
|
27
|
+
'purl': new_component['purl'][0],
|
|
28
|
+
'version': new_component['version'],
|
|
29
|
+
'licenses': {},
|
|
30
|
+
'status': new_component['status'],
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
# Process licenses for this component
|
|
34
|
+
for l in new_component['licenses']:
|
|
35
|
+
spdxid = l['name']
|
|
36
|
+
components[component_key]['licenses'][spdxid] = {
|
|
37
|
+
'spdxid': spdxid,
|
|
38
|
+
'copyleft': license_util.is_copyleft(spdxid),
|
|
39
|
+
'url': l.get('url')
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return components
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def get_components(results: Dict[str, Any]) -> list:
|
|
46
|
+
"""
|
|
47
|
+
Process the results dictionary to extract and format component information.
|
|
48
|
+
|
|
49
|
+
This function iterates through the results dictionary, identifying components from
|
|
50
|
+
different sources (files, snippets, and dependencies). It consolidates this information
|
|
51
|
+
into a list of unique components, each with its associated licenses and other details.
|
|
52
|
+
|
|
53
|
+
:param results: A dictionary containing the raw results of a component scan
|
|
54
|
+
:return: A list of dictionaries, each representing a unique component with its details
|
|
55
|
+
"""
|
|
56
|
+
components = {}
|
|
57
|
+
for component in results.values():
|
|
58
|
+
for c in component:
|
|
59
|
+
if c['id'] in [ComponentID.FILE.value, ComponentID.SNIPPET.value]:
|
|
60
|
+
component_key = f"{c['purl'][0]}@{c['version']}"
|
|
61
|
+
|
|
62
|
+
# Initialize or update the component entry
|
|
63
|
+
if component_key not in components:
|
|
64
|
+
components = _append_component(components, c)
|
|
65
|
+
|
|
66
|
+
if c['id'] == ComponentID.DEPENDENCY.value:
|
|
67
|
+
for d in c['dependencies']:
|
|
68
|
+
component_key = f"{d['purl'][0]}@{d['version']}"
|
|
69
|
+
|
|
70
|
+
if component_key not in components:
|
|
71
|
+
components = _append_component(components, d)
|
|
72
|
+
# End of for loop
|
|
73
|
+
# End if
|
|
74
|
+
# End if
|
|
75
|
+
results = list(components.values())
|
|
76
|
+
for component in results:
|
|
77
|
+
component['licenses'] = list(component['licenses'].values())
|
|
78
|
+
|
|
79
|
+
return results
|
|
@@ -68,4 +68,6 @@ src/scanoss/inspection/__init__.py
|
|
|
68
68
|
src/scanoss/inspection/copyleft.py
|
|
69
69
|
src/scanoss/inspection/policy_check.py
|
|
70
70
|
src/scanoss/inspection/undeclared_component.py
|
|
71
|
-
src/scanoss/inspection/utils/license_utils.py
|
|
71
|
+
src/scanoss/inspection/utils/license_utils.py
|
|
72
|
+
src/scanoss/inspection/utils/markdown_utils.py
|
|
73
|
+
src/scanoss/inspection/utils/result_utils.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
date: 20241023122954, utime: 1729686594
|
|
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.17.0 → scanoss-1.17.1}/src/scanoss/api/components/v2/scanoss_components_pb2_grpc.py
RENAMED
|
File without changes
|
{scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/cryptography/v2/scanoss_cryptography_pb2.py
RENAMED
|
File without changes
|
{scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/cryptography/v2/scanoss_cryptography_pb2_grpc.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/dependencies/v2/scanoss_dependencies_pb2.py
RENAMED
|
File without changes
|
{scanoss-1.17.0 → scanoss-1.17.1}/src/scanoss/api/dependencies/v2/scanoss_dependencies_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.17.0 → scanoss-1.17.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
|