Skip to content

ci(remediation-sweep): read Dependabot alerts per repo over REST, not one GraphQL query - #1196

Merged
hyperpolymath merged 1 commit into
mainfrom
claude/remediation-sweep-rest
Nov 17, 2026
Merged

hyperpolymath merged 1 commit into
mainfrom
claude/remediation-sweep-rest

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

hypatia-remediation-sweep has dispatched nothing for weeks. First its token returned 401. Since #1176 moved the query to HYPATIA_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).

  • Downstream unchanged. Each repository line keeps the shape the GraphQL query produced, so the floor filter, targets.jsonl, the summary table and the dispatch step stay as they were. REST names severities low/medium/high/critical, so medium becomes MODERATE.
  • No silent "clean" result. A repository whose alerts can't be read is listed as unreadable, with a warning and a list in the step summary. The step fails if no repository could be read.
  • Credentials, harden-runner (egress-policy: block, api.github.com:443 plus the artifact service) and uses: are untouched, so actions.lock and the deed's egress entry don't change.

How has this been verified?

  • Live dry run of this branch, run 43994805488: green under harden-runner block. It logged Read 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.
  • Offline equivalence test: the jq programs were extracted from this workflow file. The same three alerts, written as REST JSON and as GraphQL JSON, produce byte-identical targets at all four severity floors, and a repository with no alerts drops out as before.
  • Negative control: removing the MEDIUM → MODERATE mapping makes the outputs differ.
  • actionlint 1.7.7 with shellcheck: only the three SC2129 style notes main already has.
  • Cost: about one call per repository plus the repo listing, roughly 470 REST calls per run, well inside the 5,000/hour PAT limit.

Notes

  • ci-health-sweep and this workflow's dispatch step still use HYPATIA_DISPATCH_PAT, which still returns 401 (run 43988750312, today). Rotating it is an owner action and outside this PR.

Generated by Claude Code

… 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
@sonarqubecloud

Copy link
Copy Markdown

Repository owner deleted a comment from coderabbitai Bot Nov 17, 2026
@hyperpolymath
hyperpolymath marked this pull request as ready for review November 17, 2026 01:39
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T01:45:03.721403Z 56f893a Draft marked ready
🔒 Security Review ❌ Failed 2026-11-17T01:39:06.918498Z
We couldn’t complete this review. Comment @codex security review to try again.
56f893a Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

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.

@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 45638391-cda0-45ff-967f-15fc245a255d
Commits

Reviewing files that changed from the base of the PR and between 6d8ab66 and 56f893a.

Files selected for processing: 1

  • .github/workflows/hypatia-remediation-sweep.yml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@hyperpolymath
hyperpolymath merged commit 29a9e4a into main Nov 17, 2026
100 checks passed
@hyperpolymath
hyperpolymath deleted the claude/remediation-sweep-rest branch November 17, 2026 01:39

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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" \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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" \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +125 to +126
severity: (.security_advisory.severity | ascii_upcase
| if . == "MEDIUM" then "MODERATE" else . end),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants