fix: adr-required 换行文件名绕过截断检测——jq 结构化计数(ADR-0016) - #54
Conversation
Git 允许文件名含换行——行流计数(grep -c)可被单文件多行虚增 GOT, 使 3000 截断 fail-closed 失效。改为逐页 jq 按 JSON 对象计数(length) 与 C1 匹配(test 正则),文件名中的换行不影响任何一层判定。 与 agent-registry #22(首发发现)三仓同步。
|
Warning Review limit reached
Next review available in: 2 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 newline filenames
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
1. gh api uses workflow token
|
| C1_HIT=0 | ||
| PAGE=1 | ||
| while :; do | ||
| PAGEJSON=$(gh api "$PR_API/files?per_page=100&page=$PAGE") |
There was a problem hiding this comment.
1. gh api uses workflow token 📘 Rule violation ⛨ Security
The added paginated GitHub API call inherits GH_TOKEN from ${{ github.token }} rather than
obtaining a single-repository cloudbrid-agent token through scripts/gh-app-token.sh. This violates
the mandated identity and token-scoping mechanism for CI GitHub operations.
Agent Prompt
## Issue description
The added `gh api` pagination call authenticates with the workflow-provided GitHub token instead of the required cloudbrid-agent GitHub App identity.
## Issue Context
Obtain the token by invoking `scripts/gh-app-token.sh`, set `REPO` to the specific repository, and expose its output to `gh` as `GH_TOKEN`. Preserve fail-closed behavior if token acquisition fails.
## Fix Focus Areas
- .github/workflows/gate.yml[67-84]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
背景
qodo 在 agent-registry #22 的 review 中发现:Git 允许文件名含换行符,
grep -c .行流计数会把单个含换行的文件名算成多行——GOT 被虚增到 ==changed_files后,3000 文件截断的 fail-closed 检测失效,藏在截断边界后的 C1 文件不再触发报错。本仓 gate.yml(#53 引入)与 CI-Workflows ci.yml(#8 引入)为同款实现,存在同款绕过。修复
计数与 C1 匹配全部改为逐页 jq 按 JSON 对象处理:
jq 'length'(数组对象数,不受文件名内容影响)jq any(test(...))(按 JSON 值匹配正则,含previous_filename)三仓同步:agent-registry #22(qodo 首发发现)/ 本 PR / CI-Workflows follow-up。
ADR: ADR-0016