Skip to content

Commit a347a62

Browse files
committed
CM-40907 set secured shell command
1 parent 0b720e4 commit a347a62

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

cycode/cli/files_collector/sca/base_restore_dependencies.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ def build_dep_tree_path(path: str, generated_file_name: str) -> str:
1616
def execute_command(command: List[str], file_name: str, command_timeout: int, dependencies_file_name: str = None) -> \
1717
Optional[str]:
1818
try:
19-
dependencies = shell(command=command, timeout=command_timeout, execute_in_shell=False,
20-
output_file_path=dependencies_file_name)
19+
dependencies = shell(command=command, timeout=command_timeout, output_file_path=dependencies_file_name)
2120
except Exception as e:
2221
logger.debug('Failed to restore dependencies via shell command, %s', {'filename': file_name}, exc_info=e)
2322
return None

cycode/cli/utils/shell_executor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
def shell(
12-
command: Union[str, List[str]], timeout: int = _SUBPROCESS_DEFAULT_TIMEOUT_SEC, execute_in_shell: bool = False,
12+
command: Union[str, List[str]], timeout: int = _SUBPROCESS_DEFAULT_TIMEOUT_SEC,
1313
output_file_path: Optional[str] = None
1414
) -> Optional[str]:
1515
logger.debug('Executing shell command: %s', command)
@@ -18,7 +18,7 @@ def shell(
1818
result = subprocess.run( # noqa: S603
1919
command,
2020
timeout=timeout,
21-
shell=execute_in_shell,
21+
shell=False,
2222
check=True,
2323
capture_output=True,
2424
text=True,

0 commit comments

Comments
 (0)