mirror of
https://github.com/github/spec-kit.git
synced 2026-08-03 06:26:30 +08:00
run_command() enforces a list[str] argv contract, so a shell parameter served no purpose beyond keeping an unnecessary shell-injection surface that a future refactor could re-enable. Remove the parameter (and its now-dead ValueError guard) so shell=False is the only possible behavior. Assisted-by: GitHub Copilot (model: Claude Opus 4.8, autonomous) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 74a1bd02-f6cd-412a-b5a8-a7767a5e058d
22 lines
706 B
Python
22 lines
706 B
Python
"""Tests for specify_cli._utils.run_command."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import inspect
|
|
|
|
import pytest
|
|
|
|
from specify_cli import run_command
|
|
|
|
|
|
def test_run_command_has_no_shell_parameter():
|
|
"""The shell-injection surface is removed at the API level.
|
|
|
|
``run_command`` must never accept a ``shell`` parameter: the argv-list
|
|
contract makes shell interpolation impossible by construction, and there is
|
|
no runtime mode to re-enable it. Passing ``shell=`` is a hard ``TypeError``.
|
|
"""
|
|
assert "shell" not in inspect.signature(run_command).parameters
|
|
with pytest.raises(TypeError):
|
|
run_command(["echo", "blocked"], shell=True) # type: ignore[call-arg] # noqa: S604
|