Repository navigation
feat(download): try gh auth token for a github token - #6725
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. Summary by CodeRabbit
Walkthrough
ChangesGitHub token resolution update
Merge Risk: 🟡 Moderate · up to The new GitHub token lookup can send credentials to non-HTTPS URLs or loosely matched hosts, which could expose tokens. This bounded security risk should be addressed or explicitly accepted before merging. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.) 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
Adds an opt-in mechanism to retrieve a GitHub API token via the GitHub CLI (gh auth token) when scoop config gh_token is set to the sentinel value ask-gh, avoiding storing the token in Scoop’s config while still enabling authenticated GitHub requests (e.g., private repo downloads, rate-limit avoidance).
Changes:
- Update
Get-GitHubTokento treatask-ghas a sentinel and, when configured, querygh auth token --hostname github.comonce per process as a last resort. - Add Pester coverage validating precedence (env/config), sentinel behavior, CLI invocation conditions, and one-probe-per-process caching.
- Document the new
gh_token: ask-ghbehavior inscoop-confighelp text.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/Scoop-Download.Tests.ps1 | Adds unit tests covering ask-gh behavior, source precedence, and probe caching for Get-GitHubToken. |
| libexec/scoop-config.ps1 | Documents the new gh_token = 'ask-gh' option and its requirements. |
| lib/download.ps1 | Implements the ask-gh sentinel flow and a per-process cached gh auth token probe. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
lib/download.ps1 (1)
601-614: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick winSensitive Data Exposure (CWE-319): Cleartext Transmission of Sensitive Information
Reachability: External · Exploitability: Moderate
Restrict the CLI token to HTTPS requests for
api.github.com.When
ask-ghreturns a token,Invoke-Downloadcan attach it to any URL containingapi.github.com/repos. Parse the request URI and requirehttps, the exactapi.github.comhost, and an/repos/path before addingAuthorization.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: dda0a3a0-6ca9-40d6-9657-54f5ef817f7e
📒 Files selected for processing (2)
lib/download.ps1test/Scoop-Download.Tests.ps1
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
620465a to
a124a46
Compare
a124a46 to
700b083
Compare
700b083 to
d9e5daa
Compare
d9e5daa to
f335fcb
Compare
|
Use |
0d7bc91 to
4c04bde
Compare
4c04bde to
4d61f3e
Compare
We uncovered a bug: setting a |
Description
Follow up for #6712 - set
scoop config gh_token 'ask-gh'to get scoop to askghfor a token (stored in Windows Credential Manager)Motivation and Context
Relates to #6712
How Has This Been Tested?
Checklist:
developbranch.^ about this, the changelog already has feat(download): Enhance Get-GitHubToken to include more token sources #6712


Confidence Score: 5/5
The PR appears safe to merge, with no new actionable issues found.Summary
Adds
gh auth token --hostname github.comas a fallback after configured and environment tokens.Reviews (7) · Last reviewed commit: "add chglog" · Reviewed by Greptile