Skip to content

Commit

Permalink
fix(gitleaks): improve flags order in command
Browse files Browse the repository at this point in the history
  • Loading branch information
jcamilomolinar committed Jan 7, 2025
1 parent 9bbf9e1 commit dd274a8
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def run_tool_secret_scan(
if "gitleaks.exe" in self.COMMAND: folder = agent_work_folder
else: folder = "/tmp"

command.extend(["--config", f"{folder}{os.sep}rules{os.sep}gitleaks{os.sep}gitleaks.toml"])
config_flag = ["--config", f"{folder}{os.sep}rules{os.sep}gitleaks{os.sep}gitleaks.toml"]

try:
findings = []
Expand All @@ -116,6 +116,9 @@ def run_tool_secret_scan(
if not config_tool[tool]["ALLOW_IGNORE_LEAKS"]:
command_aux.append("--ignore-gitleaks-allow")

if config_tool[tool]["ENABLE_CUSTOM_RULES"]:
command_aux.extend(config_flag)

futures.append(executor.submit(self.run_subprocess_command, command_aux, aux_finding_path))

for future in as_completed(futures):
Expand All @@ -128,6 +131,9 @@ def run_tool_secret_scan(

if not config_tool[tool]["ALLOW_IGNORE_LEAKS"]:
command.append("--ignore-gitleaks-allow")

if config_tool[tool]["ENABLE_CUSTOM_RULES"]:
command.extend(config_flag)

subprocess.run(command, capture_output=True, text=True)
findings = self.extract_json_data(finding_path)
Expand Down

0 comments on commit dd274a8

Please sign in to comment.