Summary
ghUsesNetwork in internal/sandbox/analyzer.go treats only three gh invocations as network access: gh api, gh release download and gh repo clone. Every other gh subcommand that talks to GitHub (gh issue …, gh pr …, gh run …, gh repo view, gh search …, gh workflow …, gh release view/list) is classified as a local command. It therefore runs with the network denied and never reaches the permission flow that offers a network grant, unlike git push or curl.
Evidence
Same function on main (8288ae81) and on the v0.14.0 tag:
func ghUsesNetwork(words []string) bool {
first := firstSubcommand(words, nil)
if first == "api" {
return true
}
second := secondSubcommand(words)
return (first == "release" && second == "download") ||
(first == "repo" && second == "clone")
}The only test that pins this is internal/sandbox/analyzer_test.go (gh release download v1.0.0 → network: true). No test asserts that the other subcommands are local, so this looks like an incomplete allowlist rather than a decision.
Expected
Treat every gh subcommand as network access except an explicit local list (--help, --version, completion, config, alias, extension list, …), so the user gets the normal network prompt.
Notes
- Linux,
linux-bwrapbackend,sandbox.networkat its default (deny). - I found this by reading the classifier and have not yet reproduced the network failure end to end, because in my setup
ghfirst fails earlier for a credentials reason (reported separately). - Related: #703 (network grants), #815 (credential deny list).
Confirmed on main at
8288ae81.ghUsesNetworkreturns true forapi,release downloadandrepo cloneonly. I ran the function on a few forms:gh pr list,gh issue view 5andgh run watchall come back false, so they are planned as local commands and run with the network denied, with no prompt. Nothing leaks; the command just fails wheregit pushwould have asked.Approved, labelled
bugandissue-approved. Three things for the PR:ghsubcommand is network unless it is on a short local list, so a new or aliased subcommand lands on the prompting side by default.firstSubcommandandsecondSubcommandskip a word that starts with-but not the value after it.gh release -R owner/repo download v1comes back false today, becauseowner/repois read as the second word. The inversion makes that particular case safe, but the local list is matched the same way, so please add cases with a value-taking option in front of and between the subcommand words.unparseableNetworkPatternininternal/sandbox/risk.gohas its ownghalternative with the same three forms, for commands the parser gives up on. Both have to read one rule, orgh pr listinside a Windows conditional keeps the old answer.Tests on the classifier are enough here. No need to reproduce the network failure end to end.