mirror of
https://github.com/NCBM/plyngent.git
synced 2026-11-07 15:37:55 +08:00
core/tools: announce a remote shell instead of judging it
`ssh prod` runs no command this scan can resolve, and what is typed or piped into the shell it opens never reaches any gate — `write_pty` and `run_argv(stdin=…)` are both unchecked input. The tool description said nothing about it, so the call looked like any other. The hop is now reported even when no command follows (`RemoteTarget.shell`), and the review announces it: `remote shell on 'prod' (ssh with no command; its input is not checked)`. It is a soft confirm like the other reviews (YOLO may skip it, an escalation behind a hop still may not) — the client itself stays outside the denylist, since there is no program to name.
This commit is contained in:
@@ -171,11 +171,16 @@ def test_unwrap_remote_batch_mode() -> None:
|
||||
|
||||
def test_unwrap_remote_client_alone() -> None:
|
||||
"""A client with no command opens a remote shell: nothing to unwrap."""
|
||||
for argv in (["ssh", "prod"], ["ssh", "-N", "prod"], ["ssh", "-G", "prod"], ["ssh"], ["mosh", "prod"]):
|
||||
for argv in (["ssh", "prod"], ["ssh", "-N", "prod"], ["ssh", "-G", "prod"], ["mosh", "prod"]):
|
||||
scan = unwrap_command(argv)
|
||||
assert scan.wrappers == (), argv
|
||||
assert scan.base == argv[0], argv
|
||||
assert scan.remote is None, argv
|
||||
assert scan.remote is not None, argv
|
||||
assert scan.remote.shell is True, argv
|
||||
assert scan.remote.host == "prod", argv
|
||||
# Without a destination there is no hop to announce.
|
||||
for argv in (["ssh"], ["ssh", "-V"]):
|
||||
assert unwrap_command(argv).remote is None, argv
|
||||
|
||||
|
||||
def test_unwrap_remote_command_still_reviews_what_runs() -> None:
|
||||
|
||||
Reference in New Issue
Block a user