Repository navigation
fix(cli): skills update check never opens a Git Credential Manager window - #5198
ezra21997-cell wants to merge 1 commit into
Conversation
jrusso1020
left a comment
There was a problem hiding this comment.
Reviewed at 2c459e0. LGTM.
What I checked:
- Tests pass at head:
skillsManifest.test.ts(65/65) andcommands/skills.test.ts(40/40). WithskillsManifest.tsreverted to the parent commit, 5 of the 6 new tests fail, and they pass again with the fix. - I reproduced the env/config behaviour on git 2.50.1. The setup was a local server answering 401 with a logging credential helper configured globally, URL-scoped and via
GIT_CONFIG_COUNT, plus a logging askpass oncore.askPassandSSH_ASKPASS. Before the fix: 6 helper calls and 2 askpass calls. With this PR's argv and env: 0 and 0. With only-c credential.helper=, askpass still runs. With onlyGIT_ASKPASS=, the helpers still run. So both halves are needed, as the description says. - The normal path still works: the exact invocation against
github.com/heygen-com/hyperframesreturns main's SHA. The repo is public and the manifest fetch from raw.githubusercontent.com is unauthenticated, so clearing helpers costs nothing. - The slug guard (
skillsManifest.ts:113,:668) only short-circuits to the existing branch-URL fallback. URL and local-path sources are routed away beforeremoteHeadSha.
The only thing I couldn't verify is how Git for Windows reads an empty GIT_ASKPASS from the environment. It doesn't change the verdict, because -c credential.helper= is what keeps GCM out, and that part is platform-independent.
— Rames
|
Thanks for this! It's approved, but To fix it:
Docs: About commit signature verification. Once the commit shows Verified, we'll re-approve and merge. — Rames |
2c459e0 to
d0333d2
Compare
|
Thanks for the review, and for reproducing it on git 2.50.1! I've re-signed the commit with a signing key on my account, and GitHub now shows it as Verified. The content is unchanged from the version you approved. |
|
Thanks, @ezra21997-cell. This was approved and in the merge queue, but another PR that merged ahead of it touched the same lines, so GitHub took it out of the queue with a merge conflict. Could you rebase onto the latest — Rames |
…ndow The skills check resolves main's HEAD with `git ls-remote`. A private or missing repo answers with an auth challenge, and GIT_TERMINAL_PROMPT=0 only covers git's own terminal prompt: credential helpers and askpass still run, and Git Credential Manager (the Git for Windows default helper) opens a sign-in window that blocks the check until it is closed. Run ls-remote with credential helpers and askpass disabled (`-c credential.helper=`, GIT_ASKPASS="", GCM_INTERACTIVE=never). Also skip git for a slug that does not look like `owner/repo`; such a slug gets a plain 403 rather than an auth challenge, so this check is defensive. The repos read here are public, so no credentials are lost. Fixes heygen-com#4702 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JSZqP4FbpqviXu9v2LjBwE
|
Rebased onto current Re-checked: |
d0333d2 to
88fd6fd
Compare
miguel-heygen
left a comment
There was a problem hiding this comment.
Thanks for the quick rebase. I compared the rebased commit with the one that was approved (d0333d27): the change to packages/cli/src/utils/skillsManifest.ts is identical, and the tests differ only by one blank line next to the block #6168 removed. It merges cleanly with current main, and the commit shows as verified.
The only thing left is CI: the full workflows at 88fd6fd4 haven't run yet (fork PRs need a maintainer to approve the run). Once they're green, this should be ready to requeue.
Reviewed head 88fd6fd4.
Verdict: COMMENT
Reasoning: The rebase is code-identical to the approved commit, but full CI hasn't run at the new head yet.
What
remoteHeadSha()inpackages/cli/src/utils/skillsManifest.tsrunsgit ls-remotewith credential helpers and askpass disabled. It also skips git entirely when the slug does not look likeowner/repo.Why
The skills update check SHA-pins the manifest with
git ls-remote https://github.com/<slug>.git refs/heads/main. A private or missing repo answers with an auth challenge.GIT_TERMINAL_PROMPT=0only silences git's own terminal prompt, so credential helpers and askpass still run. On Windows the default helper is Git Credential Manager, which opens a sign-in window. The check blocks until someone closes it, including the background update check, which has no console.A malformed slug such as
owner/repo/extragets a plain 403 from GitHub and never reaches a credential helper. So the slug check is defensive: it saves a pointless git process and keeps arbitrary text away from git's arguments, but it is not what fixes the reported window.Related work
Fixes #4702
How
git -c credential.helper= ls-remote …: an empty value clears every configured helper. Verified for system, global, URL-scoped andGIT_CONFIG_COUNTconfig.GIT_ASKPASS=""stops askpass. An empty value also skips thecore.askPassandSSH_ASKPASSfallbacks.GCM_INTERACTIVE=neveris belt-and-braces for GCM itself. It is redundant once helpers are cleared, but harmless.REPO_SLUG_PATTERN = /^[\w.-]+\/[\w.-]+$/: a non-matching slug returnsnullbefore git is spawned. The caller already falls back to the branch raw URL in that case, so the result for invalid input is unchanged, minus the git process.The repos read here are public, so no credentials are lost. A real
ls-remoteagainstgithub.com/heygen-com/hyperframeswith these flags still returnsmain's SHA.Test plan
Unit tests added (6):
ls-remotecallls-remotereportsWithout the source change, 5 of the 6 fail. The positive test also fails when the regex is mutated to reject everything. The suite uses
mockResetso a queuedmockImplementationOncecannot leak into the next test.Manual testing (git 2.43): a local HTTP server answering 401, with a logging credential helper in each of system, global, URL-scoped and
GIT_CONFIG_COUNTconfig, and a logging askpass oncore.askPassandSSH_ASKPASS.getcallsGIT_TERMINAL_PROMPT=0only)-c credential.helper=Both halves of the fix are needed.
tsc --noEmit,oxlint,oxfmt --check,check-comment-citations,comment-ratchet, commitlint and the lefthook pre-commit hooks pass.Full
packages/clisuite: 4349 passed. 1 failed:desktopApp.test.ts"still opens a project it cannot write to", which also fails on unmodifiedmainwhen run as root (it relies onchmod 555).Not run on a real Windows machine with GCM installed, or on git older than 2.43.
Comments follow CONTRIBUTING.md "Comments".
Follow-ups (not in this PR)
packages/cli/src/whisper/manager.ts,buildFromSource():git clone --depth 1 <WHISPER_REPO>has the same exposure (onlyGIT_TERMINAL_PROMPT=0). The URL is a fixed public repo, so it only bites if that repo moves or disappears. A sharedgitNoPromptArgs/gitNoPromptEnvhelper would cover both call sites.fetchRemoteManifest(): the raw-URL fallback still buildsraw.githubusercontent.com/${slug}/main/…from the unvalidated slug, soowner/repo?x=1turns the rest of the path into a query string. No security impact (same host, unauthenticated GET). Validating once at the top would turn a 404 into a clear error, but--sourcecallers would need checking.REPO_SLUG_PATTERNacceptsowner/.andowner/... That is not exploitable, because the slug only ever sits inside anhttps://github.com/URL, but a stricter pattern would match GitHub's naming rules exactly.fetchRemoteManifesttreats any source starting withhttpas a URL, so an owner namedhttps-tools/...would be misrouted.Review record
Two independent review rounds ran on this patch.
mockReset, a justifiedas unknown ascast) and the docstring. All are applied.🤖 Generated with Claude Code