Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
feat(ISSUE-263): 回填 verifier-app 安装信息 #314
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
Uh oh!
There was an error while loading. Please reload this page.
feat(ISSUE-263): 回填 verifier-app 安装信息 #314
Changes from all commits
260f843281ba066fa104765c99413dfca3118ab927c809bf4b45a819247ddd2File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
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.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🌐 Web query:
GitHub REST API pull request files per_page maximum 100 limit💡 Result:
The GitHub REST API endpoint for listing files in a pull request (GET /repos/{owner}/{repo}/pulls/{pull_number}/files) supports the per_page query parameter, which has a maximum allowed value of 100 [1][2][3]. Key details regarding this limit include: - Default Value: If the per_page parameter is not specified, the API defaults to returning 30 results per page [1][2][3]. - Behavior for Oversized Values: If you provide a per_page value greater than 100, the API will not return an error [4][5][6]. Instead, it will silently clamp the value to the maximum (100) and return the response [4][7]. Because the request remains successful (returning a 200 OK status), you may receive fewer results than intended without explicit notification that the parameter was reduced [4][7]. - Pagination: While the per_page parameter is capped at 100, the overall response can contain significantly more files (the endpoint itself notes that responses can include a maximum of 3,000 files) [1][2][3]. To retrieve all files, you must use the Link header provided in the API response to iterate through subsequent pages [4][5][6].
Citations:
🏁 Script executed:
Repository: Cloudbird-Software/.github
Length of output: 9007
🏁 Script executed:
Repository: Cloudbird-Software/.github
Length of output: 308
[严重] 使用分页读取 PR 文件,避免绕过 adversary 审计。
GitHub REST API 的
per_page最大值为 100。per_page=300会被限制为 100,而不是返回 422。当前请求未使用--paginate。当第 101 个文件位于specs/**时,has_specs会被错误设为false,从而绕过审计。请分页读取并合并所有结果;API 失败时继续保留has_specs=true。🤖 Prompt for AI Agents
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.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: Cloudbird-Software/.github
Length of output: 4600
🏁 Script executed:
Repository: Cloudbird-Software/.github
Length of output: 21696
严重(Critical):在调用脚本前检出仓库
jobs.gate没有actions/checkout,但 specs PR 会执行bash scripts/gh-app-token.sh。Runner 不会自动填充工作目录,因此脚本不可用;TOKEN为空后,下一步会以exit 1阻断所有 specs PR。添加使用完整 commit SHA 的actions/checkout,并设置persist-credentials: false。同时移除2>/dev/null,以保留令牌铸造失败的诊断信息。🤖 Prompt for AI Agents
Source: Path instructions
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.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
重要(Major):排序键与取值方向相反,
adv[-1]会取到未完成的 check run。行 127 的排序键为
(r.get('status')!='completed',):completed 记录得False(0),未完成记录得True(1)。升序排序后,completed 在前,未完成在后。行 131 取adv[-1],即取到未完成的那一条。具体后果:head sha 上同时存在一条
completed/success的 adversary run 和一条重跑中的in_progressrun 时,判定结果是PENDING,行 161-167 随即写入failurecheck run 并exit 1。本应放行的 PR 被阻断。即使全部记录都是 completed,
sorted稳定排序不改变相对顺序,adv[-1]取的是 API 返回顺序的最后一条,而不是最新一条。GitHub 不保证 check-runs 列表按时间排序,因此重跑后可能取到旧的 failure 记录。建议显式按时间戳选取最新的 completed 记录,无 completed 时再判 PENDING。
🐛 建议修复:显式按时间取最新 completed
VERDICT=$(echo "$CHECKS" | python3 -c " import json,sys runs=json.loads(sys.stdin.read()).get('check_runs',[]) - adv=sorted([r for r in runs if r.get('name')=='adversary'], key=lambda r:(r.get('status')!='completed',)) + adv=[r for r in runs if r.get('name')=='adversary'] if not adv: print('MISSING') else: - a=adv[-1] - if a.get('status')=='completed' and a.get('conclusion')=='success': + done=sorted([r for r in adv if r.get('status')=='completed'], + key=lambda r:(r.get('completed_at') or '')) + if not done: + print('PENDING:'+str(adv[-1].get('status'))) + elif done[-1].get('conclusion')=='success': print('SURVIVED') - elif a.get('status')=='completed': - print('RED:'+str(a.get('conclusion'))) else: - print('PENDING:'+str(a.get('status'))) + print('RED:'+str(done[-1].get('conclusion'))) ")📝 Committable suggestion
🤖 Prompt for AI Agents
Uh oh!
There was an error while loading. Please reload this page.