scanoss 1.17.1__tar.gz → 1.17.2__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.
Files changed (75) hide show
  1. {scanoss-1.17.1/src/scanoss.egg-info → scanoss-1.17.2}/PKG-INFO +1 -1
  2. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/__init__.py +1 -1
  3. scanoss-1.17.2/src/scanoss/data/build_date.txt +1 -0
  4. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/inspection/policy_check.py +26 -10
  5. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/inspection/undeclared_component.py +11 -5
  6. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/scanoss_settings.py +28 -23
  7. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/spdxlite.py +4 -1
  8. {scanoss-1.17.1 → scanoss-1.17.2/src/scanoss.egg-info}/PKG-INFO +1 -1
  9. scanoss-1.17.1/src/scanoss/data/build_date.txt +0 -1
  10. {scanoss-1.17.1 → scanoss-1.17.2}/LICENSE +0 -0
  11. {scanoss-1.17.1 → scanoss-1.17.2}/PACKAGE.md +0 -0
  12. {scanoss-1.17.1 → scanoss-1.17.2}/README.md +0 -0
  13. {scanoss-1.17.1 → scanoss-1.17.2}/pyproject.toml +0 -0
  14. {scanoss-1.17.1 → scanoss-1.17.2}/setup.cfg +0 -0
  15. {scanoss-1.17.1 → scanoss-1.17.2}/src/protoc_gen_swagger/__init__.py +0 -0
  16. {scanoss-1.17.1 → scanoss-1.17.2}/src/protoc_gen_swagger/options/__init__.py +0 -0
  17. {scanoss-1.17.1 → scanoss-1.17.2}/src/protoc_gen_swagger/options/annotations_pb2.py +0 -0
  18. {scanoss-1.17.1 → scanoss-1.17.2}/src/protoc_gen_swagger/options/annotations_pb2_grpc.py +0 -0
  19. {scanoss-1.17.1 → scanoss-1.17.2}/src/protoc_gen_swagger/options/openapiv2_pb2.py +0 -0
  20. {scanoss-1.17.1 → scanoss-1.17.2}/src/protoc_gen_swagger/options/openapiv2_pb2_grpc.py +0 -0
  21. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/__init__.py +0 -0
  22. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/common/__init__.py +0 -0
  23. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/common/v2/__init__.py +0 -0
  24. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/common/v2/scanoss_common_pb2.py +0 -0
  25. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/common/v2/scanoss_common_pb2_grpc.py +0 -0
  26. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/components/__init__.py +0 -0
  27. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/components/v2/__init__.py +0 -0
  28. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/components/v2/scanoss_components_pb2.py +0 -0
  29. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/components/v2/scanoss_components_pb2_grpc.py +0 -0
  30. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/cryptography/v2/scanoss_cryptography_pb2.py +0 -0
  31. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/cryptography/v2/scanoss_cryptography_pb2_grpc.py +0 -0
  32. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/dependencies/__init__.py +0 -0
  33. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/dependencies/v2/__init__.py +0 -0
  34. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/dependencies/v2/scanoss_dependencies_pb2.py +0 -0
  35. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/dependencies/v2/scanoss_dependencies_pb2_grpc.py +0 -0
  36. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/scanning/__init__.py +0 -0
  37. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/scanning/v2/__init__.py +0 -0
  38. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/scanning/v2/scanoss_scanning_pb2.py +0 -0
  39. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/scanning/v2/scanoss_scanning_pb2_grpc.py +0 -0
  40. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/semgrep/__init__.py +0 -0
  41. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/semgrep/v2/__init__.py +0 -0
  42. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/semgrep/v2/scanoss_semgrep_pb2.py +0 -0
  43. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/semgrep/v2/scanoss_semgrep_pb2_grpc.py +0 -0
  44. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/vulnerabilities/__init__.py +0 -0
  45. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/vulnerabilities/v2/__init__.py +0 -0
  46. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2.py +0 -0
  47. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2_grpc.py +0 -0
  48. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/cli.py +0 -0
  49. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/components.py +0 -0
  50. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/csvoutput.py +0 -0
  51. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/cyclonedx.py +0 -0
  52. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/data/spdx-exceptions.json +0 -0
  53. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/data/spdx-licenses.json +0 -0
  54. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/filecount.py +0 -0
  55. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/inspection/__init__.py +0 -0
  56. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/inspection/copyleft.py +0 -0
  57. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/inspection/utils/license_utils.py +0 -0
  58. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/inspection/utils/markdown_utils.py +0 -0
  59. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/inspection/utils/result_utils.py +0 -0
  60. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/results.py +0 -0
  61. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/scancodedeps.py +0 -0
  62. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/scanner.py +0 -0
  63. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/scanossapi.py +0 -0
  64. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/scanossbase.py +0 -0
  65. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/scanossgrpc.py +0 -0
  66. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/scanpostprocessor.py +0 -0
  67. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/scantype.py +0 -0
  68. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/threadeddependencies.py +0 -0
  69. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/threadedscanning.py +0 -0
  70. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss/winnowing.py +0 -0
  71. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss.egg-info/SOURCES.txt +0 -0
  72. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss.egg-info/dependency_links.txt +0 -0
  73. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss.egg-info/entry_points.txt +0 -0
  74. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss.egg-info/requires.txt +0 -0
  75. {scanoss-1.17.1 → scanoss-1.17.2}/src/scanoss.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scanoss
3
- Version: 1.17.1
3
+ Version: 1.17.2
4
4
  Summary: Simple Python library to leverage the SCANOSS APIs
5
5
  Home-page: https://scanoss.com
6
6
  Author: SCANOSS
@@ -22,4 +22,4 @@
22
22
  THE SOFTWARE.
23
23
  """
24
24
 
25
- __version__ = "1.17.1"
25
+ __version__ = "1.17.2"
@@ -0,0 +1 @@
1
+ date: 20241104160508, utime: 1730736308
@@ -133,7 +133,8 @@ class PolicyCheck(ScanossBase):
133
133
  """
134
134
  pass
135
135
 
136
- def _append_component(self,components: Dict[str, Any], new_component: Dict[str, Any]) -> Dict[str, Any]:
136
+ def _append_component(self,components: Dict[str, Any], new_component: Dict[str, Any],
137
+ id: str, status: str) -> Dict[str, Any]:
137
138
  """
138
139
  Append a new component to the component's dictionary.
139
140
 
@@ -143,15 +144,25 @@ class PolicyCheck(ScanossBase):
143
144
 
144
145
  :param components: The existing dictionary of components
145
146
  :param new_component: The new component to be added or updated
147
+ :param id: The new component ID
148
+ :param status: The new component status
146
149
  :return: The updated components dictionary
147
150
  """
148
- component_key = f"{new_component['purl'][0]}@{new_component['version']}"
151
+
152
+ # Determine the component key and purl based on component type
153
+ if id in [ComponentID.FILE.value, ComponentID.SNIPPET.value]:
154
+ purl = new_component['purl'][0] # Take first purl for these component types
155
+ else:
156
+ purl = new_component['purl']
157
+
158
+ component_key = f"{purl}@{new_component['version']}"
149
159
  components[component_key] = {
150
- 'purl': new_component['purl'][0],
151
- 'version': new_component['version'],
152
- 'licenses': {},
153
- 'status': new_component['status'],
160
+ 'purl': purl,
161
+ 'version': new_component['version'],
162
+ 'licenses': {},
163
+ 'status': status,
154
164
  }
165
+
155
166
  if not new_component.get('licenses'):
156
167
  self.print_stderr(f'WARNING: Results missing licenses. Skipping.')
157
168
  return components
@@ -187,6 +198,10 @@ class PolicyCheck(ScanossBase):
187
198
  if not component_id:
188
199
  self.print_stderr(f'WARNING: Result missing id. Skipping.')
189
200
  continue
201
+ status = c.get('status')
202
+ if not component_id:
203
+ self.print_stderr(f'WARNING: Result missing status. Skipping.')
204
+ continue
190
205
  if component_id in [ComponentID.FILE.value, ComponentID.SNIPPET.value]:
191
206
  if not c.get('purl'):
192
207
  self.print_stderr(f'WARNING: Result missing purl. Skipping.')
@@ -200,9 +215,10 @@ class PolicyCheck(ScanossBase):
200
215
  component_key = f"{c['purl'][0]}@{c['version']}"
201
216
  # Initialize or update the component entry
202
217
  if component_key not in components:
203
- components = self._append_component(components, c)
218
+ components = self._append_component(components, c, component_id, status)
219
+
204
220
  if c['id'] == ComponentID.DEPENDENCY.value:
205
- if c.get('dependency') is None:
221
+ if c.get('dependencies') is None:
206
222
  continue
207
223
  for d in c['dependencies']:
208
224
  if not d.get('purl'):
@@ -214,9 +230,9 @@ class PolicyCheck(ScanossBase):
214
230
  if not d.get('version'):
215
231
  self.print_stderr(f'WARNING: Result missing version. Skipping.')
216
232
  continue
217
- component_key = f"{d['purl'][0]}@{d['version']}"
233
+ component_key = f"{d['purl']}@{d['version']}"
218
234
  if component_key not in components:
219
- components = self._append_component(components, d)
235
+ components = self._append_component(components, d, component_id, status)
220
236
  # End of dependencies loop
221
237
  # End if
222
238
  # End of component loop
@@ -115,20 +115,26 @@ class UndeclaredComponent(PolicyCheck):
115
115
  'summary': self._get_summary(components),
116
116
  }
117
117
 
118
- def _generate_sbom_file(self, components: list) -> list:
118
+ def _generate_sbom_file(self, components: list) -> dict[str, list[dict[str, str]]]:
119
119
  """
120
120
  Generate a list of PURLs for the SBOM file.
121
121
 
122
122
  :param components: List of undeclared components
123
- :return: List of dictionaries containing PURLs
123
+ :return: SBOM Dictionary with components
124
124
  """
125
- sbom = {}
125
+
126
+ unique_components = {}
126
127
  if components is None:
127
128
  self.print_stderr(f'WARNING: No components provided!')
128
129
  else:
129
130
  for component in components:
130
- sbom[component['purl']] = { 'purl': component['purl'] }
131
- return list(sbom.values())
131
+ unique_components[component['purl']] = { 'purl': component['purl'] }
132
+
133
+ sbom = {
134
+ 'components': list(unique_components.values())
135
+ }
136
+
137
+ return sbom
132
138
 
133
139
  def run(self):
134
140
  """
@@ -1,30 +1,30 @@
1
1
  """
2
- SPDX-License-Identifier: MIT
3
-
4
- Copyright (c) 2024, 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.
2
+ SPDX-License-Identifier: MIT
3
+
4
+ Copyright (c) 2024, 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
  import json
26
26
  from pathlib import Path
27
- from typing import Dict, List, TypedDict
27
+ from typing import List, TypedDict
28
28
 
29
29
  from .scanossbase import ScanossBase
30
30
 
@@ -123,7 +123,12 @@ class ScanossSettings(ScanossBase):
123
123
  list: If using SBOM.json
124
124
  """
125
125
  if self.settings_file_type == "legacy":
126
- return self.data.get("components", [])
126
+ if isinstance(self.data, list):
127
+ return self.data
128
+ elif isinstance(self.data, dict) and self.data.get("components"):
129
+ return self.data.get("components")
130
+ else:
131
+ return []
127
132
  return self.data.get("bom", {})
128
133
 
129
134
  def get_bom_include(self) -> List[BomEntry]:
@@ -180,7 +180,7 @@ class SpdxLite:
180
180
  data = {
181
181
  'spdxVersion': 'SPDX-2.2',
182
182
  'dataLicense': 'CC0-1.0',
183
- 'SPDXID': f'SPDXRef-{md5hex}',
183
+ 'SPDXID': f'SPDXRef-DOCUMENT',
184
184
  'name': 'SCANOSS-SBOM',
185
185
  'creationInfo': {
186
186
  'created': now.strftime('%Y-%m-%dT%H:%M:%SZ'),
@@ -214,6 +214,8 @@ class SpdxLite:
214
214
  comp_name = comp.get('component')
215
215
  comp_ver = comp.get('version')
216
216
  purl_ver = f'{purl}@{comp_ver}'
217
+ vendor = comp.get('vendor', 'NOASSERTION')
218
+ supplier = f"Organization: {vendor}" if vendor != 'NOASSERTION' else vendor
217
219
  purl_hash = hashlib.md5(f'{purl_ver}'.encode('utf-8')).hexdigest()
218
220
  purl_spdx = f'SPDXRef-{purl_hash}'
219
221
  data['documentDescribes'].append(purl_spdx)
@@ -227,6 +229,7 @@ class SpdxLite:
227
229
  'licenseConcluded': 'NOASSERTION',
228
230
  'filesAnalyzed': False,
229
231
  'copyrightText': 'NOASSERTION',
232
+ 'supplier': supplier,
230
233
  'externalRefs': [{
231
234
  'referenceCategory': 'PACKAGE-MANAGER',
232
235
  'referenceLocator': purl_ver,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scanoss
3
- Version: 1.17.1
3
+ Version: 1.17.2
4
4
  Summary: Simple Python library to leverage the SCANOSS APIs
5
5
  Home-page: https://scanoss.com
6
6
  Author: SCANOSS
@@ -1 +0,0 @@
1
- date: 20241024162611, utime: 1729787171
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes