fix(test): replace shell=True with shell=False in cli_coverage_steps.py subprocess call #1071
@@ -2,6 +2,10 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
- Fixed `shell=True` subprocess usage in `cli_coverage_steps.py` by replacing
|
||||
with `shlex.split()` and `shell=False` for defense-in-depth command injection
|
||||
prevention, consistent with the existing pattern in
|
||||
`cli_plan_context_commands_steps.py`. (#734)
|
||||
- Added BuiltinAdapter class and MCP automatic resource slot creation.
|
||||
BuiltinAdapter wraps register_file_tools/register_git_tools/register_subplan_tool
|
||||
into a unified adapter interface. McpAdapter.infer_resource_slots() analyzes
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"""Step definitions for CLI coverage tests."""
|
||||
|
||||
import shlex
|
||||
|
|
||||
import subprocess
|
||||
import sys
|
||||
from contextlib import redirect_stdout
|
||||
@@ -39,9 +40,8 @@ def step_run_shell_command(context, command):
|
||||
else:
|
||||
command = python_cmd + command[len("cleveragents") :]
|
||||
|
||||
# Use shell=True to handle quoted arguments correctly
|
||||
result = subprocess.run(
|
||||
command, capture_output=True, text=True, timeout=120, cwd=cwd, shell=True
|
||||
shlex.split(command), capture_output=True, text=True, timeout=120, cwd=cwd
|
||||
)
|
||||
context.exit_code = result.returncode
|
||||
context.output = result.stdout + result.stderr
|
||||
|
||||
Reference in New Issue
Block a user
[Low -- Bug] This docstring is now misleading. The function no longer uses a subprocess shell (
shell=Truewas removed). Consider updating to: