The problem
An agent needs gh to open its PR and sentry to read the crash, but a token in the container is a token for everything that runs there. With the gh and sentry features, the sandbox holds a phantom token and devsandbox, on your host, swaps in the real one on each call it allows.
Config
devsandboxes.yaml
profiles:
work: {}
sandbox:
web:
folder: ../web
image: node:22
features:
ghcr.io/devsandboxes/features/gh:1: {}
ghcr.io/devsandboxes/features/sentry:1: {}Log in once, on the host
TERMINAL
devsandbox login github --feature ghcr.io/devsandboxes/features/gh:1 --profile work
devsandbox login sentry --feature ghcr.io/devsandboxes/features/sentry:1 --profile work --org my-orggithubopens GitHub’s fine-grained token page with the permissions gh needs filled in. Pick the repos, create it, paste it back.sentryopens Sentry’s own login page and waits for you to approve it.--org(repeatable) names the Sentry orgs sandboxes may reach; calls naming any other are refused.- Each shows what the feature may do with the token and whose account it is before storing it.
--profile workgrants it to instances in theworkprofile only.
Try it
TERMINAL
devsandbox run web --name fix-login
devsandbox exec fix-login sh -c 'echo $GH_TOKEN' # a phantom, not your token
devsandbox exec fix-login gh pr list
devsandbox exec fix-login git push # ssh remotes go over https too
devsandbox exec fix-login sentry issue list
devsandbox access ls # credentials, versions, instances using themHow it works
- gh writes only to the sandbox’s own repos (its folders’ remotes at the first
run) plus any inaccess.github.repos. Outside them, reads go without a token and writes are refused. access.<kind>.scopesnarrows what one sandbox may do, e.g.scopes: [repo.read, pr.write].- When a feature update changes what its token may be used for,
devsandbox runshows the change and asks you to approve it. Off a terminal it refuses; approve withdevsandbox access approve github. devsandbox access revoke githubdrops the credential from your host.
Agent instructions
Paste it into Claude Code, Codex or any agent with a shell. It finds your repo and config itself and asks only what it can't tell. Agent skills (opens in a new tab)
Source: site/src/content/examples/credentials.mdxEdit this page on GitHub(opens in a new tab)