Quality: Unauthenticated GitHub API request is susceptible to rate limiting - #376
Conversation
The `fetch_formalized_problem_numbers` function makes an unauthenticated request to the GitHub API. GitHub severely rate-limits unauthenticated API requests (60 requests per hour per IP). In shared or CI environments, this can easily cause the script to fail unexpectedly. Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
PR #376 made scripts/update_formalization_status.py authenticate its GitHub API call when GITHUB_TOKEN is present in the environment, to avoid the 60-request-per-hour-per-IP limit that applies to unauthenticated requests from shared runner IPs. That change alone had no effect in CI: Actions does not export GITHUB_TOKEN into the environment of `run` steps, so the variable was never set and the request stayed unauthenticated. Pass it explicitly. Follow-up to #376. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Merged, thanks — the underlying concern is real. One thing to flag for future reference: as submitted, this change had no effect in CI, which is the only place it matters. GitHub Actions does not export I've completed it in ba206c5, which adds to - name: Run update script
run: python3 scripts/update_formalization_status.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}The Python side is unchanged and was already correct — backward compatible when no token is set, If you send further changes of this kind, please check that the mechanism is actually wired up end to end, and note that CONTRIBUTING.md asks contributions produced with AI assistance to disclose it. |
Summary
Quality: Unauthenticated GitHub API request is susceptible to rate limiting
Problem
Severity:
Medium| File:scripts/update_formalization_status.py:L21The
fetch_formalized_problem_numbersfunction makes an unauthenticated request to the GitHub API. GitHub severely rate-limits unauthenticated API requests (60 requests per hour per IP). In shared or CI environments, this can easily cause the script to fail unexpectedly.Solution
Use the
GITHUB_TOKENenvironment variable if available to authenticate the request by adding an 'Authorization': f'Bearer {os.environ.get("GITHUB_TOKEN")}' header to therequests.get()call.Changes
scripts/update_formalization_status.py(modified)