Skip to content
isolate
Esc
↑↓navigate↵open⌘Jpreview
On this page

GitHub authentication

Choose a token strategy and configure repository-scoped PATs.

GitHub auth

The github field determines how isolate obtains a GITHUB_TOKEN for the guest:

Value Behavior
"auto" Checks $GITHUB_TOKEN first. Falls back to gh auth token if unset.
"env" Reads $GITHUB_TOKEN from the environment only. Warns if unset.
"off" No GitHub token forwarding.
"pat" Uses a per-repo fine-grained PAT recorded under github.pat. GitHub enforces the permissions and repositories selected for that token.

When a token is present, isolate runs gh auth setup-git inside the guest to wire up git credential helpers.

iso up --no-github and iso start --no-github force "github": "off" for that invocation, regardless of the configured strategy, and suppress the PAT setup prompt. Configured PAT retrieval commands are not evaluated. Model credentials and other configuration remain in effect, and the config file is not changed. iso up rejects this flag for an already-running instance; stop it first, then repeat up with the flag.

This has the same scope as "github": "off": it disables strategy-based token forwarding, but does not block explicit env_forward, guest_env, or --env entries, or the one-shot host-token fallback used for --git-repo clones. It does not erase credentials already stored in the guest. Later invocations (including shell and exec) use the configured strategy again.

Fine-grained PAT ("github": "pat")

In pat mode isolate forwards a per-repo fine-grained personal access token: the resolved owner/repo at VM startup selects the matching entry in github.pat. Compared with "auto" / "env", the effective reach of a leaked token is bounded by the repos and permissions GitHub recorded when it was created — GitHub rejects out-of-scope operations (REST and GraphQL) server-side, not in isolate.

Configure via the wizard:

iso github setup-pat --repo chr33s/iso

The wizard opens the PAT-creation form in your browser, validates the token via /user and /repos/<repo>, stores the token in the macOS Keychain (service iso-github-pat, account owner/repo), and writes a github.pat["owner/repo"] entry. The token itself is stored only in the Keychain — the config file holds a cmd: invocation that retrieves it. If the Keychain is unavailable the wizard fails; there is no fallback store.

Submodule discovery

A fine-grained PAT is scoped to specific repositories, so a token for the parent repo alone cannot clone its submodules. To help you scope the token correctly, the wizard inspects the parent repo’s .gitmodules and classifies the submodule URLs it finds. This is advisory only — it never fails the wizard, and a discovery problem won’t block writing a valid PAT entry.

Discovery makes outbound network calls:

  • It fetches .gitmodules from the parent’s default branch via the GitHub Contents API. Before you paste a token, it tries gh auth token (if gh is installed and authenticated) and otherwise falls back to an anonymous request, which can read the file when the parent repo is public. A 404 (no .gitmodules, or a private parent that an unauthenticated request can’t see) is treated as a successful empty result — there is simply nothing to suggest. Only when both attempts fail to reach a definitive answer (e.g. rate-limited or a network error) does discovery defer until after you paste the token, using that token instead. A gh auth token value read here is used only for this fetch — it is never persisted or forwarded into the guest.
  • For each candidate submodule it makes an anonymous GET /repos/<slug> to detect public repos. Public submodules clone without a token, so they are dropped from the suggestions. Unauthenticated GitHub API requests share a 60/hour per-IP rate limit, so a repo that can’t be confirmed public (404, rate-limited, or a network error) is treated as private and kept in the suggestions.

The remaining (private) submodules are routed by resource owner:

  • Same owner as the parent — a single PAT can cover these, so they are added to the form’s “Only select repositories” list alongside the parent. The wizard then re-probes the pasted token against each and re-prompts you to widen the token until all are covered.
  • Other owners — a fine-grained PAT is scoped to one resource owner, so each needs its own token. The wizard prints a follow-up iso github setup-pat --repo <slug> line per repo, grouped by owner.
  • Non-GitHub URLs (e.g. GitLab) — listed as a warning; this token can’t cover them.

Only depth-1 submodules are inspected. Submodules of submodules are not expanded and need their own setup-pat runs.

Multi-repo example:

{
  "github": {
    "mode": "pat",
    "pat": {
      "chr33s/iso": {
        "token": "cmd:security find-generic-password -s iso-github-pat -a chr33s/iso -w"
      },
      "example/agent-plugins": {
        "token": "cmd:security find-generic-password -s iso-github-pat -a example/agent-plugins -w"
      }
    }
  }
}

Bring-your-own-token (no wizard, useful for CI/Terraform). Any cmd: invocation that prints the token on stdout works. Examples:

{
  "github": {
    "mode": "pat",
    "pat": {
      // Vault
      "chr33s/iso": {
        "token": "cmd:vault read -field=token secret/iso/github/trailofbits-iso"
      },
      // 1Password CLI
      "example/agent-plugins": {
        "token": "cmd:op read op://Private/iso-github-pat/password"
      }
    }
  }
}

isolate runs such a reference only when it needs the token and never creates, changes, or deletes what it points at.

Other subcommands:

Command Effect
iso github status List configured entries and where they are stored; add --probe to test retrieval. Never prints token material.
iso github rotate-pat --repo X/Y Re-run the wizard against an existing entry (PATs expire — max 1 year).
iso github forget-pat --repo X/Y Remove the github.pat["X/Y"] entry and, for a iso-created Keychain item, the stored secret. Does not add a skip marker; the token may still be live on GitHub.
iso validate --probe Resolves each entry and probes GET /user against api.github.com. May trigger a Keychain authorization prompt (or your own cmd: tool’s prompt) the first time per session; vault: entries need one secret-store unlock.

Assign an existing PAT to a VM

iso github assign-pat --vm projects --repo myorg/frontend
iso github status --vm projects
iso github unassign-pat --vm projects

--repo selects the stored entry key, not the workspace repository or the PAT’s permission scope. For example, a token stored under myorg/frontend may also authorize myorg/backend; assigning it to a VM whose workspace is a plain parent directory works without detecting either child repository. Different VMs can select different entries for the same workspace.

Assignment is explicit opt-in and takes precedence over workspace detection. Only the validated key is saved in owner-only, atomically written <instance>/github_pat.json; the shared secret is resolved again for each subsequent session or clone. Assignment works while the VM is stopped. Restart/bootstrap, shell, exec, agent sessions, and restore/reprovision use it. Existing shells, agents, and background processes are not updated. Restart without --no-agents to establish the git credential helper on a guest that has never had GitHub authentication bootstrapped.

up --no-github and start --no-github suppress assignment use and the PAT setup prompt for that invocation, without removing the saved association. The existing separate clone fallback remains: under opt-out, a GitHub HTTPS clone may still use host credentials. Without an assignment, normal auth-mode and repository selection are unchanged.

Missing entries, unreadable or malformed assignment state, and failed secret retrieval fail instead of falling back. Restore a forgotten entry with setup-pat, or remove the association with unassign-pat. Rotation affects subsequent resolutions. Unassigning restores normal selection and neither deletes the shared secret nor revokes it on GitHub. Destroying the VM removes its association with the VM state, leaving the shared PAT intact.

An active assignment rejects managed GITHUB_TOKEN and GH_TOKEN entries in guest_env, either agent’s env_forward, or persisted --env / containerEnv overrides. Remove these conflicting entries, including saved keys in <instance>/guest_env.json, or unassign the PAT. This controls isolate’s delivery; the guest can still change its own environment. The VM receives the token’s actual authority over every repository it covers.

Auto-prompt at VM startup

When iso up or iso start runs with a resolvable repo (usually the synced workspace’s origin) and github is "off" (or "pat" with no matching entry), isolate offers to run the wizard inline: [y/N/never]. Three answers:

  • y — run the wizard, then continue the start.
  • N (default) — start unauthenticated, ask again next time.
  • never — record a skip marker under github.skip so isolate won’t ask again for this repo.

Non-interactive contexts (CI is set, stdin is not a TTY) skip the prompt and log a one-line tip pointing at iso github setup-pat. The --no-prompt flag skips the prompt silently. Set "setup": { "prompt_for_pat": false } in the configuration to disable the prompt globally.

Skip markers

{
  "github": {
    "mode": "pat",
    "skip": ["trailofbits/big-repo"]
  }
}

iso github setup-pat --repo X/Y removes any skip marker for X/Y when it adds a new entry.

Was this page helpful?