---
title: gh and sentry without a token
description: gh, git push and sentry work in the sandbox; the tokens stay on your host.
order: 4
icon: key-round
tags: [credentials, github, sentry, agents]
related: [parallel-agents, services, caches]
---
import AgentPrompt from '../../components/AgentPrompt.astro';
import AgentPromptLink from '../../components/AgentPromptLink.astro';
## 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.
<AgentPromptLink />
## Config
```yaml title="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
```bash
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-org
```
- `github` opens GitHub's fine-grained token page with the permissions gh needs filled in. Pick the repos, create it, paste it back.
- `sentry` opens 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 work` grants it to instances in the `work` profile only.
## Try it
```bash
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 them
```
## How it works
- gh writes only to the sandbox's own repos (its folders' remotes at the first `run`) plus any in [`access.github.repos`](/docs/config#credentials-and-keys). Outside them, reads go without a token and writes are refused.
- `access.<kind>.scopes` narrows 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 run` shows the change and asks you to approve it. Off a terminal it refuses; approve with `devsandbox access approve github`.
- `devsandbox access revoke github` drops the credential from your host.
## Agent instructions
<AgentPrompt prompt="credentials" />