Skip to content

The agent that grows with you

test(approval): package uninstall gated, install/update unprompted (#10199)

teknium106e3124fe11c
diff --git a/tests/tools/test_approval.py b/tests/tools/test_approval.py
index 406b2307871..502c262bc86 100644
--- a/tests/tools/test_approval.py
+++ b/tests/tools/test_approval.py
@@ -19,6 +19,24 @@ from tools.approval_context import _normalize_approval_mode
from tools.approval_smart import _smart_approve
+class TestPackageManagerUninstallApproval:
+ """Package-manager removal verbs remove software outside the project (#10199)."""
+
+ @pytest.mark.parametrize("command", [
+ "npm uninstall -g left-pad", "npm r left-pad", "pnpm un -g left-pad",
+ "yarn global remove left-pad", "pip3 uninstall left-pad", "brew rm left-pad",
+ ])
+ def test_uninstall_requires_approval(self, command):
+ dangerous, key, _ = detect_dangerous_command(command)
+ assert dangerous and key == "package manager uninstall"
+
+ @pytest.mark.parametrize("command", [
+ "npm update -g left-pad", "pnpm add left-pad", "yarn install", "pip install left-pad", "brew upgrade left-pad",
+ ])
+ def test_install_and_update_stay_unprompted(self, command):
+ assert detect_dangerous_command(command) == (False, None, None)
+
+
class TestApprovalModeParsing:
def test_normalization_table(self):
# Unquoted YAML `off`/`on` arrive as booleans; unknown/empty fall back