boman-cli 2.0__tar.gz → 2.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: boman-cli
3
- Version: 2.0
3
+ Version: 2.1
4
4
  Summary: CLI tool of boman.ai
5
5
  Home-page: https://boman.ai
6
6
  Author: Sumeru Software Solutions Pvt. Ltd.
@@ -83,11 +83,15 @@ Example: boman-cli -a run -zap_session_script ./session.js
83
83
 
84
84
  ### Release Note:
85
85
 
86
+ ### V2.1
87
+ - New scan added: SBOM.
88
+
86
89
  ### V2.0
87
90
 
88
91
  - New scan added: Container scan.
89
92
  - New Tool added for SCA scan type.
90
93
 
94
+
91
95
  ### V1.9:
92
96
 
93
97
  - [Bug fix] Updated the Upload Logs success message
@@ -68,11 +68,15 @@ Example: boman-cli -a run -zap_session_script ./session.js
68
68
 
69
69
  ### Release Note:
70
70
 
71
+ ### V2.1
72
+ - New scan added: SBOM.
73
+
71
74
  ### V2.0
72
75
 
73
76
  - New scan added: Container scan.
74
77
  - New Tool added for SCA scan type.
75
78
 
79
+
76
80
  ### V1.9:
77
81
 
78
82
  - [Bug fix] Updated the Upload Logs success message
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: boman-cli
3
- Version: 2.0
3
+ Version: 2.1
4
4
  Summary: CLI tool of boman.ai
5
5
  Home-page: https://boman.ai
6
6
  Author: Sumeru Software Solutions Pvt. Ltd.
@@ -83,11 +83,15 @@ Example: boman-cli -a run -zap_session_script ./session.js
83
83
 
84
84
  ### Release Note:
85
85
 
86
+ ### V2.1
87
+ - New scan added: SBOM.
88
+
86
89
  ### V2.0
87
90
 
88
91
  - New scan added: Container scan.
89
92
  - New Tool added for SCA scan type.
90
93
 
94
+
91
95
  ### V1.9:
92
96
 
93
97
  - [Bug fix] Updated the Upload Logs success message
@@ -115,7 +115,7 @@ class Config:
115
115
 
116
116
  log_level = "INFO"
117
117
 
118
- version = 'v2.0'
118
+ version = 'v2.1'
119
119
 
120
120
  boman_config_file = 'boman.yaml'
121
121
 
@@ -149,4 +149,14 @@ class Config:
149
149
  con_scan_upload_status=None
150
150
  con_scan_status=None
151
151
  con_scan_type=None
152
- con_scan_target=None
152
+ con_scan_target=None
153
+
154
+ #sbom
155
+ sbom_present=None
156
+ sbom_build_dir=None
157
+ sbom_message=None
158
+ sbom_response=None
159
+ sbom_errors=None
160
+ sbom_upload_status=None
161
+ sbom_scan_status=None
162
+ sbom_target=None
@@ -46,7 +46,7 @@ def authorize():
46
46
 
47
47
  logging.info(f"Boman opted for: {Config.sca_lang} scan")
48
48
  logging.info('Authenticating with boman server')
49
- data = {'app_token': Config.app_token, 'customer_token': Config.customer_token, 'sast':Config.sast_present,"dast":Config.dast_present,"dast_type":Config.dast_type,"dast_auth_enabled":Config.dast_auth_present,"sast_langs":Config.sast_lang,"sca":Config.sca_present,"sca_langs":Config.sca_lang,"sca_scan_type":Config.sca_type,"secret_scan":Config.secret_scan_present,'container_scan': Config.con_scan_present,'container_scan_type': Config.con_scan_type}
49
+ data = {'app_token': Config.app_token, 'customer_token': Config.customer_token, 'sast':Config.sast_present,"dast":Config.dast_present,"dast_type":Config.dast_type,"dast_auth_enabled":Config.dast_auth_present,"sast_langs":Config.sast_lang,"sca":Config.sca_present,"sca_langs":Config.sca_lang,"sca_scan_type":Config.sca_type,"secret_scan":Config.secret_scan_present,'container_scan': Config.con_scan_present,'container_scan_type': Config.con_scan_type,"sbom":Config.sbom_present}
50
50
  headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
51
51
  try:
52
52
  res = requests.post(url, json=data, headers=headers)
@@ -69,7 +69,8 @@ def authorize():
69
69
  Config.secret_scan_response = json_response['data']['secret_scan']
70
70
  Config.scan_token = json_response['data']['scan_token']
71
71
  Config.scan_name = json_response['data']['scan_name']
72
- Config.con_scan_response = json_response['data']['cs']
72
+ Config.con_scan_response = json_response['data']['cs']
73
+ Config.sbom_response = json_response['data']['sbom']
73
74
 
74
75
  return 1
75
76
  except:
@@ -535,7 +535,48 @@ def runImage(data=None,type=None):
535
535
  msg = 'Error recorded while uploading the report'
536
536
  Utils.logError(msg,str(e))
537
537
 
538
+ if type == 'sbom':
539
+ Utils.checkImageAlreadyExsist(docker_image)
540
+ logging.info('Running %s',tool_name)
541
+
542
+ try:
543
+ Config.build_dir = Config.sbom_build_dir
544
+ command_line = "% s" % command_line.format(target = 'src/')
545
+ container_output = docker.containers.run(docker_image, command_line, volumes={Config.sbom_build_dir: {
546
+ 'bind': data['bind']}}, user=uid)
547
+ logging.info('[SUCCESS]: %s Scan Completed',tool_name)
548
+ Config.sbom_message ='SBOM scan completed'
549
+ Config.sbom_scan_status ='Completed'
550
+ except errors.ContainerError as exc:
551
+ logging.error('Some Error recorded while scanning %s',tool_name)
552
+ logging.error('%s',str(exc))
553
+ msg='\n The following error has been recorded while scanning sca'
554
+ Config.sbom_scan_status ='Completed'
555
+ Config.sbom_errors ='Some Error recorded while scanning [',str(exc),']'
556
+ Utils.logError(msg,str(exc))
557
+
558
+ try:
559
+ if will_generate_output == 1:
560
+ logging.info('Uploading %s to the server',output_file)
561
+ if uploadReport(output_file,tool_name,tool_id,scan_details_id,'sbom'):
562
+ Config.sbom_scan_status ='Completed'
563
+ Config.sbom_upload_status = 'Completed'
564
+ Config.sbom_message ='Scan Completed'
565
+ else:
566
+ Config.sbom_scan_status ='Failed'
567
+ Config.sbom_upload_status = 'Failed'
568
+ Config.sbom_message ='Error occured while uploading the report, Please check the cli logs'
569
+ else:
570
+ logging.error('Cant upload files to the server',tool_name)
571
+ Config.sbom_message ='Cant upload files to the server for SBOM,Please check your directory for the files.'
538
572
 
573
+ except EnvironmentError as e:
574
+ logging.error('Error recorded while uploading the report %s',tool_name)
575
+ logging.error('%s',str(e))
576
+ Config.sbom_message ='Error recorded while uploading the report of SBOM, Please check your directory for the files.' ## need to change logic here -- MM
577
+ msg = 'Error recorded while uploading the report'
578
+ Utils.logError(msg,str(e))
579
+
539
580
 
540
581
  #### function to upload the test report to the server with other data -- MM ------------------------------------
541
582
  def uploadReport(filename,toolname,tool_id,scan_details_id,type):
@@ -563,6 +604,9 @@ def uploadReport(filename,toolname,tool_id,scan_details_id,type):
563
604
  elif type =="container_scan":
564
605
  message = Config.con_scan_message
565
606
  errors = Config.con_scan_errors
607
+ elif type =="sbom":
608
+ message = Config.sbom_message
609
+ errors = Config.sbom_errors
566
610
  except:
567
611
  message = 'NA'
568
612
  errors = 'NA'
@@ -743,7 +787,7 @@ def main():
743
787
 
744
788
  init()
745
789
  Validation.yamlValidation()
746
- if Config.secret_scan_present == True or Config.sast_present is True or Config.dast_present is True or Config.sca_present is True or Config.con_scan_present is True:
790
+ if Config.secret_scan_present == True or Config.sast_present is True or Config.dast_present is True or Config.sca_present is True or Config.con_scan_present is True or Config.sbom_present:
747
791
  Utils.testServer()
748
792
  else:
749
793
  content = Auth.authorize()
@@ -882,6 +926,20 @@ def main():
882
926
  runImage(data=data,type='container_scan')
883
927
  else:
884
928
  logging.info('Ignoring Container Scan')
929
+
930
+ if Config.sbom_present is True:
931
+ logging.info("Preparing SBOM requirements")
932
+
933
+ for data in Config.sbom_response:
934
+
935
+ if data['scan_status'] == 0 :
936
+ logging.info('No SBOM Configuration found from SaaS')
937
+ logging.info('Ignoring SBOM')
938
+ else:
939
+ runImage(data=data,type='sbom')
940
+ else:
941
+ logging.info('Ignoring SBOM')
942
+
885
943
  exitFunction()
886
944
  return 1
887
945
 
@@ -328,6 +328,16 @@ def showSummary():
328
328
  logging.info('SCAN MESSAGE : %s', Config.con_scan_message)
329
329
  logging.info('-------------------------------------')
330
330
 
331
+ logging.info('-------- SBOM SCAN STATUS --------- ')
332
+ if Config.sbom_present:
333
+ logging.info('SCAN STATUS: %s',Config.sbom_scan_status)
334
+ logging.info('UPLOAD STATUS: %s',Config.sbom_upload_status)
335
+ logging.info('SCAN MESSAGE : %s', Config.sbom_message)
336
+
337
+ logging.info('ERRORS: %s',Config.sbom_errors)
338
+ else:
339
+ logging.info('SCAN MESSAGE : %s', Config.sbom_message)
340
+ logging.info('-------------------------------------')
331
341
 
332
342
 
333
343
 
@@ -263,10 +263,27 @@ def yamlValidation():
263
263
  logging.warning('Container Scan is not properly configured. Cant read the "container_scan" configuration.')
264
264
  Config.con_scan_message ='Container Scan is not properly configured'
265
265
 
266
-
266
+ try:
267
+ if "SBOM" in Config.config_data:
268
+ if Config.config_data['SBOM']:
269
+ Config.sbom_present = True
270
+ Config.sbom_build_dir = os.getcwd()+"/"
271
+ logging.info('SBOM is properly configured and ready to scan')
272
+ else:
273
+ Config.sbom_present = False
274
+ logging.warning('SBOM is not properly configured. Cant read the "sbom" configuration.')
275
+ Config.sbom_message ='sbom is not properly configured'
276
+
277
+ else:
278
+ Config.sbom_present = False
279
+ logging.warning('SBOM is not properly configured. Cant read the "sbom" configuration.')
280
+ Config.sbom_message ='sbom is not properly configured'
281
+ except:
282
+ Config.sbom_present = False
283
+ logging.warning('SBOM is not properly configured. Cant read the "sbom" configuration.')
284
+ Config.sbom_message ='sbom is not properly configured'
267
285
 
268
-
269
-
286
+
270
287
 
271
288
  ## need to use lingudetect here, but the results are not trustable and misleading ------ MM -------------------
272
289
  def findLang():
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  environment = prod
3
- version = 2.0
3
+ version = 2.1
4
4
  name = boman-cli
5
5
  saas_base_url =
6
6
  https = //dashboard.boman.ai/
File without changes
File without changes
File without changes
File without changes