Skip to content

设备墙「接管 / 强制释放」按钮不带 token,预期一律 401(按代码推断,待线上确认) #32

Description

@woohaha

现象(按代码推断,未在线上复现)

设备墙放大页(internal/api/web/device.html)的「接管 / 交还」与「强制释放」两个按钮,请求里不带 token:

  • device.html:907 fetch('/api/leases/{id}/human', {method:'POST', headers:{'Content-Type':'application/json'}, ...})
  • device.html:916 fetch('/api/leases/{id}', {method:'DELETE'})

而这两条路由都挂在 s.auth 之后(internal/api/api.go:123-124),auth 只认 Authorization: Bearer <token>,不带即 401「token 无效」(api.go:170-179)。device.html / wall.html 里没有任何注入 token 的地方,也没有包装 fetch

因此预期:在墙上点这两个按钮会一直提示「操作失败」/「释放失败」,人工接管协议(droidpool status 退出码 10)从墙上发起不了。

待确认

https://droidpool.daboshi.cn 上对一台有租约的设备点一次「接管」,看是否 401。

背景

api.go:127 的注释写明设计意图是「设备墙:内网工具,不鉴权;agent 侧的租约接口仍要 token」——墙上这两个人工动作恰好落在要 token 的租约接口上,两个意图撞了。修法需要先定:给墙上的人工动作开一条不要 token 的路由,还是给墙加一层人的鉴权。

(在做 fancyCachier/wxpool 调研 droidpool 代码时顺带发现。)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions