fix(dsh): align recovery, scheduling audit and credential guarantees

This commit is contained in:
阿白叔 committed 2026-10-31 14:16:27 +08:00
1 parent e565f67b46
commit 9552f1eb95
32 files changed
+514 -135

No files matched your search

@@ -81,10 +81,10 @@
- Modify: `docs/user/dsh-ai-supervision.md`
**Interfaces:**
- `IssueBrokerConfig.from_environment()`, `IssueBroker.exchange(payload) -> dict`, and `IssueTransport.credentials(...)` with `instance_proof`, `idempotency_key`, `expires_in`.
- `IssueBrokerConfig.from_environment()`, `IssueBroker.exchange(payload) -> dict`, and `IssueTransport.credentials(...)` with `instance_proof`, `idempotency_key`, `credential_kind=revocable_static / expires_utc=null`.
- Reference HTTP endpoints: `GET /healthz`, `POST /v1/issue-token`.
- [x] Write tests for fixed target, HMAC instance proof, idempotency, short expiry, invalid scope, and no secret in response logs.
- [x] Write tests for fixed target, HMAC instance proof, idempotency, explicit static credential lifetime, bounded cache, invalid scope, and no secret in response logs.
- [x] Run focused tests and observe expected failure.
- [x] Implement the broker with stdlib `ThreadingHTTPServer`, fixed target configuration, environment-only secret/token, bounded requests and no redirects.
- [x] Require broker exchange metadata in the client and reject responses with missing expiry or wrong target.
@@ -66,7 +66,7 @@
**Interfaces:**
- Produces `IssueTransport(config_path).credentials(target, *, now=None) -> dict` with only in-memory `headers`, `source`, `expires_utc`, and `rotation_required`.
- Supports `broker_url` plus instance ID and a short-lived exchange response; direct bootstrap/Git credential fallback is tagged and never cached as a token.
- Supports `broker_url` plus instance ID and an explicitly revocable static credential response without a token TTL; direct bootstrap/Git credential fallback is tagged and never cached as a token.
- [x] Write tests for fixed target validation before credentials, broker success, broker expiry, direct fallback warning, and no-token cache/log output.
- [x] Run focused tests and observe expected failure.
@@ -20,7 +20,7 @@
### 4. 生产工单中转
`dsh/issue_transport.py` 的 broker 模式扩展为可部署的固定目标中转协议:服务端校验安装实例签名、仓库和事件幂等键,签发短期 issue-only token;客户端不缓存 token。新增 stdlib broker 参考服务和协议测试,生产部署仍需由运维配置服务端 secret 与 Git 凭据。
`dsh/issue_transport.py` 的 broker 模式扩展为可部署的固定目标中转协议:服务端校验安装实例签名、仓库和事件幂等键,分发长期可吊销 issue-only token(不提供自动到期保证);客户端不缓存 token。新增 stdlib broker 参考服务和协议测试,生产部署仍需由运维配置服务端 secret 与 Git 凭据。
## 约束
@@ -9,7 +9,7 @@
- 模型仍不能直接写 CAD、绕过原生确认、扩大重试额度或提交任意 URL。
- 排期仍要求任务中心打开且空闲;异常处理仍只使用已授权的原执行上下文。
- 健康信息只读;不向远端发送工程源文件、模型隐藏思维或凭据。
- 工单提交保持固定仓库和事件标记去重;优先使用中转服务短期令牌,直连凭据只作为明确配置的兼容路径。
- 工单提交保持固定仓库和事件标记去重;优先使用中转分发的长期可吊销令牌,直连凭据只作为明确配置的兼容路径。
## 组件
@@ -27,7 +27,7 @@
### 工单凭据生命周期
新增 `dsh/issue_transport.py`,支持固定仓库的中转模式:客户端只保存中转地址和安装实例标识,通过一次性或短期令牌换取服务端签发的 issue-only 访问凭据;令牌只用于固定服务器、仓库、事件标记和工单创建/附件上传。缓存只保存凭据来源、过期时间和错误码,不保存访问令牌。
新增 `dsh/issue_transport.py`,支持固定仓库的中转模式:客户端只保存中转地址和安装实例标识,通过实例 HMAC 证明获取服务端分发的长期可吊销 issue-only 访问凭据;令牌只用于固定服务器、仓库、事件标记和工单创建/附件上传。缓存只保存凭据来源、无到期保证的状态和错误码,不保存访问令牌。
兼容模式继续读取本机 Git credential,但预置静态令牌只作为开发/验收 fallback,并在健康中心标记为 `credential_rotation_required`。任何目标校验都必须在获取凭据前完成。