fix: gate 文件清单三防线——edited/rename 溯源/3000 fail-closed(ADR-0016) - #53
Conversation
CI-Workflows #8 qodo review 发现的同款缺陷在本仓 gate.yml 同样存在: 1. on.pull_request.types 增 edited:PR title/body 是可变输入,check 通过后 编辑掉 ADR 引用必须触发重验(反向:补引用救活 check 同理) 2. previous_filename 纳入 C1 判定:governance/standards/CODEOWNERS 等 C1 资产改名移出受管路径同样是 C1 变更 3. files API 3000 文件硬上限:返回数 < changed_files 即 fail-closed
|
Warning Review limit reached
Next review available in: 23 minutes Limit details: You’ve used all 3 included reviews currently available. Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Comment |
PR Summary by QodoHarden ADR Gate Against Edited, Renamed, and Truncated PRs
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
1. Newline filename bypasses cap
|
| CHANGED=$(gh api "$PR_API" --jq '.changed_files') | ||
| FILES_CUR=$(gh api --paginate "$FILES_API" --jq '.[].filename') |
There was a problem hiding this comment.
1. gh api uses workflow token 📘 Rule violation ⛨ Security
The added GitHub API requests authenticate through the existing ${{ github.token }} rather than a
single-repository cloudbrid-agent token issued by scripts/gh-app-token.sh. This violates the
required authentication and identity policy for automated GitHub operations.
Agent Prompt
## Issue description
The new `gh api` requests use the workflow-provided GitHub token instead of a cloudbrid-agent GitHub App token.
## Issue Context
Obtain the token through `scripts/gh-app-token.sh`, setting its mandatory `REPO` input to the current repository name so the resulting installation token is restricted to one repository. Populate `GH_TOKEN` from that command's output rather than `${{ github.token }}`.
## Fix Focus Areas
- .github/workflows/gate.yml[67-82]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| FILES_CUR=$(gh api --paginate "$FILES_API" --jq '.[].filename') | ||
| GOT=$(grep -c . <<<"$FILES_CUR" || true) |
There was a problem hiding this comment.
2. Newline filename bypasses cap 🐞 Bug ≡ Correctness
GOT counts nonempty output lines rather than files, so a filename containing a newline can inflate the count and conceal truncation above GitHub's 3000-file limit. An attacker can place such a filename among the returned entries and a C1 file beyond the limit, causing the incomplete list to pass and skip ADR enforcement.
Agent Prompt
## Issue description
The fail-closed check counts lines emitted from filenames, but Git filenames may contain line feeds. This lets one returned file produce multiple counted lines and mask files omitted by the API's 3000-file cap.
## Issue Context
Keep the paginated response as structured JSON. Count response objects and evaluate `filename` and `previous_filename` directly with `jq`, rather than serializing filenames into newline-delimited shell text before counting or matching.
## Fix Focus Areas
- .github/workflows/gate.yml[79-89]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
背景
CI-Workflows #8 的 qodo code review 发现 adr-required 实现有三个可绕过路径。本仓
gate.yml的 adr-required 是同一模型的原始实现(agent-registry validate.yml 由其移植),同款缺陷存在,本 PR 同步加固。三防线
edited——PR check 通过后可编辑 title/body 移除 ADR 引用,不触发重验on.pull_request.types增editedprevious_filename暴露原路径——把governance/、standards/、CODEOWNERS改名移出受管路径可绕过 C1 判定previous_filenamechanged_files即 fail-closed客观依据(平台行为,非推测)
previous_filename字段on.pull_request默认 activity types 为 opened/synchronize/reopened,不含 edited三仓同款修复:CI-Workflows #8(首发)/ agent-registry #22 / 本 PR。
ADR: ADR-0016