-
Notifications
You must be signed in to change notification settings - Fork 0
governance: App 权限政策与 CI 工作流变更通道落盘(ADR-0045,#102) #123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # App 权限政策与 CI 工作流变更通道 | ||
|
|
||
| 适用对象:cloudbrid-agent App(AG-1)及未来任何自动化写仓身份。决策背书: | ||
| ADR-0045(.github issue #102);机器执法:`governance/expected-state.json` | ||
| `github_app.must_not_have` + drift-check §6。 | ||
|
|
||
| ## 规则 1:App 永不持有 workflows / administration 权限 | ||
|
|
||
| `workflows:write` 等于允许修改审判自己的 gate 定义(自动合并计划 #81 §3.3 | ||
| 的核心威胁模型)。App 是高频自动化身份,该权限面不可接受。GitHub 侧的 | ||
| 自然结果:App 创建的 tree 一旦包含 `.github/workflows/**` 即 403 | ||
| (Resource not accessible by integration)——这是**预期行为**,不是故障; | ||
| drift-check §6 一旦发现 App 出现禁用权限即报漂移(应立即在 App 设置页移除)。 | ||
|
|
||
| ## 规则 2:CI 工作流变更走 owner 凭据通道 | ||
|
|
||
| `.github/workflows/**` 的变更由 owner 凭据提交,两种形态: | ||
|
|
||
| 1. **常态**:agent 在 issue/PR 描述中以 diff 形式产出补丁,owner 审后自行 | ||
| apply 提交 PR; | ||
| 2. **owner 显式授权的 agent 会话**:owner 以 PAT 授权 agent 代为提交 | ||
| (先例:T-W5-034 回迁,AI_Web_School PR #51)——PR 留痕,审计面完整。 | ||
|
Comment on lines
+21
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift 消除 PAT 例外与 AG-1 契约的冲突。
请二选一:
否则两个治理文件会允许不同的写入身份。 </review_comment> 🤖 Prompt for AI Agents
Comment on lines
+21
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. owner pat bypasses approved token scripts The new policy permits an owner to authorize an agent with a PAT without requiring scripts/ghcb or scripts/gh-app-token.sh, and without requiring a fine-grained, short-lived, least-privilege credential scoped to a single repository, securely injected and revoked after the session. A classic or broadly scoped owner PAT could elevate the agent from a restricted App token to every repository and API permitted by the owner’s credentials, enabling credential leakage or operations outside the PR gate. Agent Prompt
|
||
|
|
||
| 通道约束:owner 凭据**不豁免任何机器门禁**——变更仍必须走 PR 过 gate + | ||
| ruleset(owner-merge 语义见 GOVERNANCE flows.governance_change)。 | ||
|
|
||
| ## 规则 3:agent 遇到工作流变更需求的动作序列 | ||
|
|
||
| 1. 产出完整 diff,登记到对应 issue/PR; | ||
| 2. 声明「需 owner 凭据通道」(引用本规范 + ADR-0045); | ||
| 3. 等待 owner apply 或显式授权;**不得**尝试以 App 身份直推(403 且无意义), | ||
| **不得**因此绕过 PR 流程(如请求 owner 直推 main——那要走破玻璃流程)。 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2. 错误定位工作流 403
🐞 Bug≡ CorrectnessAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools