test(#829): regress prefixed runtime variable launches

This commit is contained in:
ms-lead-reviewer
2026-07-18 00:30:00 -05:00
parent 1eb77c17f3
commit 91a4a98370
2 changed files with 22 additions and 0 deletions

View File

@@ -76,6 +76,22 @@ class RuntimeLaunchGuardTest(unittest.TestCase):
with self.subTest(filename=filename):
self.assertEqual(GUARD.scan_text(Path(filename), source), [])
def test_detects_prefixed_tracked_runtime_variable_execution(self) -> None:
multiline = {
"exec-quoted": 'exec "$v" -p x',
"exec-unquoted": "exec $v -p x",
"command": 'command "$v" -p x',
"nohup": 'nohup "$v" -p x',
"env": 'env A=1 "$v" -p x',
}
cases = {
**{f"multiline-{name}.sh": f"v=claude\n{command}\n" for name, command in multiline.items()},
**{f"same-line-{name}.sh": f"v=claude; {command}\n" for name, command in multiline.items()},
}
for filename, source in cases.items():
with self.subTest(filename=filename):
self.assertNotEqual(GUARD.scan_text(Path(filename), source), [], source)
def test_accepts_only_validated_multiline_typescript_wrapper_invocation(self) -> None:
source = """execRuntime(
'python3',