Repository navigation
ci(remediation-sweep): read Dependabot alerts per repo over REST, not one GraphQL query - #1196
Conversation
… one GraphQL query The sweep's single GraphQL query asked for 100 repositories with 100 open alerts each per page. GitHub answered it with HTTP 502 twice in a row (run 43988746284 and its re-run), so the sweep has dispatched nothing. The query step now lists the owner's repositories, then reads each one's open alerts from the REST endpoint. Each repo line keeps the shape the GraphQL query gave, so the filter, the targets file and the dispatch step are unchanged. REST names severities low/medium/high/critical, so medium becomes MODERATE. A repo whose alerts cannot be read is reported as unreadable, with a warning and a list in the step summary, never as having no alerts. The step fails if no repository could be read. Checked offline: the same three alerts, written as REST JSON and as GraphQL JSON, produce byte-identical targets at all four severity floors. Dropping the MEDIUM mapping makes them differ. actionlint reports only the three style notes main already has. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01J4QvDfStHgMdZGTeqaBgM1
|
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 39 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 56f893a30e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # gave, so the filter below is unchanged. REST names severities | ||
| # low/medium/high/critical; GraphQL named them LOW/MODERATE/HIGH/ | ||
| # CRITICAL, so medium becomes MODERATE. | ||
| gh api --paginate "users/$OWNER/repos?type=owner&per_page=100" \ |
There was a problem hiding this comment.
Enumerate private repositories before scanning
When HYPATIA_SCAN_PAT can access private repositories owned by the selected account, this discovery call silently omits them: GitHub documents GET /users/{username}/repos as “Lists public repositories for the specified user,” regardless of the supplied type=owner filter (GitHub REST documentation). The Query repos step will therefore report a successful partial sweep and never inspect or dispatch alerts for private repositories; use an authenticated-user or organization listing that includes accessible private repositories.
Useful? React with 👍 / 👎.
|
|
||
| while IFS=$'\t' read -r NAME ARCHIVED; do | ||
| [[ "$ARCHIVED" == "true" ]] && continue | ||
| if ! gh api --paginate "repos/$OWNER/$NAME/dependabot/alerts?state=open&per_page=100" \ |
There was a problem hiding this comment.
Bound alerts before constructing the dispatch payload
For a repository with sufficiently many open alerts, --paginate now collects every alert and the Dispatch findings step places the entire transformed list in client_payload.findings; the previous GraphQL query capped this list at 100 nodes. GitHub requires the repository-dispatch JSON payload to be less than 64 KB (GitHub REST documentation), so a heavily vulnerable repository can now receive a 422 response and no remediation dispatch. Cap, summarize, or batch the findings while retaining the full alert count.
Useful? React with 👍 / 👎.
| severity: (.security_advisory.severity | ascii_upcase | ||
| | if . == "MEDIUM" then "MODERATE" else . end), |
There was a problem hiding this comment.
Map the package-specific vulnerability severity
When an advisory's package-specific severity differs from its advisory-wide severity, this reads the wrong field and can apply the severity floor or report top_severity incorrectly. The previous GraphQL query selected securityVulnerability.severity, which GitHub defines as the severity “within this package,” separately from SecurityAdvisory.severity (GitHub GraphQL documentation); the corresponding REST field is .security_vulnerability.severity, already present beside the package and version range in each alert. Read that field before applying the MEDIUM normalization.
Useful? React with 👍 / 👎.



Summary
hypatia-remediation-sweephas dispatched nothing for weeks. First its token returned 401. Since #1176 moved the query toHYPATIA_SCAN_PAT, the query itself fails: one GraphQL request asked for 100 repositories × 100 open alerts each per page, and GitHub answered with HTTP 502. It did so twice in a row, in run 43988746284 and its re-run.The query step now lists the owner's repositories and then reads each one's open Dependabot alerts from the REST endpoint (
repos/{owner}/{repo}/dependabot/alerts?state=open).targets.jsonl, the summary table and the dispatch step stay as they were. REST names severitieslow/medium/high/critical, somediumbecomesMODERATE.egress-policy: block,api.github.com:443plus the artifact service) anduses:are untouched, soactions.lockand the deed's egress entry don't change.How has this been verified?
block. It loggedRead Dependabot alerts for 361 repositories; 0 could not be read.The artifact upload succeeded, which also covers the egress allow-list end to end. The dispatch step is skipped in dry-run mode and calls the same host.MEDIUM → MODERATEmapping makes the outputs differ.Notes
ci-health-sweepand this workflow's dispatch step still useHYPATIA_DISPATCH_PAT, which still returns 401 (run 43988750312, today). Rotating it is an owner action and outside this PR.Generated by Claude Code