mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-16 17:47:06 +08:00
Update astrbot/core/agent/mcp_client.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
@@ -171,7 +171,12 @@ def _validate_stdio_args(command_name: str, args: object) -> None:
|
||||
"MCP stdio JavaScript servers must be launched from a package or file; inline eval flags are not allowed."
|
||||
)
|
||||
elif command_name == "docker":
|
||||
denied = [arg for arg in args if arg in _DENIED_DOCKER_ARGS]
|
||||
denied = []
|
||||
for i, arg in enumerate(args):
|
||||
if arg in _DENIED_DOCKER_ARGS:
|
||||
denied.append(arg)
|
||||
elif arg in {"--network", "--net", "--pid", "--ipc"} and i + 1 < len(args) and args[i+1] == "host":
|
||||
denied.append(f"{arg} {args[i+1]}")
|
||||
if denied:
|
||||
raise ValueError(
|
||||
f"MCP stdio Docker args are unsafe and not allowed: {', '.join(denied)}."
|
||||
|
||||
Reference in New Issue
Block a user