@@ -468,14 +468,23 @@ def create_honeytoken(
468
468
result .status_code = resp .status_code
469
469
return result
470
470
471
- # For IaC Scans
472
471
def iac_directory_scan (
473
472
self ,
474
473
directory : Path ,
475
474
filenames : List [str ],
476
475
scan_parameters : IaCScanParameters ,
477
476
extra_headers : Optional [Dict [str , str ]] = None ,
478
477
) -> Union [Detail , IaCScanResult ]:
478
+ """
479
+ iac_directory_scan handles the /iac_scan endpoint of the API.
480
+
481
+ :param directory: path to the directory to scan
482
+ :param filenames: filenames of the directory to include in the scan
483
+ :param scan_parameters: minimum severities wanted and policies to ignore
484
+ example: {"ignored_policies":["GG_IAC_0003"],"minimum_severity":"HIGH"}
485
+ :param extra_headers: optional extra headers to add to the request
486
+ :return: ScanResult response and status code
487
+ """
479
488
tar = _create_tar (directory , filenames )
480
489
result : Union [Detail , IaCScanResult ]
481
490
try :
@@ -504,14 +513,28 @@ def iac_directory_scan(
504
513
505
514
return result
506
515
507
- # For IaC diff Scans
508
516
def iac_diff_scan (
509
517
self ,
510
518
reference : bytes ,
511
519
current : bytes ,
512
520
scan_parameters : IaCScanParameters ,
513
521
extra_headers : Optional [Dict [str , str ]] = None ,
514
522
) -> Union [Detail , IaCDiffScanResult ]:
523
+ """
524
+ iac_diff_scan handles the /iac_diff_scan endpoint of the API.
525
+
526
+ Scan two directories and compare their vulnerabilities.
527
+ Vulnerabilities in reference but not in current are considered "new".
528
+ Vulnerabilities in both reference and current are considered "unchanged".
529
+ Vulnerabilities in current but not in reference are considered "deleted".
530
+
531
+ :param reference: tar file containing the reference directory. Usually an incoming commit
532
+ :param current: tar file of the current directory. Usually HEAD
533
+ :param scan_parameters: minimum severities wanted and policies to ignore
534
+ example: {"ignored_policies":["GG_IAC_0003"],"minimum_severity":"HIGH"}
535
+ :param extra_headers: optional extra headers to add to the request
536
+ :return: ScanResult response and status code
537
+ """
515
538
result : Union [Detail , IaCDiffScanResult ]
516
539
try :
517
540
# bypass self.post because data argument is needed in self.request and self.post use it as json
0 commit comments