Feature: hide user-bound devices from MCP
设备绑定到 Web 用户后,MCP 端点(静态 token,等同管理员凭证)仍能按 ID 操作,与"私人设备只归 owner"的模型冲突。按产品决定采用最严格策略:MCP 只面向公共设备,绑定设备对 MCP 一律不可见、不可达,即使知道 ID 也一样。 - list_hosts / get_host_detail / get_server_status 先过滤绑定设备再计数与 分页;离线列表用完整在线集合作差,避免在线私人设备以离线条目复现。 - 所有单主机工具在 callTool 统一拒绝(get_screenshot / list_files / read_file / terminal_exec / terminal_close 及将来新增工具),批量 ids 由 逐台执行处拒绝;后续新工具不会再漏。 - 拒绝返回与离线主机相同的 -32002 "Host not found or offline",不泄露设备 是否存在。 - get_audit_log 过滤 device_id / device / devices 中任意一个指向绑定设备的 记录;owner 快照一次取用,不逐条加锁。 - cmd 把 Web 的 DeviceACL 注入 MCP;未启用 ACL 时行为完全不变。 验证:go build/test/vet 全绿;新增 MCP 侧列表隐藏、按 ID 拒绝、批量拒绝、 状态计数、审计过滤(三种字段写法)测试。 Model: deepseek-flash Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
1 parent
46434b46d0
commit
b704258ba4
6 files changed
+286
-12
No files matched your search
@@ -1274,6 +1274,8 @@ func main() {
|
||||
AuditPath: auditFile,
|
||||
Port: *httpPort,
|
||||
Bind: bindAddr,
|
||||
// Devices bound to a web user are invisible/unreachable through MCP.
|
||||
DeviceACL: deviceACL,
|
||||
})
|
||||
if mcpSrv.Enabled() {
|
||||
// Terminal tools need the hub's shell events (ready/data/closed).
|
||||
|
||||
Reference in new issue
Block a user