fix: stop passing GitHub token on the curl command line#634
fix: stop passing GitHub token on the curl command line#634mesutoezdil wants to merge 2 commits into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mesutoezdil The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for project-hami ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Warning Review limit reached
Next review available in: 59 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe changelog web-page fallback now uses ChangesChangelog fetch
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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) withspawnSync("curl", [...args])to avoid shell interpretation. - Stops sending the
Authorizationheader 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.
7b25302 to
801bfd9
Compare
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>
801bfd9 to
814046c
Compare
What
In the
fetchFromWebPage()fallback ofsrc/scripts/fetch-changelog.js:Authorizationheader from the fallback fetch. It downloads the public HTML release page, where the API token does nothing except get exposed.execSyncwith a string-built shell command byspawnSync("curl", [args]). Nothing is interpolated into a shell anymore.-fsSLso HTTP errors fail with a clear message and redirects are followed, add--max-time 30so a stalled connection cannot hang the script (the API path already has a 10s timeout), and surfaceresult.errorand signal terminations explicitly.Why
Two problems with the old code:
GH_PATwas embedded in the shell command line, so it was visible in the process list to any local process and could leak intoexecSyncerror messages and CI logs.GITHUB_URL, which is built from the CLIversionargument, 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 --checkand prettier pass