scanoss 1.18.1__tar.gz → 1.19.0__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.18.1/src/scanoss.egg-info → scanoss-1.19.0}/PKG-INFO +3 -1
- {scanoss-1.18.1 → scanoss-1.19.0}/setup.cfg +2 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/__init__.py +1 -1
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/cli.py +63 -79
- scanoss-1.19.0/src/scanoss/data/build_date.txt +1 -0
- scanoss-1.19.0/src/scanoss/data/scanoss-settings-schema.json +254 -0
- scanoss-1.19.0/src/scanoss/file_filters.py +525 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/scanner.py +163 -266
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/scanoss_settings.py +105 -40
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/scanpostprocessor.py +89 -81
- scanoss-1.19.0/src/scanoss/utils/__init__.py +23 -0
- scanoss-1.19.0/src/scanoss/utils/file.py +57 -0
- {scanoss-1.18.1 → scanoss-1.19.0/src/scanoss.egg-info}/PKG-INFO +3 -1
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss.egg-info/SOURCES.txt +5 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss.egg-info/requires.txt +2 -0
- scanoss-1.19.0/tests/test_file_filters.py +321 -0
- scanoss-1.18.1/src/scanoss/data/build_date.txt +0 -1
- {scanoss-1.18.1 → scanoss-1.19.0}/LICENSE +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/PACKAGE.md +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/README.md +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/pyproject.toml +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/protoc_gen_swagger/__init__.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/protoc_gen_swagger/options/__init__.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/protoc_gen_swagger/options/annotations_pb2.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/protoc_gen_swagger/options/annotations_pb2_grpc.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/protoc_gen_swagger/options/openapiv2_pb2.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/protoc_gen_swagger/options/openapiv2_pb2_grpc.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/__init__.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/common/__init__.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/common/v2/__init__.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/common/v2/scanoss_common_pb2.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/common/v2/scanoss_common_pb2_grpc.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/components/__init__.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/components/v2/__init__.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/components/v2/scanoss_components_pb2.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/components/v2/scanoss_components_pb2_grpc.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/cryptography/v2/scanoss_cryptography_pb2.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/cryptography/v2/scanoss_cryptography_pb2_grpc.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/dependencies/__init__.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/dependencies/v2/__init__.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/dependencies/v2/scanoss_dependencies_pb2.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/dependencies/v2/scanoss_dependencies_pb2_grpc.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/scanning/__init__.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/scanning/v2/__init__.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/scanning/v2/scanoss_scanning_pb2.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/scanning/v2/scanoss_scanning_pb2_grpc.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/semgrep/__init__.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/semgrep/v2/__init__.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/semgrep/v2/scanoss_semgrep_pb2.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/semgrep/v2/scanoss_semgrep_pb2_grpc.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/vulnerabilities/__init__.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/vulnerabilities/v2/__init__.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2_grpc.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/components.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/csvoutput.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/cyclonedx.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/data/spdx-exceptions.json +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/data/spdx-licenses.json +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/filecount.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/inspection/__init__.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/inspection/copyleft.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/inspection/policy_check.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/inspection/undeclared_component.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/inspection/utils/license_utils.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/results.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/scancodedeps.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/scanossapi.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/scanossbase.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/scanossgrpc.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/scantype.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/spdxlite.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/threadeddependencies.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/threadedscanning.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss/winnowing.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss.egg-info/dependency_links.txt +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss.egg-info/entry_points.txt +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/src/scanoss.egg-info/top_level.txt +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/tests/test_csv_output.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/tests/test_policy_inspect.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/tests/test_scan_post_processor.py +0 -0
- {scanoss-1.18.1 → scanoss-1.19.0}/tests/test_winnowing.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: scanoss
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.19.0
|
|
4
4
|
Summary: Simple Python library to leverage the SCANOSS APIs
|
|
5
5
|
Home-page: https://scanoss.com
|
|
6
6
|
Author: SCANOSS
|
|
@@ -27,6 +27,8 @@ Requires-Dist: pyOpenSSL
|
|
|
27
27
|
Requires-Dist: google-api-core
|
|
28
28
|
Requires-Dist: importlib_resources
|
|
29
29
|
Requires-Dist: packageurl-python
|
|
30
|
+
Requires-Dist: pathspec
|
|
31
|
+
Requires-Dist: jsonschema
|
|
30
32
|
Provides-Extra: fast-winnowing
|
|
31
33
|
Requires-Dist: scanoss_winnowing>=0.5.0; extra == "fast-winnowing"
|
|
32
34
|
|
|
@@ -30,7 +30,7 @@ import pypac
|
|
|
30
30
|
from .inspection.copyleft import Copyleft
|
|
31
31
|
from .inspection.undeclared_component import UndeclaredComponent
|
|
32
32
|
from .threadeddependencies import SCOPE
|
|
33
|
-
from .scanoss_settings import ScanossSettings
|
|
33
|
+
from .scanoss_settings import ScanossSettings, ScanossSettingsError
|
|
34
34
|
from .scancodedeps import ScancodeDeps
|
|
35
35
|
from .scanner import Scanner
|
|
36
36
|
from .scantype import ScanType
|
|
@@ -42,6 +42,7 @@ from .components import Components
|
|
|
42
42
|
from . import __version__
|
|
43
43
|
from .scanner import FAST_WINNOWING
|
|
44
44
|
from .results import Results
|
|
45
|
+
from .utils.file import validate_json_file
|
|
45
46
|
|
|
46
47
|
|
|
47
48
|
def print_stderr(*args, **kwargs):
|
|
@@ -109,11 +110,14 @@ def setup_args() -> None:
|
|
|
109
110
|
p_scan.add_argument('--dep-scope-inc', '-dsi', type=str,help='Include dependencies with declared scopes')
|
|
110
111
|
p_scan.add_argument('--dep-scope-exc', '-dse', type=str, help='Exclude dependencies with declared scopes')
|
|
111
112
|
p_scan.add_argument(
|
|
112
|
-
'--settings',
|
|
113
|
+
'--settings', '-st',
|
|
113
114
|
type=str,
|
|
114
115
|
help='Settings file to use for scanning (optional - default scanoss.json)',
|
|
115
116
|
)
|
|
116
|
-
|
|
117
|
+
p_scan.add_argument(
|
|
118
|
+
'--skip-settings-file', '-stf', action='store_true',
|
|
119
|
+
help='Skip default settings file (scanoss.json) if it exists',
|
|
120
|
+
)
|
|
117
121
|
|
|
118
122
|
# Sub-command: fingerprint
|
|
119
123
|
p_wfp = subparsers.add_parser('fingerprint', aliases=['fp', 'wfp'],
|
|
@@ -125,6 +129,15 @@ def setup_args() -> None:
|
|
|
125
129
|
p_wfp.add_argument('--stdin', '-s', metavar='STDIN-FILENAME', type=str,
|
|
126
130
|
help='Fingerprint the file contents supplied via STDIN (optional)')
|
|
127
131
|
p_wfp.add_argument('--output', '-o', type=str, help='Output result file name (optional - default stdout).')
|
|
132
|
+
p_wfp.add_argument(
|
|
133
|
+
'--settings', '-st',
|
|
134
|
+
type=str,
|
|
135
|
+
help='Settings file to use for fingerprinting (optional - default scanoss.json)',
|
|
136
|
+
)
|
|
137
|
+
p_wfp.add_argument(
|
|
138
|
+
'--skip-settings-file', '-stf', action='store_true',
|
|
139
|
+
help='Skip default settings file (scanoss.json) if it exists',
|
|
140
|
+
)
|
|
128
141
|
|
|
129
142
|
# Sub-command: dependency
|
|
130
143
|
p_dep = subparsers.add_parser('dependencies', aliases=['dp', 'dep'],
|
|
@@ -460,13 +473,24 @@ def wfp(parser, args):
|
|
|
460
473
|
if args.output:
|
|
461
474
|
scan_output = args.output
|
|
462
475
|
open(scan_output, 'w').close()
|
|
476
|
+
|
|
477
|
+
# Load scan settings
|
|
478
|
+
scan_settings = None
|
|
479
|
+
if not args.skip_settings_file:
|
|
480
|
+
scan_settings = ScanossSettings(debug=args.debug, trace=args.trace, quiet=args.quiet)
|
|
481
|
+
try:
|
|
482
|
+
scan_settings.load_json_file(args.settings)
|
|
483
|
+
except ScanossSettingsError as e:
|
|
484
|
+
print_stderr(f'Error: {e}')
|
|
485
|
+
exit(1)
|
|
463
486
|
|
|
464
487
|
scan_options = 0 if args.skip_snippets else ScanType.SCAN_SNIPPETS.value # Skip snippet generation or not
|
|
465
488
|
scanner = Scanner(debug=args.debug, trace=args.trace, quiet=args.quiet, obfuscate=args.obfuscate,
|
|
466
489
|
scan_options=scan_options, all_extensions=args.all_extensions,
|
|
467
490
|
all_folders=args.all_folders, hidden_files_folders=args.all_hidden, hpsm=args.hpsm,
|
|
468
491
|
skip_size=args.skip_size, skip_extensions=args.skip_extension, skip_folders=args.skip_folder,
|
|
469
|
-
skip_md5_ids=args.skip_md5, strip_hpsm_ids=args.strip_hpsm, strip_snippet_ids=args.strip_snippet
|
|
492
|
+
skip_md5_ids=args.skip_md5, strip_hpsm_ids=args.strip_hpsm, strip_snippet_ids=args.strip_snippet,
|
|
493
|
+
scan_settings=scan_settings
|
|
470
494
|
)
|
|
471
495
|
if args.stdin:
|
|
472
496
|
contents = sys.stdin.buffer.read()
|
|
@@ -529,13 +553,7 @@ def scan(parser, args):
|
|
|
529
553
|
args: Namespace
|
|
530
554
|
Parsed arguments
|
|
531
555
|
"""
|
|
532
|
-
if
|
|
533
|
-
not args.scan_dir
|
|
534
|
-
and not args.wfp
|
|
535
|
-
and not args.stdin
|
|
536
|
-
and not args.dep
|
|
537
|
-
and not args.files
|
|
538
|
-
):
|
|
556
|
+
if not args.scan_dir and not args.wfp and not args.stdin and not args.dep and not args.files:
|
|
539
557
|
print_stderr(
|
|
540
558
|
'Please specify a file/folder, files (--files), fingerprint (--wfp), dependency (--dep), or STDIN (--stdin)'
|
|
541
559
|
)
|
|
@@ -545,54 +563,36 @@ def scan(parser, args):
|
|
|
545
563
|
print_stderr('Please specify one of --proxy or --pac, not both')
|
|
546
564
|
parser.parse_args([args.subparser, '-h'])
|
|
547
565
|
exit(1)
|
|
548
|
-
|
|
549
566
|
if args.identify and args.settings:
|
|
550
|
-
print_stderr(
|
|
567
|
+
print_stderr('ERROR: Cannot specify both --identify and --settings options.')
|
|
551
568
|
exit(1)
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
scan_settings.load_json_file(args.identify).set_file_type(
|
|
569
|
-
'legacy'
|
|
570
|
-
).set_scan_type('identify')
|
|
571
|
-
elif args.ignore:
|
|
572
|
-
if not is_valid_file(args.ignore):
|
|
573
|
-
exit(1)
|
|
574
|
-
scan_settings.load_json_file(args.ignore).set_file_type('legacy').set_scan_type(
|
|
575
|
-
'blacklist'
|
|
576
|
-
)
|
|
577
|
-
elif args.settings:
|
|
578
|
-
if not is_valid_file(args.settings):
|
|
569
|
+
if args.settings and args.skip_settings_file:
|
|
570
|
+
print_stderr('ERROR: Cannot specify both --settings and --skip-file-settings options.')
|
|
571
|
+
exit(1)
|
|
572
|
+
# Figure out which settings (if any) to load before processing
|
|
573
|
+
scan_settings = None
|
|
574
|
+
if not args.skip_settings_file:
|
|
575
|
+
scan_settings = ScanossSettings(debug=args.debug, trace=args.trace, quiet=args.quiet)
|
|
576
|
+
try:
|
|
577
|
+
if args.identify:
|
|
578
|
+
scan_settings.load_json_file(args.identify).set_file_type('legacy').set_scan_type('identify')
|
|
579
|
+
elif args.ignore:
|
|
580
|
+
scan_settings.load_json_file(args.ignore).set_file_type('legacy').set_scan_type('blacklist')
|
|
581
|
+
else:
|
|
582
|
+
scan_settings.load_json_file(args.settings).set_file_type('new').set_scan_type('identify')
|
|
583
|
+
except ScanossSettingsError as e:
|
|
584
|
+
print_stderr(f'Error: {e}')
|
|
579
585
|
exit(1)
|
|
580
|
-
scan_settings.load_json_file(args.settings).set_file_type('new').set_scan_type(
|
|
581
|
-
'identify'
|
|
582
|
-
)
|
|
583
|
-
|
|
584
586
|
if args.dep:
|
|
585
587
|
if not os.path.exists(args.dep) or not os.path.isfile(args.dep):
|
|
586
|
-
print_stderr(
|
|
587
|
-
f'Specified --dep file does not exist or is not a file: {args.dep}'
|
|
588
|
-
)
|
|
588
|
+
print_stderr(f'Specified --dep file does not exist or is not a file: {args.dep}')
|
|
589
589
|
exit(1)
|
|
590
|
-
|
|
590
|
+
result = validate_json_file(args.dep)
|
|
591
|
+
if not result.is_valid:
|
|
592
|
+
print_stderr(f'Error: Dependency file is not valid: {result.error}')
|
|
591
593
|
exit(1)
|
|
592
594
|
if args.strip_hpsm and not args.hpsm and not args.quiet:
|
|
593
|
-
print_stderr(
|
|
594
|
-
f'Warning: --strip-hpsm option supplied without enabling HPSM (--hpsm). Ignoring.'
|
|
595
|
-
)
|
|
595
|
+
print_stderr('Warning: --strip-hpsm option supplied without enabling HPSM (--hpsm). Ignoring.')
|
|
596
596
|
|
|
597
597
|
scan_output: str = None
|
|
598
598
|
if args.output:
|
|
@@ -601,6 +601,8 @@ def scan(parser, args):
|
|
|
601
601
|
output_format = args.format if args.format else 'plain'
|
|
602
602
|
flags = args.flags if args.flags else None
|
|
603
603
|
if args.debug and not args.quiet:
|
|
604
|
+
if args.skip_settings_file:
|
|
605
|
+
print_stderr('Skipping Settings file...')
|
|
604
606
|
if args.all_extensions:
|
|
605
607
|
print_stderr("Scanning all file extensions/types...")
|
|
606
608
|
if args.all_folders:
|
|
@@ -631,17 +633,11 @@ def scan(parser, args):
|
|
|
631
633
|
print_stderr(f'Using flags {flags}...')
|
|
632
634
|
elif not args.quiet:
|
|
633
635
|
if args.timeout < 5:
|
|
634
|
-
print_stderr(
|
|
635
|
-
f'POST timeout (--timeout) too small: {args.timeout}. Reverting to default.'
|
|
636
|
-
)
|
|
636
|
+
print_stderr(f'POST timeout (--timeout) too small: {args.timeout}. Reverting to default.')
|
|
637
637
|
if args.retry < 0:
|
|
638
|
-
print_stderr(
|
|
639
|
-
f'POST retry (--retry) too small: {args.retry}. Reverting to default.'
|
|
640
|
-
)
|
|
638
|
+
print_stderr(f'POST retry (--retry) too small: {args.retry}. Reverting to default.')
|
|
641
639
|
|
|
642
|
-
if not os.access(
|
|
643
|
-
os.getcwd(), os.W_OK
|
|
644
|
-
): # Make sure the current directory is writable. If not disable saving WFP
|
|
640
|
+
if not os.access(os.getcwd(), os.W_OK): # Make sure the current directory is writable. If not disable saving WFP
|
|
645
641
|
print_stderr(f'Warning: Current directory is not writable: {os.getcwd()}')
|
|
646
642
|
args.no_wfp_output = True
|
|
647
643
|
if args.ca_cert and not os.path.exists(args.ca_cert):
|
|
@@ -651,11 +647,8 @@ def scan(parser, args):
|
|
|
651
647
|
scan_options = get_scan_options(args) # Figure out what scanning options we have
|
|
652
648
|
|
|
653
649
|
scanner = Scanner(
|
|
654
|
-
debug=args.debug,
|
|
655
|
-
|
|
656
|
-
quiet=args.quiet,
|
|
657
|
-
api_key=args.key,
|
|
658
|
-
url=args.apiurl,
|
|
650
|
+
debug=args.debug, trace=args.trace, quiet=args.quiet,
|
|
651
|
+
api_key=args.key, url=args.apiurl,
|
|
659
652
|
scan_output=scan_output,
|
|
660
653
|
output_format=output_format,
|
|
661
654
|
flags=flags,
|
|
@@ -684,19 +677,14 @@ def scan(parser, args):
|
|
|
684
677
|
skip_md5_ids=args.skip_md5,
|
|
685
678
|
strip_hpsm_ids=args.strip_hpsm,
|
|
686
679
|
strip_snippet_ids=args.strip_snippet,
|
|
687
|
-
scan_settings=scan_settings
|
|
680
|
+
scan_settings=scan_settings,
|
|
688
681
|
)
|
|
689
|
-
|
|
690
682
|
if args.wfp:
|
|
691
683
|
if not scanner.is_file_or_snippet_scan():
|
|
692
|
-
print_stderr(
|
|
693
|
-
f'Error: Cannot specify WFP scanning if file/snippet options are disabled ({scan_options})'
|
|
694
|
-
)
|
|
684
|
+
print_stderr(f'Error: Cannot specify WFP scanning if file/snippet options are disabled ({scan_options})')
|
|
695
685
|
exit(1)
|
|
696
686
|
if scanner.is_dependency_scan() and not args.dep:
|
|
697
|
-
print_stderr(
|
|
698
|
-
f'Error: Cannot specify WFP & Dependency scanning without a dependency file (--dep)'
|
|
699
|
-
)
|
|
687
|
+
print_stderr(f'Error: Cannot specify WFP & Dependency scanning without a dependency file (--dep)')
|
|
700
688
|
exit(1)
|
|
701
689
|
scanner.scan_wfp_with_options(args.wfp, args.dep)
|
|
702
690
|
elif args.stdin:
|
|
@@ -710,9 +698,7 @@ def scan(parser, args):
|
|
|
710
698
|
exit(1)
|
|
711
699
|
elif args.scan_dir:
|
|
712
700
|
if not os.path.exists(args.scan_dir):
|
|
713
|
-
print_stderr(
|
|
714
|
-
f'Error: File or folder specified does not exist: {args.scan_dir}.'
|
|
715
|
-
)
|
|
701
|
+
print_stderr(f'Error: File or folder specified does not exist: {args.scan_dir}.')
|
|
716
702
|
exit(1)
|
|
717
703
|
if os.path.isdir(args.scan_dir):
|
|
718
704
|
if not scanner.scan_folder_with_options(args.scan_dir, args.dep, scanner.winnowing.file_map,
|
|
@@ -723,9 +709,7 @@ def scan(parser, args):
|
|
|
723
709
|
args.dep_scope, args.dep_scope_inc, args.dep_scope_exc):
|
|
724
710
|
exit(1)
|
|
725
711
|
else:
|
|
726
|
-
print_stderr(
|
|
727
|
-
f'Error: Path specified is neither a file or a folder: {args.scan_dir}.'
|
|
728
|
-
)
|
|
712
|
+
print_stderr(f'Error: Path specified is neither a file or a folder: {args.scan_dir}.')
|
|
729
713
|
exit(1)
|
|
730
714
|
elif args.dep:
|
|
731
715
|
if not args.dependencies_only:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
date: 20241220152032, utime: 1734708032
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"title": "Scanoss Settings",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"self": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"description": "Description of the project under analysis",
|
|
9
|
+
"properties": {
|
|
10
|
+
"name": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "Name of the project"
|
|
13
|
+
},
|
|
14
|
+
"license": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "License of the project"
|
|
17
|
+
},
|
|
18
|
+
"description": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "Description of the project"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"settings": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"description": "Scan settings and other configurations",
|
|
27
|
+
"properties": {
|
|
28
|
+
"skip": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"description": "Set of rules to skip files from fingerprinting and scanning",
|
|
31
|
+
"properties": {
|
|
32
|
+
"patterns": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"properties": {
|
|
35
|
+
"scanning": {
|
|
36
|
+
"type": "array",
|
|
37
|
+
"description": "List of glob patterns to skip files from scanning",
|
|
38
|
+
"items": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"examples": [
|
|
41
|
+
"path/to/folder",
|
|
42
|
+
"path/to/folder/**",
|
|
43
|
+
"path/to/folder/**/*",
|
|
44
|
+
"path/to/file.c",
|
|
45
|
+
"path/to/another/file.py",
|
|
46
|
+
"**/*.ts",
|
|
47
|
+
"**/*.json"
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
"uniqueItems": true
|
|
51
|
+
},
|
|
52
|
+
"fingerprinting": {
|
|
53
|
+
"type": "array",
|
|
54
|
+
"description": "List of glob patterns to skip files from fingerprinting",
|
|
55
|
+
"items": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"examples": [
|
|
58
|
+
"path/to/folder",
|
|
59
|
+
"path/to/folder/**",
|
|
60
|
+
"path/to/folder/**/*",
|
|
61
|
+
"path/to/file.c",
|
|
62
|
+
"path/to/another/file.py",
|
|
63
|
+
"**/*.ts",
|
|
64
|
+
"**/*.json"
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
"uniqueItems": true
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"sizes": {
|
|
72
|
+
"type": "object",
|
|
73
|
+
"description": "Set of rules to skip files based on their size.",
|
|
74
|
+
"properties": {
|
|
75
|
+
"scanning": {
|
|
76
|
+
"type": "array",
|
|
77
|
+
"items": {
|
|
78
|
+
"type": "object",
|
|
79
|
+
"properties": {
|
|
80
|
+
"patterns": {
|
|
81
|
+
"type": "array",
|
|
82
|
+
"description": "List of glob patterns to apply the min/max size rule",
|
|
83
|
+
"items": {
|
|
84
|
+
"type": "string",
|
|
85
|
+
"examples": [
|
|
86
|
+
"path/to/folder",
|
|
87
|
+
"path/to/folder/**",
|
|
88
|
+
"path/to/folder/**/*",
|
|
89
|
+
"path/to/file.c",
|
|
90
|
+
"path/to/another/file.py",
|
|
91
|
+
"**/*.ts",
|
|
92
|
+
"**/*.json"
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"min": {
|
|
97
|
+
"type": "integer",
|
|
98
|
+
"description": "Minimum size of the file in bytes"
|
|
99
|
+
},
|
|
100
|
+
"max": {
|
|
101
|
+
"type": "integer",
|
|
102
|
+
"description": "Maximum size of the file in bytes"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"fingerprinting": {
|
|
108
|
+
"type": "array",
|
|
109
|
+
"items": {
|
|
110
|
+
"type": "object",
|
|
111
|
+
"properties": {
|
|
112
|
+
"patterns": {
|
|
113
|
+
"type": "array",
|
|
114
|
+
"description": "List of glob patterns to apply the min/max size rule",
|
|
115
|
+
"items": {
|
|
116
|
+
"type": "string"
|
|
117
|
+
},
|
|
118
|
+
"examples": [
|
|
119
|
+
"path/to/folder",
|
|
120
|
+
"path/to/folder/**",
|
|
121
|
+
"path/to/folder/**/*",
|
|
122
|
+
"path/to/file.c",
|
|
123
|
+
"path/to/another/file.py",
|
|
124
|
+
"**/*.ts",
|
|
125
|
+
"**/*.json"
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
"min": {
|
|
129
|
+
"type": "integer",
|
|
130
|
+
"description": "Minimum size of the file in bytes"
|
|
131
|
+
},
|
|
132
|
+
"max": {
|
|
133
|
+
"type": "integer",
|
|
134
|
+
"description": "Maximum size of the file in bytes"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"bom": {
|
|
146
|
+
"type": "object",
|
|
147
|
+
"description": "BOM Rules: Set of rules that will be used to modify the BOM before and after the scan is completed",
|
|
148
|
+
"properties": {
|
|
149
|
+
"include": {
|
|
150
|
+
"type": "array",
|
|
151
|
+
"description": "Set of rules to be added as context when scanning. This list will be sent as payload to the API.",
|
|
152
|
+
"items": {
|
|
153
|
+
"type": "object",
|
|
154
|
+
"properties": {
|
|
155
|
+
"path": {
|
|
156
|
+
"type": "string",
|
|
157
|
+
"description": "File path",
|
|
158
|
+
"examples": ["/path/to/file", "/path/to/another/file"],
|
|
159
|
+
"items": {
|
|
160
|
+
"type": "string"
|
|
161
|
+
},
|
|
162
|
+
"uniqueItems": true
|
|
163
|
+
},
|
|
164
|
+
"purl": {
|
|
165
|
+
"type": "string",
|
|
166
|
+
"description": "Package URL to be used to match the component",
|
|
167
|
+
"examples": [
|
|
168
|
+
"pkg:npm/vue@2.6.12",
|
|
169
|
+
"pkg:golang/github.com/golang/go@1.17.3"
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
"comment": {
|
|
173
|
+
"type": "string",
|
|
174
|
+
"description": "Additional notes or comments"
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"uniqueItems": true,
|
|
178
|
+
"required": ["purl"]
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
"remove": {
|
|
182
|
+
"type": "array",
|
|
183
|
+
"description": "Set of rules that will remove files from the results file after the scan is completed.",
|
|
184
|
+
"items": {
|
|
185
|
+
"type": "object",
|
|
186
|
+
"properties": {
|
|
187
|
+
"path": {
|
|
188
|
+
"type": "string",
|
|
189
|
+
"description": "File path",
|
|
190
|
+
"examples": ["/path/to/file", "/path/to/another/file"]
|
|
191
|
+
},
|
|
192
|
+
"purl": {
|
|
193
|
+
"type": "string",
|
|
194
|
+
"description": "Package URL",
|
|
195
|
+
"examples": [
|
|
196
|
+
"pkg:npm/vue@2.6.12",
|
|
197
|
+
"pkg:golang/github.com/golang/go@1.17.3"
|
|
198
|
+
]
|
|
199
|
+
},
|
|
200
|
+
"comment": {
|
|
201
|
+
"type": "string",
|
|
202
|
+
"description": "Additional notes or comments"
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
"uniqueItems": true,
|
|
206
|
+
"required": ["purl"]
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
"replace": {
|
|
210
|
+
"type": "array",
|
|
211
|
+
"description": "Set of rules that will replace components with the specified one after the scan is completed.",
|
|
212
|
+
"items": {
|
|
213
|
+
"type": "object",
|
|
214
|
+
"properties": {
|
|
215
|
+
"path": {
|
|
216
|
+
"type": "string",
|
|
217
|
+
"description": "File path",
|
|
218
|
+
"examples": ["/path/to/file", "/path/to/another/file"]
|
|
219
|
+
},
|
|
220
|
+
"purl": {
|
|
221
|
+
"type": "string",
|
|
222
|
+
"description": "Package URL to replace",
|
|
223
|
+
"examples": [
|
|
224
|
+
"pkg:npm/vue@2.6.12",
|
|
225
|
+
"pkg:golang/github.com/golang/go@1.17.3"
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
"comment": {
|
|
229
|
+
"type": "string",
|
|
230
|
+
"description": "Additional notes or comments"
|
|
231
|
+
},
|
|
232
|
+
"license": {
|
|
233
|
+
"type": "string",
|
|
234
|
+
"description": "License of the component. Should be a valid SPDX license expression",
|
|
235
|
+
"examples": ["MIT", "Apache-2.0"]
|
|
236
|
+
},
|
|
237
|
+
"replace_with": {
|
|
238
|
+
"type": "string",
|
|
239
|
+
"description": "Package URL to replace with",
|
|
240
|
+
"examples": [
|
|
241
|
+
"pkg:npm/vue@2.6.12",
|
|
242
|
+
"pkg:golang/github.com/golang/go@1.17.3"
|
|
243
|
+
]
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"uniqueItems": true,
|
|
247
|
+
"required": ["purl", "replace_with"]
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|