Skip to content

Commit 6e155c6

Browse files
committed
deploy dev
1 parent 9cb1edf commit 6e155c6

File tree

1 file changed

+14
-11
lines changed
  • tools/devsecops_engine_tools/engine_sast/engine_secret/src/infrastructure/driven_adapters/trufflehog

1 file changed

+14
-11
lines changed

tools/devsecops_engine_tools/engine_sast/engine_secret/src/infrastructure/driven_adapters/trufflehog/trufflehog_run.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,20 @@ def run_trufflehog(
122122
agent_os,
123123
repository_provider= ""
124124
):
125-
if repository_provider == 'GitHub':
126-
command = f"{trufflehog_command} filesystem {agent_work_folder} --include-paths {include_path} --exclude-paths {exclude_path} --no-verification --no-update --json"
127-
else:
128-
command = f"{trufflehog_command} filesystem {agent_work_folder + "/" + repository_name} --include-paths {include_path} --exclude-paths {exclude_path} --no-verification --no-update --json"
129-
if enable_custom_rules:
130-
command = command.replace("--no-verification --no-update --json", f"--config {agent_work_folder}//rules//trufflehog//custom-rules.yaml --no-verification --no-update --json" if "Windows" in agent_os else
131-
"/tmp/rules/trufflehog/custom-rules.yaml --no-verification --no-update --json" if "Linux" in agent_os else
132-
"--no-verification --no-update --json")
133-
print(command)
134-
result = subprocess.run(command, capture_output=True, shell=True, text=True, encoding='utf-8')
135-
return result.stdout.strip()
125+
try:
126+
if repository_provider == 'GitHub':
127+
command = f"{trufflehog_command} filesystem {agent_work_folder} --include-paths {include_path} --exclude-paths {exclude_path} --no-verification --no-update --json"
128+
else:
129+
command = f"{trufflehog_command} filesystem {agent_work_folder + "/" + repository_name} --include-paths {include_path} --exclude-paths {exclude_path} --no-verification --no-update --json"
130+
if enable_custom_rules:
131+
command = command.replace("--no-verification --no-update --json", f"--config {agent_work_folder}//rules//trufflehog//custom-rules.yaml --no-verification --no-update --json" if "Windows" in agent_os else
132+
"/tmp/rules/trufflehog/custom-rules.yaml --no-verification --no-update --json" if "Linux" in agent_os else
133+
"--no-verification --no-update --json")
134+
print(command)
135+
result = subprocess.run(command, capture_output=True, shell=True, text=True, encoding='utf-8')
136+
return result.stdout.strip()
137+
except Exception as e:
138+
logger.warning(f"Error getting files PullRequest: {e}")
136139

137140
def decode_output(self, results):
138141
for decode_output in results:

0 commit comments

Comments
 (0)