Skip to content

fix(scripts): resolve URL scheme safety and method complexity in check_upstream_updates.py - #100

Merged
tonythethompson merged 1 commit into
mainfrom
fix/issue-98-99-check-upstream-updates
Aug 17, 2026
Merged

fix(scripts): resolve URL scheme safety and method complexity in check_upstream_updates.py#100
tonythethompson merged 1 commit into
mainfrom
fix/issue-98-99-check-upstream-updates

Conversation

@tonythethompson

@tonythethompson tonythethompson commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #98
Fixes #99


Summary by cubic

Restricts all GitHub API requests and redirects to http/https with a host, and refactors audit_entry into focused helpers to reduce complexity. Previously redirects could target non-http(s) schemes; now invalid URLs or redirects fail fast, and status computation is isolated and easier to review.

  • fetch_github_json calls ensure_http_url and uses http_opener().open; invalid URLs/redirects raise ValueError before the request.
  • Adds _HttpOnlyRedirectHandler and HTTP_SCHEMES to enforce http/https-only redirects.
  • Splits audit_entry into _check_tag_moved, _check_has_new_tag, and _determine_status; behavior is unchanged aside from stricter URL/redirect validation.
  • Adds unit tests for URL validation, redirect handling, helper logic, and opener construction in scripts/test_check_upstream_updates.py.
  • No migration required; inputs, outputs, and statuses are unchanged.

Written for commit 400566a. Summary will update on new commits.

Review in cubic

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry @tonythethompson, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Important

Review available on request

  • 🔍 Trigger review

Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment @coderabbitai review to review the latest changes. For a full review, comment @coderabbitai full review.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a8581949-8817-49e8-a1e3-f95049d662d8


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

Comment @coderabbitai help to get the list of available commands.

@tonythethompson
tonythethompson merged commit 7feb6d7 into main Aug 17, 2026
9 checks passed
@tonythethompson
tonythethompson deleted the fix/issue-98-99-check-upstream-updates branch August 17, 2026 19:29
@linear-code

linear-code Bot commented Aug 17, 2026

Copy link
Copy Markdown

TS-198

@opencode-agent

Copy link
Copy Markdown
Contributor

Findings

  • [P1] Prevent credential-bearing cross-origin redirects at scripts/check_upstream_updates.py:61. The guard permits any HTTP(S) hostname, and urllib copies the Authorization header during redirects, exposing GITHUB_TOKEN to arbitrary hosts or via HTTPS-to-HTTP downgrade. Restrict redirects to the trusted origin and HTTPS, or strip credentials when the origin changes.

Validation

  • Full suite passed: 158 tests.

New%20session%20-%202026-08-17T19%3A28%3A26.044Z
opencode session  |  github run

@kilo-code-bot

kilo-code-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • scripts/check_upstream_updates.py
  • scripts/test_check_upstream_updates.py

Reviewed by step-3.7-flash · Input: 124.3K · Output: 15.4K · Cached: 459.3K

Review guidance: REVIEW.md from base branch main

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

Labels

None yet

Projects

None yet

1 participant