Skip to content

fix(tools): project gh credentials into confined GitHub spawns - #411

Merged
github-actions[bot] merged 2 commits into
mainfrom
fix/gh-pr-create-sandbox
Aug 20, 2026
Merged

github-actions[bot] merged 2 commits into
mainfrom
fix/gh-pr-create-sandbox

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

Projects host gh identity into confined gh/git push spawns and rewrites SSH GitHub remotes to HTTPS so gh pr create works without unsandboxing.

gh pr create failed in the sandbox with HTTP 401 / "token is invalid"
even after host(**.github.com) was granted. The proxy could reach
api.github.com; the OS keychain could not be opened, so gh looked
unauthenticated.

A GitHub host grant now projects the host `gh` token into that spawn
and isolates GH_CONFIG_DIR so the CLI does not also try the blocked
keychain account. gh / git push may write .git for that spawn only;
ordinary commands keep the carve-out. This is a publish capability,
not an unsandbox.
gh pr create could authenticate via the projected token but still
aborted: the workspace remote is [email protected], and SSH cannot use
the CONNECT proxy. The same GitHub host grant now writes a spawn-local
gitconfig that insteadOf-rewrites SSH remotes to https://github.com/
and authenticates with GH_TOKEN, so push stays confined.
@github-actions
github-actions Bot enabled auto-merge (squash) August 20, 2026 02:58
@github-actions
github-actions Bot merged commit 016cfef into main Aug 20, 2026
8 checks passed
mohitranka added a commit that referenced this pull request Aug 21, 2026
* fix(tools): project gh credentials into confined GitHub spawns

gh pr create failed in the sandbox with HTTP 401 / "token is invalid"
even after host(**.github.com) was granted. The proxy could reach
api.github.com; the OS keychain could not be opened, so gh looked
unauthenticated.

A GitHub host grant now projects the host `gh` token into that spawn
and isolates GH_CONFIG_DIR so the CLI does not also try the blocked
keychain account. gh / git push may write .git for that spawn only;
ordinary commands keep the carve-out. This is a publish capability,
not an unsandbox.

* fix(tools): rewrite SSH GitHub remotes to HTTPS in confined spawns

gh pr create could authenticate via the projected token but still
aborted: the workspace remote is [email protected], and SSH cannot use
the CONNECT proxy. The same GitHub host grant now writes a spawn-local
gitconfig that insteadOf-rewrites SSH remotes to https://github.com/
and authenticates with GH_TOKEN, so push stays confined.
mohitranka added a commit that referenced this pull request Sep 11, 2026
* fix(tools): project gh credentials into confined GitHub spawns

gh pr create failed in the sandbox with HTTP 401 / "token is invalid"
even after host(**.github.com) was granted. The proxy could reach
api.github.com; the OS keychain could not be opened, so gh looked
unauthenticated.

A GitHub host grant now projects the host `gh` token into that spawn
and isolates GH_CONFIG_DIR so the CLI does not also try the blocked
keychain account. gh / git push may write .git for that spawn only;
ordinary commands keep the carve-out. This is a publish capability,
not an unsandbox.

* fix(tools): rewrite SSH GitHub remotes to HTTPS in confined spawns

gh pr create could authenticate via the projected token but still
aborted: the workspace remote is [email protected], and SSH cannot use
the CONNECT proxy. The same GitHub host grant now writes a spawn-local
gitconfig that insteadOf-rewrites SSH remotes to https://github.com/
and authenticates with GH_TOKEN, so push stays confined.
mohitranka added a commit that referenced this pull request Sep 11, 2026
* fix(tools): project gh credentials into confined GitHub spawns

gh pr create failed in the sandbox with HTTP 401 / "token is invalid"
even after host(**.github.com) was granted. The proxy could reach
api.github.com; the OS keychain could not be opened, so gh looked
unauthenticated.

A GitHub host grant now projects the host `gh` token into that spawn
and isolates GH_CONFIG_DIR so the CLI does not also try the blocked
keychain account. gh / git push may write .git for that spawn only;
ordinary commands keep the carve-out. This is a publish capability,
not an unsandbox.

* fix(tools): rewrite SSH GitHub remotes to HTTPS in confined spawns

gh pr create could authenticate via the projected token but still
aborted: the workspace remote is [email protected], and SSH cannot use
the CONNECT proxy. The same GitHub host grant now writes a spawn-local
gitconfig that insteadOf-rewrites SSH remotes to https://github.com/
and authenticates with GH_TOKEN, so push stays confined.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant