scanoss 1.19.4__tar.gz → 1.19.6__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.19.4/src/scanoss.egg-info → scanoss-1.19.6}/PKG-INFO +2 -2
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/__init__.py +1 -1
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/cli.py +3 -3
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/cyclonedx.py +6 -6
- scanoss-1.19.6/src/scanoss/data/build_date.txt +1 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/scanoss_settings.py +13 -5
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/utils/file.py +31 -4
- {scanoss-1.19.4 → scanoss-1.19.6/src/scanoss.egg-info}/PKG-INFO +2 -2
- scanoss-1.19.4/src/scanoss/data/build_date.txt +0 -1
- {scanoss-1.19.4 → scanoss-1.19.6}/LICENSE +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/PACKAGE.md +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/README.md +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/pyproject.toml +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/setup.cfg +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/protoc_gen_swagger/__init__.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/protoc_gen_swagger/options/__init__.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/protoc_gen_swagger/options/annotations_pb2.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/protoc_gen_swagger/options/annotations_pb2_grpc.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/protoc_gen_swagger/options/openapiv2_pb2.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/protoc_gen_swagger/options/openapiv2_pb2_grpc.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/__init__.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/common/__init__.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/common/v2/__init__.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/common/v2/scanoss_common_pb2.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/common/v2/scanoss_common_pb2_grpc.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/components/__init__.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/components/v2/__init__.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/components/v2/scanoss_components_pb2.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/components/v2/scanoss_components_pb2_grpc.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/cryptography/v2/scanoss_cryptography_pb2.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/cryptography/v2/scanoss_cryptography_pb2_grpc.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/dependencies/__init__.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/dependencies/v2/__init__.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/dependencies/v2/scanoss_dependencies_pb2.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/dependencies/v2/scanoss_dependencies_pb2_grpc.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/scanning/__init__.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/scanning/v2/__init__.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/scanning/v2/scanoss_scanning_pb2.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/scanning/v2/scanoss_scanning_pb2_grpc.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/semgrep/__init__.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/semgrep/v2/__init__.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/semgrep/v2/scanoss_semgrep_pb2.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/semgrep/v2/scanoss_semgrep_pb2_grpc.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/vulnerabilities/__init__.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/vulnerabilities/v2/__init__.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2_grpc.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/components.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/csvoutput.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/data/scanoss-settings-schema.json +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/data/spdx-exceptions.json +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/data/spdx-licenses.json +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/file_filters.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/filecount.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/inspection/__init__.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/inspection/copyleft.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/inspection/policy_check.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/inspection/undeclared_component.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/inspection/utils/license_utils.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/results.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/scancodedeps.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/scanner.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/scanossapi.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/scanossbase.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/scanossgrpc.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/scanpostprocessor.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/scantype.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/spdxlite.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/threadeddependencies.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/threadedscanning.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/utils/__init__.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/winnowing.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss.egg-info/SOURCES.txt +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss.egg-info/dependency_links.txt +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss.egg-info/entry_points.txt +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss.egg-info/requires.txt +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss.egg-info/top_level.txt +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/tests/test_csv_output.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/tests/test_file_filters.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/tests/test_policy_inspect.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/tests/test_scan_post_processor.py +0 -0
- {scanoss-1.19.4 → scanoss-1.19.6}/tests/test_winnowing.py +0 -0
|
@@ -575,11 +575,11 @@ def scan(parser, args):
|
|
|
575
575
|
scan_settings = ScanossSettings(debug=args.debug, trace=args.trace, quiet=args.quiet)
|
|
576
576
|
try:
|
|
577
577
|
if args.identify:
|
|
578
|
-
scan_settings.load_json_file(args.identify).set_file_type('legacy').set_scan_type('identify')
|
|
578
|
+
scan_settings.load_json_file(args.identify, args.scan_dir).set_file_type('legacy').set_scan_type('identify')
|
|
579
579
|
elif args.ignore:
|
|
580
|
-
scan_settings.load_json_file(args.ignore).set_file_type('legacy').set_scan_type('blacklist')
|
|
580
|
+
scan_settings.load_json_file(args.ignore, args.scan_dir).set_file_type('legacy').set_scan_type('blacklist')
|
|
581
581
|
else:
|
|
582
|
-
scan_settings.load_json_file(args.settings).set_file_type('new').set_scan_type('identify')
|
|
582
|
+
scan_settings.load_json_file(args.settings, args.scan_dir).set_file_type('new').set_scan_type('identify')
|
|
583
583
|
except ScanossSettingsError as e:
|
|
584
584
|
print_stderr(f'Error: {e}')
|
|
585
585
|
exit(1)
|
|
@@ -197,12 +197,12 @@ class CycloneDx(ScanossBase):
|
|
|
197
197
|
'name': 'scanoss-py',
|
|
198
198
|
'version': __version__,
|
|
199
199
|
}
|
|
200
|
-
]
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
200
|
+
],
|
|
201
|
+
'component': {
|
|
202
|
+
'type': 'application',
|
|
203
|
+
'name': 'NOASSERTION',
|
|
204
|
+
'version': 'NOASSERTION'
|
|
205
|
+
}
|
|
206
206
|
},
|
|
207
207
|
'components': [],
|
|
208
208
|
'vulnerabilities': []
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
date: 20250130190618, utime: 1738263978
|
|
@@ -30,9 +30,9 @@ import importlib_resources
|
|
|
30
30
|
from jsonschema import validate
|
|
31
31
|
|
|
32
32
|
from .scanossbase import ScanossBase
|
|
33
|
-
from .utils.file import validate_json_file
|
|
33
|
+
from .utils.file import JSON_ERROR_FILE_NOT_FOUND, JSON_ERROR_FILE_EMPTY, validate_json_file
|
|
34
34
|
|
|
35
|
-
DEFAULT_SCANOSS_JSON_FILE = 'scanoss.json'
|
|
35
|
+
DEFAULT_SCANOSS_JSON_FILE = Path('scanoss.json')
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
class BomEntry(TypedDict, total=False):
|
|
@@ -96,16 +96,20 @@ class ScanossSettings(ScanossBase):
|
|
|
96
96
|
if filepath:
|
|
97
97
|
self.load_json_file(filepath)
|
|
98
98
|
|
|
99
|
-
def load_json_file(self, filepath: 'str | None' = None) -> 'ScanossSettings':
|
|
99
|
+
def load_json_file(self, filepath: 'str | None' = None, scan_root: 'str | None' = None) -> 'ScanossSettings':
|
|
100
100
|
"""
|
|
101
101
|
Load the scan settings file. If no filepath is provided, scanoss.json will be used as default.
|
|
102
102
|
|
|
103
103
|
Args:
|
|
104
104
|
filepath (str): Path to the SCANOSS settings file
|
|
105
105
|
"""
|
|
106
|
+
|
|
106
107
|
if not filepath:
|
|
107
108
|
filepath = DEFAULT_SCANOSS_JSON_FILE
|
|
108
|
-
|
|
109
|
+
|
|
110
|
+
filepath = Path(scan_root) / filepath if scan_root else Path(filepath)
|
|
111
|
+
|
|
112
|
+
json_file = filepath.resolve()
|
|
109
113
|
|
|
110
114
|
if filepath == DEFAULT_SCANOSS_JSON_FILE and not json_file.exists():
|
|
111
115
|
self.print_debug(f'Default settings file "{filepath}" not found. Skipping...')
|
|
@@ -114,7 +118,11 @@ class ScanossSettings(ScanossBase):
|
|
|
114
118
|
|
|
115
119
|
result = validate_json_file(json_file)
|
|
116
120
|
if not result.is_valid:
|
|
117
|
-
|
|
121
|
+
if result.error_code == JSON_ERROR_FILE_NOT_FOUND or result.error_code == JSON_ERROR_FILE_EMPTY:
|
|
122
|
+
self.print_msg(f'WARNING: The supplied settings file "{filepath}" was not found or is empty. Skipping...')
|
|
123
|
+
return self
|
|
124
|
+
else:
|
|
125
|
+
raise ScanossSettingsError(f'Problem with settings file. {result.error}')
|
|
118
126
|
try:
|
|
119
127
|
validate(result.data, self.schema)
|
|
120
128
|
except Exception as e:
|
|
@@ -21,18 +21,24 @@ SPDX-License-Identifier: MIT
|
|
|
21
21
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
22
|
THE SOFTWARE.
|
|
23
23
|
"""
|
|
24
|
+
|
|
24
25
|
import json
|
|
25
26
|
import os
|
|
26
|
-
import sys
|
|
27
27
|
from dataclasses import dataclass
|
|
28
28
|
from typing import Optional
|
|
29
29
|
|
|
30
|
+
JSON_ERROR_PARSE = 1
|
|
31
|
+
JSON_ERROR_FILE_NOT_FOUND = 2
|
|
32
|
+
JSON_ERROR_FILE_EMPTY = 3
|
|
33
|
+
JSON_ERROR_FILE_SIZE = 4
|
|
34
|
+
|
|
30
35
|
|
|
31
36
|
@dataclass
|
|
32
37
|
class JsonValidation:
|
|
33
38
|
is_valid: bool
|
|
34
39
|
data: Optional[dict] = None
|
|
35
40
|
error: Optional[str] = None
|
|
41
|
+
error_code: Optional[int] = None
|
|
36
42
|
|
|
37
43
|
|
|
38
44
|
def validate_json_file(json_file_path: str) -> JsonValidation:
|
|
@@ -46,12 +52,33 @@ def validate_json_file(json_file_path: str) -> JsonValidation:
|
|
|
46
52
|
Tuple[bool, str]: A tuple containing a boolean indicating if the file is valid and a message
|
|
47
53
|
"""
|
|
48
54
|
if not json_file_path:
|
|
49
|
-
return JsonValidation(is_valid=False, error=
|
|
55
|
+
return JsonValidation(is_valid=False, error="No JSON file specified")
|
|
50
56
|
if not os.path.isfile(json_file_path):
|
|
51
|
-
return JsonValidation(
|
|
57
|
+
return JsonValidation(
|
|
58
|
+
is_valid=False,
|
|
59
|
+
error=f"File not found: {json_file_path}",
|
|
60
|
+
error_code=JSON_ERROR_FILE_NOT_FOUND,
|
|
61
|
+
)
|
|
62
|
+
try:
|
|
63
|
+
if os.stat(json_file_path).st_size == 0:
|
|
64
|
+
return JsonValidation(
|
|
65
|
+
is_valid=False,
|
|
66
|
+
error=f"File is empty: {json_file_path}",
|
|
67
|
+
error_code=JSON_ERROR_FILE_EMPTY,
|
|
68
|
+
)
|
|
69
|
+
except OSError as e:
|
|
70
|
+
return JsonValidation(
|
|
71
|
+
is_valid=False,
|
|
72
|
+
error=f"Problem checking file size: {json_file_path}: {e}",
|
|
73
|
+
error_code=JSON_ERROR_FILE_SIZE,
|
|
74
|
+
)
|
|
52
75
|
try:
|
|
53
76
|
with open(json_file_path) as f:
|
|
54
77
|
data = json.load(f)
|
|
55
78
|
return JsonValidation(is_valid=True, data=data)
|
|
56
79
|
except json.JSONDecodeError as e:
|
|
57
|
-
return JsonValidation(
|
|
80
|
+
return JsonValidation(
|
|
81
|
+
is_valid=False,
|
|
82
|
+
error=f'Problem parsing JSON file: "{json_file_path}": {e}',
|
|
83
|
+
error_code=JSON_ERROR_PARSE,
|
|
84
|
+
)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
date: 20250108144949, utime: 1736347789
|
|
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.19.4 → scanoss-1.19.6}/src/scanoss/api/components/v2/scanoss_components_pb2_grpc.py
RENAMED
|
File without changes
|
{scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/cryptography/v2/scanoss_cryptography_pb2.py
RENAMED
|
File without changes
|
{scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/cryptography/v2/scanoss_cryptography_pb2_grpc.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scanoss-1.19.4 → scanoss-1.19.6}/src/scanoss/api/dependencies/v2/scanoss_dependencies_pb2.py
RENAMED
|
File without changes
|
{scanoss-1.19.4 → scanoss-1.19.6}/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.19.4 → scanoss-1.19.6}/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
|