Skip to content

Commit

Permalink
feat(sast): add log level when running sast in windows (#6704)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: pazbechor <[email protected]>
Co-authored-by: pazbec <[email protected]>
  • Loading branch information
3 people authored Sep 5, 2024
1 parent 07e63df commit ad5b1b9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions checkov/sast/engines/prisma_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,14 @@ def _sast_default_scan(self, sast_input: Dict[str, Any]) -> Dict[str, Any]:
return json.loads(analyze_code_string) # type: ignore

def _windows_sast_scan(self, sast_input: Dict[str, Any]) -> Dict[str, Any]:
checkov_input_path = os.path.join(f"{os.path.dirname(self.lib_path)}", "checkov_input.json")
sast_output_path = os.path.join(f"{os.path.dirname(self.lib_path)}", "sast_output.json")
lib_dir_path = f"{os.path.dirname(self.lib_path)}"
checkov_input_path = os.path.join(lib_dir_path, "checkov_input.json")
sast_output_path = os.path.join(lib_dir_path, "sast_output.json")
with open(checkov_input_path, 'w') as f:
f.write(json.dumps(sast_input))
callargs = [self.lib_path, checkov_input_path, sast_output_path]
subprocess.run(callargs) # nosec B404, B603
log_level_str = "set LOG_LEVEL=" + os.getenv("LOG_LEVEL", "INFO")
callargs = [log_level_str, "&", self.lib_path, checkov_input_path, sast_output_path]
subprocess.run(callargs, shell=True) # nosec B404, B603, B602

with open(sast_output_path, 'r', encoding='utf-8') as f:
report = f.read()
Expand Down

0 comments on commit ad5b1b9

Please sign in to comment.