Skip to content

fix: stop passing GitHub token on the curl command line#634

Open
mesutoezdil wants to merge 2 commits into
Project-HAMi:masterfrom
mesutoezdil:fix/changelog-token-exposure
Open

fix: stop passing GitHub token on the curl command line#634
mesutoezdil wants to merge 2 commits into
Project-HAMi:masterfrom
mesutoezdil:fix/changelog-token-exposure

Conversation

@mesutoezdil

@mesutoezdil mesutoezdil commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

What

In the fetchFromWebPage() fallback of src/scripts/fetch-changelog.js:

  • Drop the Authorization header from the fallback fetch. It downloads the public HTML release page, where the API token does nothing except get exposed.
  • Replace execSync with a string-built shell command by spawnSync("curl", [args]). Nothing is interpolated into a shell anymore.
  • Use -fsSL so HTTP errors fail with a clear message and redirects are followed, add --max-time 30 so a stalled connection cannot hang the script (the API path already has a 10s timeout), and surface result.error and signal terminations explicitly.

Why

Two problems with the old code:

  1. GH_PAT was embedded in the shell command line, so it was visible in the process list to any local process and could leak into execSync error messages and CI logs.
  2. The command string interpolated GITHUB_URL, which is built from the CLI version argument, into a shell. An argument array removes shell interpretation entirely.

The primary API path already sends the token correctly via HTTPS request headers and is unchanged.

Testing

  • node --check and prettier pass
  • Success path exercised against the v2.6.0 release page (status 0, full page body returned)
  • Error path exercised against a nonexistent tag: curl now exits 56 with "The requested URL returned error: 404" instead of silently returning an empty page

Copilot AI review requested due to automatic review settings July 22, 2026 12:12
@hami-robot

hami-robot Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mesutoezdil
Once this PR has been reviewed and has the lgtm label, please assign wawa0210 for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@netlify

netlify Bot commented Jul 22, 2026

Copy link
Copy Markdown

Deploy Preview for project-hami ready!

Name Link
🔨 Latest commit 858a30b
🔍 Latest deploy log https://app.netlify.com/projects/project-hami/deploys/6a6399151baa740008552755
😎 Deploy Preview https://deploy-preview-634--project-hami.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@mesutoezdil, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 09eb2af3-0a69-4992-a44b-9fea8d7e90f4

📥 Commits

Reviewing files that changed from the base of the PR and between 801bfd9 and 858a30b.

📒 Files selected for processing (1)
  • src/scripts/fetch-changelog.js
📝 Walkthrough

Walkthrough

The changelog web-page fallback now uses spawnSync to run curl, applies explicit output settings, validates process results, and reports stderr-based failures. The fallback no longer sends the GitHub token; API authentication remains unchanged.

Changes

Changelog fetch

Layer / File(s) Summary
Structured curl fallback
src/scripts/fetch-changelog.js
Replaces execSync with spawnSync, configures curl with -fsSL, UTF-8 output, and a larger buffer, and handles execution errors, status, stderr, and stdout without an authorization header.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: archlitchi, copilot, rootsongjc

Poem

I’m a rabbit with curl in my paws,
Fetching release notes without a pause.
Spawned with care, errors made clear,
No webpage token travels here.
The changelog hops home bright and near.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main security-related change: removing the GitHub token from the curl-based fallback path.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Copilot AI 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.

Pull request overview

This PR hardens the fetch-changelog script by preventing accidental exposure of the GitHub token and eliminating shell interpolation in the fallback HTML fetch path.

Changes:

  • Replaces execSync (string shell command) with spawnSync("curl", [...args]) to avoid shell interpretation.
  • Stops sending the Authorization header in the fallback web-page fetch (token would be ineffective and unnecessarily exposed).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/scripts/fetch-changelog.js Outdated
Comment thread src/scripts/fetch-changelog.js
Copilot AI review requested due to automatic review settings July 22, 2026 12:28
@mesutoezdil
mesutoezdil force-pushed the fix/changelog-token-exposure branch from 7b25302 to 801bfd9 Compare July 22, 2026 12:28

Copilot AI 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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread src/scripts/fetch-changelog.js Outdated
The web page fallback in fetch-changelog.js embedded GH_PAT in a
shell string, exposing it in the process list and error messages.
The token is useless for fetching the public release page anyway.
Use spawnSync with an argument array so nothing is interpolated
into a shell command, fail on HTTP errors with -f, follow
redirects with -L, cap the request at 30 seconds and surface
spawn errors explicitly.

Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
Copilot AI review requested due to automatic review settings July 22, 2026 12:34
@mesutoezdil
mesutoezdil force-pushed the fix/changelog-token-exposure branch from 801bfd9 to 814046c Compare July 22, 2026 12:34

Copilot AI 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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@mesutoezdil
mesutoezdil requested a review from windsonsea July 23, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants