Make Agnet runs submit resource-scoped work safely
Manager now exposes a Resource Grant manifest and the Agnet control-plane response carries runtime state, agent instances, and permission_manifest so frontend runs can submit bounded resource grants without plaintext credentials. Constraint: Manager remains the user console while NewAPI stays independent and OpenBao is referenced through secret_ref only. Rejected: platform-side high-risk approval | client approval is the product boundary; Agnet only validates approval evidence. Confidence: medium Scope-risk: moderate Directive: Do not mix child Agnet runtime model selection with NewAPI billing or expose OpenBao as a public route. Tested: git diff --check; jq empty locale JSON; go vet ./controller ./model ./router; go test -count=1 ./controller ./model ./router Not-tested: frontend typecheck/build because local node_modules tooling is absent and user requested builds happen on the VM. Co-authored-by: OmX <omx@oh-my-codex.dev>
This commit is contained in:
@@ -274,7 +274,7 @@ POST /api/agnet/deployments
|
||||
| `intent_id` | string | 是 | Manager 侧意图 ID,用于幂等、审计和追踪。 |
|
||||
| `template_hint` | string | 是 | Agnet 平台选择编排模板的提示,如 `manager-resource-binding`。 |
|
||||
| `objective` | string | 是 | 本次部署目标,应是自然语言但不能含密钥。 |
|
||||
| `risk_level` | enum | 是 | `low` / `medium` / `high`。高风险应触发审批或只读模式。 |
|
||||
| `risk_level` | enum | 是 | `low` / `medium` / `high`。高风险必须携带客户端审批证据;缺失或不匹配时只能只读或拒绝执行。 |
|
||||
| `budget.max_tokens` | int | 是 | 当前策略上限建议不超过 `500000`。 |
|
||||
| `budget.max_cost_usd` | number | 是 | 当前策略上限建议不超过 `200`。 |
|
||||
| `budget.max_duration_sec` | int | 是 | 当前策略上限建议不超过 `86400`。 |
|
||||
@@ -899,10 +899,23 @@ Manager 发给 Agnet 平台前必须执行:
|
||||
2. 凭据型资源只传 `secret_ref`,不传明文凭据。
|
||||
3. `metadata`、`constraints`、`audit` 的 key 中不得出现 `password`、`token`、`secret`、`private_key`、`access_key`、`credential` 等敏感词。
|
||||
4. `repo_url` 不得包含用户名、密码或访问 Token。
|
||||
5. `permission_scope` 使用最小权限,生产写操作需审批记录或平台代理执行。
|
||||
6. 高风险操作(生产部署、云资源修改、删除、扩容)应设置 `risk_level=high` 并由 Agnet 平台二次审批。
|
||||
5. `permission_scope` 使用最小权限;生产写操作必须携带客户端审批记录,Agnet 平台不得自行补批。
|
||||
6. 高风险操作(生产部署、云资源修改、删除、扩容)必须设置 `risk_level=high`,Agnet 平台执行前只校验客户端审批证据。
|
||||
7. 所有日志/事件/审计返回给 Manager 前必须脱敏。
|
||||
|
||||
Agnet 平台不承担高危操作审批主体。审批只发生在客户端;Agnet 平台只能在执行前校验以下字段和策略是否一致:
|
||||
|
||||
| 校验项 | 要求 |
|
||||
|---|---|
|
||||
| `approval_id` | 必须存在于高危任务的 `constraints` 或 `audit`,并可追溯到客户端审批记录。 |
|
||||
| 审批主体 | 审批用户必须与 `user_context.user_id`、`resource_grants[].user_id` 或授权代理主体一致。 |
|
||||
| 审批范围 | 审批范围必须覆盖 `binding_scope`、`permission_scope`、目标环境、资源 ID 和操作类型。 |
|
||||
| TTL / 时间窗口 | 审批记录必须未过期;若使用 `window` 或 TTL,当前执行时间必须落在允许范围内。 |
|
||||
| `risk_level` | 高危资源写入、生产部署、云资源修改、删除和扩容必须为 `high`。 |
|
||||
| 策略 | 平台 policy、OpenBao policy、Kubernetes/Workload Identity、网络策略和最小权限约束均必须允许本次动作。 |
|
||||
|
||||
任一校验不通过时,Agnet 平台应返回 `POLICY_REJECTED` 或 `FORBIDDEN_SCOPE`,不得发起额外批准流程。
|
||||
|
||||
### 8.1 字段级约束速查
|
||||
|
||||
| 对象/接口 | 必填最小集合 | 禁止内容 |
|
||||
|
||||
Reference in New Issue
Block a user