Files
agent-zero/plugins/_a0_connector/tools/input_remote.py
Alessandro 25542e9950 Require remote terminal permission for input_remote
input_remote forwards keyboard text as terminal code, allowing a custom
profile to bypass a blocked code_execution_remote capability through an
independently enabled input tool.

Require the canonical bundled remote terminal action in shared policy
resolution while retaining input_remote's independent permission. Apply
the dependency to execution, text prompts, and native tool schemas, and
recheck it inside the input wrapper before rewriting args or dispatching.
Output-only grants, default-deny policies, and profile tool-name overrides
cannot authorize the terminal operation.

Document the permission dependency and add 19 regressions covering zero
dispatch on denial, action-specific grants, prompt/schema visibility,
authorized input, host access controls, and framework-owned allow_running.

Validation: 232 focused tests passed in both Conda a0 and Docker's framework
runtime. A smoke test through the real CLI shell backend verified denied
dispatch, authorized idle and interactive input, and permission revocation.
Restarted the live Agent Zero runtime and verified HTTP health.
2026-11-01 07:49:29 +01:00

23 lines
766 B
Python

from helpers.tool_policy import ensure_tool_allowed
from plugins._a0_connector.tools.code_execution_remote import CodeExecutionRemote
class InputRemote(CodeExecutionRemote):
_allow_running = True
async def execute(self, keyboard="", **kwargs):
ensure_tool_allowed(
self.agent, "code_execution_remote",
canonical_id="plugin:_a0_connector:code_execution_remote",
action="terminal",
)
self.args = {
"runtime": "terminal",
"code": keyboard.rstrip(),
"session": self.args.get("session", 0),
}
return await super().execute(**kwargs)
def get_heading(self, text=""):
return f"icon://keyboard input_remote [{self.args.get('session', 0)}]"