Appearance
模型能想和能做为什么要分开:Brain / Hands 与 Delegated Authorization
前置:Container 为什么不是完整 Sandbox:Resource、Credential 与 Security Boundary
核心问题:为什么负责推理的 Brain 不应该持有真正 Credential,Hands 又怎样只获得当前动作需要的临时授权?
模型输出 shell command 只是提议,Execution Plane 在隔离 sandbox 和命令 policy 下执行。用户已登录只说明身份成立,不代表其可以调用生产部署 Tool。
Brain / Hands Security Boundary
Brain 表示推理/决策,Hands 表示 workspace、shell、browser 等执行环境,Session/State 提供连续性。分离这些边界可以独立升级模型、执行环境和持久化策略。
Brain 处理不可信语义,Hands 执行真实动作;安全设计应让 Brain 不能直接获得超出批准范围的 Hands capability。接口之间要做 validation/policy。
Authentication vs Authorization
Authentication 和 Authorization 回答的是两个不同问题:
text
Authentication:你是谁?
Authorization:你能对这个资源做什么?在 Agent 中还多一层 delegation:Harness 是代表用户行动,但不应该因此拿到用户所有权限。
例如用户已登录,并不意味着 Coding Agent 可以读取整个组织的 Secret。Runtime 应根据当前 Tool + resource scope 获取最小 delegated credential,再由 Executor 使用;模型本身通常只需要看到“有 calendar.read capability”,不需要看到 OAuth token。
User-delegated Credentials / OAuth Token Boundary
身份认证回答“谁”,授权回答“能做什么”。Delegated token 应绑定用户、client、resource、scope 和有效期,并只在实际 Tool 调用时提供给 adapter。不要把 access token 暴露给模型文本或持久 workspace;refresh/revocation 由 credential layer 管理。
Delegated token 代表用户授权,scope/audience/tenant/expiry 必须匹配当前操作;不能跨用户、跨工具缓存或长期放入模型 Context。
Authentication、Authorization、Delegation 是三件事
text
Authentication → 当前用户/服务是谁
Authorization → 这个主体是否允许请求某能力
Delegation → Harness 代表该主体执行时,拿到什么受限凭据模型通常不需要看到原始 OAuth token。它只需要知道存在某个 capability,例如“可读取用户 Calendar”。真正执行时 Hands/Executor 根据 authorized identity 向 Secret Broker/credential store 换取 scoped credential。
Brain/Hands 分离的价值在 credential 不进入推理面
推荐路径:
text
Model proposes calendar.read
→ Runtime validates tool + user authorization
→ Executor requests delegated credential reference
→ adapter calls external API
→ sanitized result returns as Observation这样 Prompt injection 即使诱导模型请求 calendar.delete_all,没有对应 capability/authorization 仍执行不了;Trace 也可以记录 credential reference/scope,而不泄露 token value。
源码对照(B 类)
可结合 auto-review-gate.ts、host-secret-store.ts 和 exec boundary 阅读 Brain/Hands:模型提出 intent,真正权限仍停留在 Runtime/Execution。 - 源码导航:Grok Bot Source Map
自测
- 模型 Brain 认为应该部署生产,但 Hands 没有 production scope。正确系统应在哪一层阻止?
- Delegated authorization 为什么必须代表真实调用者/任务范围,而不是给 Agent 一个长期万能 token?