boman-cli 2.5.11__tar.gz → 2.5.13__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.
- {boman_cli-2.5.11 → boman_cli-2.5.13}/PKG-INFO +1 -1
- {boman_cli-2.5.11 → boman_cli-2.5.13}/boman_cli.egg-info/PKG-INFO +1 -1
- {boman_cli-2.5.11 → boman_cli-2.5.13}/bomancli/Config.py +10 -4
- {boman_cli-2.5.11 → boman_cli-2.5.13}/bomancli/main.py +80 -71
- {boman_cli-2.5.11 → boman_cli-2.5.13}/setup.cfg +1 -1
- {boman_cli-2.5.11 → boman_cli-2.5.13}/README.md +0 -0
- {boman_cli-2.5.11 → boman_cli-2.5.13}/boman_cli.egg-info/SOURCES.txt +0 -0
- {boman_cli-2.5.11 → boman_cli-2.5.13}/boman_cli.egg-info/dependency_links.txt +0 -0
- {boman_cli-2.5.11 → boman_cli-2.5.13}/boman_cli.egg-info/entry_points.txt +0 -0
- {boman_cli-2.5.11 → boman_cli-2.5.13}/boman_cli.egg-info/requires.txt +0 -0
- {boman_cli-2.5.11 → boman_cli-2.5.13}/boman_cli.egg-info/top_level.txt +0 -0
- {boman_cli-2.5.11 → boman_cli-2.5.13}/bomancli/_init_.py +0 -0
- {boman_cli-2.5.11 → boman_cli-2.5.13}/bomancli/auth.py +0 -0
- {boman_cli-2.5.11 → boman_cli-2.5.13}/bomancli/base_logger.py +0 -0
- {boman_cli-2.5.11 → boman_cli-2.5.13}/bomancli/dev_attribution.py +0 -0
- {boman_cli-2.5.11 → boman_cli-2.5.13}/bomancli/loc_finder.py +0 -0
- {boman_cli-2.5.11 → boman_cli-2.5.13}/bomancli/sbom_enricher.py +0 -0
- {boman_cli-2.5.11 → boman_cli-2.5.13}/bomancli/templates/template_plan.yaml +0 -0
- {boman_cli-2.5.11 → boman_cli-2.5.13}/bomancli/utils.py +0 -0
- {boman_cli-2.5.11 → boman_cli-2.5.13}/bomancli/validation.py +0 -0
- {boman_cli-2.5.11 → boman_cli-2.5.13}/setup.py +0 -0
|
@@ -121,7 +121,7 @@ class Config:
|
|
|
121
121
|
|
|
122
122
|
log_level = "INFO"
|
|
123
123
|
|
|
124
|
-
version = 'v2.5.
|
|
124
|
+
version = 'v2.5.13'
|
|
125
125
|
|
|
126
126
|
boman_config_file = 'boman.yaml'
|
|
127
127
|
|
|
@@ -167,8 +167,7 @@ class Config:
|
|
|
167
167
|
sbom_scan_status=None
|
|
168
168
|
sbom_target=None
|
|
169
169
|
sbom_output_file=None
|
|
170
|
-
|
|
171
|
-
cache_dir = " --cache-dir /tmp/.trivycache"
|
|
170
|
+
|
|
172
171
|
#IAC scanning
|
|
173
172
|
iac_scan_present=None
|
|
174
173
|
iac_scan_build_dir=None
|
|
@@ -229,4 +228,11 @@ class Config:
|
|
|
229
228
|
|
|
230
229
|
cloc_total_data = None
|
|
231
230
|
|
|
232
|
-
hssc_output_file = 'boman-hssc.csv'
|
|
231
|
+
hssc_output_file = 'boman-hssc.csv'
|
|
232
|
+
|
|
233
|
+
# common for trivy container and sbom scan
|
|
234
|
+
set_cache_dir = False
|
|
235
|
+
cache_dir = " --cache-dir /tmp/.trivycache"
|
|
236
|
+
|
|
237
|
+
#common settings for all scans
|
|
238
|
+
docker_timeout = 600
|
|
@@ -186,7 +186,7 @@ def runImage(data=None,type=None):
|
|
|
186
186
|
|
|
187
187
|
Config.build_dir = Config.sast_build_dir
|
|
188
188
|
container_output = docker.containers.run(docker_image, command_line, volumes={Config.sast_build_dir: {
|
|
189
|
-
'bind': data['bind']}}, user=userid,detach=detach,environment=env_var, remove=True)
|
|
189
|
+
'bind': data['bind']}}, user=userid,detach=detach,environment=env_var, remove=True,timeout=Config.docker_timeout)
|
|
190
190
|
logging.info('SAST Docker: SUCCESS !!!. Message: %s Scan Completed',tool_name)
|
|
191
191
|
|
|
192
192
|
else:
|
|
@@ -194,7 +194,7 @@ def runImage(data=None,type=None):
|
|
|
194
194
|
logging.info('SAST Docker: Preparing %s scan for non jenkins env with %s user ', tool_name ,userid)
|
|
195
195
|
Config.build_dir = Config.sast_build_dir
|
|
196
196
|
container_output = docker.containers.run(docker_image, command_line, volumes={Config.sast_build_dir: {
|
|
197
|
-
'bind': data['bind']}},user=userid,detach=detach,environment=env_var)
|
|
197
|
+
'bind': data['bind']}},user=userid,detach=detach,environment=env_var,remove=True,timeout=Config.docker_timeout)
|
|
198
198
|
logging.info('SAST Docker: SUCCESS !!!. Message: %s Scan Completed',tool_name)
|
|
199
199
|
|
|
200
200
|
except errors.ContainerError as exc:
|
|
@@ -368,7 +368,7 @@ def runImage(data=None,type=None):
|
|
|
368
368
|
try:
|
|
369
369
|
Config.build_dir = Config.sast_build_dir
|
|
370
370
|
container= docker.containers.run(docker_image, command_line, volumes={Config.sast_build_dir: {
|
|
371
|
-
'bind': data['bind'], 'mode': 'rw'}},user=userid,detach=detach, remove=True)
|
|
371
|
+
'bind': data['bind'], 'mode': 'rw'}},user=userid,detach=detach, remove=True,timeout=Config.docker_timeout)
|
|
372
372
|
|
|
373
373
|
#print(output_file,toolname,tool_id,scan_details_id)
|
|
374
374
|
logging.info('[SUCCESS]: %s Scan Completed',tool_name)
|
|
@@ -396,7 +396,7 @@ def runImage(data=None,type=None):
|
|
|
396
396
|
Config.build_dir = Config.sast_build_dir
|
|
397
397
|
logging.info('DAST Docker: Command for running the scan %s',command_line)
|
|
398
398
|
container= docker.containers.run(docker_image, command_line, volumes={Config.sast_build_dir: {
|
|
399
|
-
'bind': data['bind'], 'mode': 'rw'}},user=userid,detach=detach, remove=True)
|
|
399
|
+
'bind': data['bind'], 'mode': 'rw'}},user=userid,detach=detach, remove=True,timeout=Config.docker_timeout)
|
|
400
400
|
|
|
401
401
|
#print(output_file,toolname,tool_id,scan_details_id)
|
|
402
402
|
logging.info('DAST Docker: SUCCESS!!! Message: %s Scan Completed',tool_name)
|
|
@@ -445,14 +445,14 @@ def runImage(data=None,type=None):
|
|
|
445
445
|
Config.build_dir = Config.sca_build_dir
|
|
446
446
|
command_line = "% s" % command_line.format(target = './'+target)
|
|
447
447
|
container_output = docker.containers.run(docker_image, command_line, volumes={Config.sca_build_dir: {
|
|
448
|
-
'bind': data['bind']}}, user=uid, remove=True)
|
|
448
|
+
'bind': data['bind']}}, user=uid, remove=True,timeout=Config.docker_timeout)
|
|
449
449
|
logging.info('SCA Docker: SUCCESS!!! Message: %s Scan Completed',tool_name)
|
|
450
450
|
else:
|
|
451
451
|
target = Utils.remove_leading_slash(Config.sca_target)
|
|
452
452
|
Config.build_dir = Config.sca_build_dir
|
|
453
453
|
command_line = "% s" % command_line.format(target ='/src/'+target)
|
|
454
454
|
container_output = docker.containers.run(docker_image, command_line, volumes={Config.sca_build_dir: {
|
|
455
|
-
'bind': data['bind']}}, user=uid, remove=True)
|
|
455
|
+
'bind': data['bind']}}, user=uid, remove=True,timeout=Config.docker_timeout)
|
|
456
456
|
logging.info('SCA Docker: SUCCESS!!! Message: %s Scan Completed',tool_name)
|
|
457
457
|
else:
|
|
458
458
|
if Config.sca_ignore:
|
|
@@ -463,7 +463,7 @@ def runImage(data=None,type=None):
|
|
|
463
463
|
logging.info('SCA Docker: Command ==> %s',command_line)
|
|
464
464
|
Config.build_dir = Config.sca_build_dir
|
|
465
465
|
container_output = docker.containers.run(docker_image, command_line, volumes={Config.sca_build_dir: {
|
|
466
|
-
'bind': data['bind']}}, user=uid, remove=True)
|
|
466
|
+
'bind': data['bind']}}, user=uid, remove=True,timeout=Config.docker_timeout)
|
|
467
467
|
logging.info('SCA Docker: SUCCESS!!! Message: %s Scan Completed',tool_name)
|
|
468
468
|
Config.sca_message ='SCA scan completed'
|
|
469
469
|
Config.sca_scan_status ='Completed'
|
|
@@ -511,11 +511,15 @@ def runImage(data=None,type=None):
|
|
|
511
511
|
command_line = "% s" % command_line.format(target = os.path.join('/src',Utils.remove_leading_slash(Config.con_scan_target)))
|
|
512
512
|
else:
|
|
513
513
|
command_line = "% s" % command_line.format(target = Config.con_scan_target)
|
|
514
|
+
|
|
515
|
+
if Config.set_cache_dir:
|
|
516
|
+
command_line = command_line + Config.cache_dir
|
|
517
|
+
logging.info('Container scan Docker: Cache directory is set for the scan, updated command is %s',command_line[-20:])
|
|
514
518
|
|
|
515
|
-
logging.info(f"CS Docker: command ==> {command_line}")
|
|
519
|
+
logging.info(f"CS Docker: command ==> {command_line[-20:]}")
|
|
516
520
|
Config.build_dir = Config.con_scan_build_dir
|
|
517
521
|
container_output = docker.containers.run(docker_image, command_line, volumes={Config.con_scan_build_dir: {
|
|
518
|
-
'bind': data['bind']}}, user=uid, remove=True)
|
|
522
|
+
'bind': data['bind']}}, user=uid, remove=True,timeout=Config.docker_timeout)
|
|
519
523
|
logging.info('CS Docker: SUCCESS!!! Message: %s Scan Completed',tool_name)
|
|
520
524
|
Config.con_scan_message ='Container Scan completed'
|
|
521
525
|
Config.con_scan_status ='Completed'
|
|
@@ -554,7 +558,6 @@ def runImage(data=None,type=None):
|
|
|
554
558
|
|
|
555
559
|
try:
|
|
556
560
|
Config.build_dir = Config.sbom_build_dir = os.getcwd()+'/'
|
|
557
|
-
command_line = "--format cyclonedx --output /src/boman_trivy_sbom_scan.json --scanners vuln fs /{target}"
|
|
558
561
|
command_line = "% s" % command_line.format(target = 'src/')
|
|
559
562
|
#added upon jenkins sbom issue - GM
|
|
560
563
|
if Config.set_cache_dir:
|
|
@@ -562,7 +565,7 @@ def runImage(data=None,type=None):
|
|
|
562
565
|
logging.info('SBOM Docker: Cache directory is set for the scan, updated command is %s',command_line[-20:])
|
|
563
566
|
logging.info(f"SBOM Docker: command ==> {command_line[-20:]}")
|
|
564
567
|
container_output = docker.containers.run(docker_image, command_line, volumes={Config.sbom_build_dir: {
|
|
565
|
-
'bind': data['bind']}}, user=uid, remove=True)
|
|
568
|
+
'bind': data['bind']}}, user=uid, remove=True,timeout=Config.docker_timeout)
|
|
566
569
|
logging.info('SBOM Docker: SUCCESS!!! Message: %s Scan Completed',tool_name)
|
|
567
570
|
Config.sbom_message ='SBOM scan completed'
|
|
568
571
|
Config.sbom_scan_status ='Completed'
|
|
@@ -655,7 +658,7 @@ def runImage(data=None,type=None):
|
|
|
655
658
|
command_line = "% s" % command_line.format(target = os.path.join('/src',Utils.remove_leading_slash(Config.iac_scan_target)))
|
|
656
659
|
Config.build_dir = Config.iac_scan_build_dir
|
|
657
660
|
container_output = docker.containers.run(docker_image, command_line, volumes={Config.iac_scan_build_dir: {
|
|
658
|
-
'bind': data['bind']}}, user=uid, remove=True)
|
|
661
|
+
'bind': data['bind']}}, user=uid, remove=True,timeout=Config.docker_timeout)
|
|
659
662
|
logging.info('IaC Docker: SUCCESS!!! Message: %s Scan Completed',tool_name)
|
|
660
663
|
Config.iac_scan_message ='IaC Scan completed'
|
|
661
664
|
Config.iac_scan_status ='Completed'
|
|
@@ -693,66 +696,66 @@ def runImage(data=None,type=None):
|
|
|
693
696
|
msg = 'Error recorded while uploading the report'
|
|
694
697
|
Utils.logError(msg,str(e))
|
|
695
698
|
|
|
696
|
-
if type == 'reachability' and Config.sbom_scan_status.lower() != "failed":
|
|
697
|
-
|
|
698
|
-
|
|
699
|
+
# if type == 'reachability' and Config.sbom_scan_status.lower() != "failed":
|
|
700
|
+
# Utils.checkImageAlreadyExsist(docker_image)
|
|
701
|
+
# logging.info('Running %s',tool_name)
|
|
699
702
|
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
703
|
+
# try:
|
|
704
|
+
# workspace = os.getcwd()
|
|
705
|
+
|
|
706
|
+
# tmp_dir = os.path.join(workspace, ".ci_tmp")
|
|
707
|
+
# home_dir = os.path.join(workspace, ".ci_home")
|
|
708
|
+
|
|
709
|
+
# os.makedirs(tmp_dir, exist_ok=True)
|
|
710
|
+
# os.makedirs(home_dir, exist_ok=True)
|
|
711
|
+
|
|
712
|
+
# command_line = "% s" % command_line.format(lang = Config.reachability_language)
|
|
713
|
+
# #command_line ="atom reachables -l python -o /app/app.atom -s /app/reachables.slices.json /app"
|
|
714
|
+
# Config.build_dir = Config.reachability_build_dir = Config.sca_build_dir
|
|
715
|
+
# container_output = docker.containers.run(docker_image, command_line, volumes={
|
|
716
|
+
# tmp_dir: {'bind': '/tmp', 'mode': 'rw'},
|
|
717
|
+
# home_dir: {'bind': '/home/container', 'mode': 'rw'},
|
|
718
|
+
# Config.reachability_build_dir: {'bind': data['bind'], 'mode': 'rw'}
|
|
719
|
+
# }, user=uid, remove=True)
|
|
720
|
+
# logging.info('Reachability Docker: SUCCESS!!! Message: %s Scan Completed',tool_name)
|
|
721
|
+
# reachables = Utils.reachability_analysis(f'{Config.sbom_build_dir}/{Config.sbom_output_file}',f'{Config.sca_build_dir}/{output_file}')
|
|
722
|
+
# Config.reachability_message ='Reachability Completed'
|
|
723
|
+
# Config.reachability_status ='Completed'
|
|
724
|
+
# except errors.ContainerError as exc:
|
|
725
|
+
# logging.error('Reachability Docker: Failed!!! Message: Some Error recorded while scanning %s',str(exc))
|
|
726
|
+
# msg='\n The following error has been recorded while scanning Reachability'
|
|
727
|
+
# Config.reachability_status ='Failed'
|
|
728
|
+
# Config.reachability_errors =f'{str(exc)}]'
|
|
729
|
+
# Utils.logError(msg,str(exc))
|
|
730
|
+
# reachables = None
|
|
728
731
|
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
elif type == "reachability":
|
|
754
|
-
|
|
755
|
-
|
|
732
|
+
# try:
|
|
733
|
+
# if will_generate_output == 1 and reachables is not None:
|
|
734
|
+
# logging.info('Reachability: Uploading %s to the server',output_file)
|
|
735
|
+
# output_reachability = {
|
|
736
|
+
# 'output_file': output_file,
|
|
737
|
+
# 'output': reachables
|
|
738
|
+
# }
|
|
739
|
+
# if uploadReport(output_reachability,tool_name,tool_id,scan_details_id,'reachability'):
|
|
740
|
+
# Config.reachability_status ='Completed'
|
|
741
|
+
# Config.reachability_upload_status = 'Completed'
|
|
742
|
+
# Config.reachability_message ='Scan Completed'
|
|
743
|
+
# else:
|
|
744
|
+
# Config.reachability_status ='Failed'
|
|
745
|
+
# Config.reachability_upload_status = 'Failed'
|
|
746
|
+
# Config.reachability_message ='Error occured while uploading the report, Please check the cli logs'
|
|
747
|
+
# else:
|
|
748
|
+
# logging.error('reachability: Failed!!! Message: Cant upload files to the server',tool_name)
|
|
749
|
+
# Config.reachability_message ='Cant upload files to the server for reachability, Please check your directory If output file is present.'
|
|
750
|
+
|
|
751
|
+
# except EnvironmentError as e:
|
|
752
|
+
# logging.error('reachability: Failed!!! Message: Error recorded while uploading the report %s',str(e))
|
|
753
|
+
# Config.reachability_message ='Error recorded while uploading the report of reachability, Please check your directory If output file is present.' ## need to change logic here -- MM
|
|
754
|
+
# msg = 'Error recorded while uploading the report'
|
|
755
|
+
# Utils.logError(msg,str(e))
|
|
756
|
+
# elif type == "reachability":
|
|
757
|
+
# Config.reachability_status ='Failed'
|
|
758
|
+
# Config.reachability_message ='Reachability: SBOM scan failed. Reachability analysis requires sbom file'
|
|
756
759
|
|
|
757
760
|
|
|
758
761
|
#### function to upload the test report to the server with other data -- MM ------------------------------------
|
|
@@ -1261,6 +1264,7 @@ def default():
|
|
|
1261
1264
|
parser.add_argument('-pot','--pollTime',default=60,help="Polling Time. Min : 30s, Max: 5min, Default : 1min. Format: input the time in seconds eg: 1min => 60 ")
|
|
1262
1265
|
parser.add_argument('-pof','--pollFrequency',default=10,help="Polling Frequency. Min : 5s, Max: 1min, Default : 10s. Format: input the time in seconds eg: 1min => 60 ")
|
|
1263
1266
|
parser.add_argument('-std','--setCacheDir',default=False,help="Set the cache directory for the scan. Set true if you use jenkins cicd")
|
|
1267
|
+
parser.add_argument('-dto','--dockerTimeout',default=600,min=300,max=1800,help="Set the timeout for the docker scan in seconds. Default is 600s (10min). Min is 300s (5min) and Max is 1800s (30min). Format: input the time in seconds eg: 10min => 600 ")
|
|
1264
1268
|
args = parser.parse_args()
|
|
1265
1269
|
|
|
1266
1270
|
# if len(sys.args) == 1:
|
|
@@ -1387,7 +1391,12 @@ def default():
|
|
|
1387
1391
|
logging.info(f"Configuring polling frequency to {Config.polling_frequency}s")
|
|
1388
1392
|
else:
|
|
1389
1393
|
logging.info(f"Resorting to default polling frequency {Config.polling_frequency}s")
|
|
1390
|
-
|
|
1394
|
+
|
|
1395
|
+
if (args.dockerTimeout >=300) and (args.dockerTimeout <=1800):
|
|
1396
|
+
Config.docker_timeout = args.dockerTimeout
|
|
1397
|
+
logging.info(f"docker timeout configured: {Config.docker_timeout}s")
|
|
1398
|
+
else
|
|
1399
|
+
logging.info(f"Resoting to default docker timeout: {Config.docker_timeout}s")
|
|
1391
1400
|
|
|
1392
1401
|
if args.failBuild != "pass":
|
|
1393
1402
|
Config.fail_build = True
|
|
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
|