fix: enforce sandbox network block for agent tools

This commit is contained in:
thanhnv
2026-09-16 01:00:31 +09:00
parent caf3b74931
commit 8548c1e923
4 changed files with 21 additions and 2 deletions
+6 -1
View File
@@ -327,7 +327,12 @@ def run_code(
else:
emit({"type": "tool_start", "id": tc_id, "name": name})
if is_extra and extra_executor is not None:
result = extra_executor(name, args)
if ctx.block_network:
result = {"ok": False, "output": (
f"{name}: network access is blocked by the Sandbox Security Layer "
'("Block network for agent-run commands" is on in Settings).')}
else:
result = extra_executor(name, args)
else:
def on_output(line: str, _id=tc_id, _name=name) -> None:
emit({"type": "tool_output", "id": _id, "name": _name, "delta": line})