> ## Documentation Index
> Fetch the complete documentation index at: https://docs.boat.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Access and credentials

> Choose what of yours a sandbox receives: GitHub access, secrets, setup scripts, boat credentials and agent logins.

This page covers the credentials a sandbox gets. For the full security picture, read [Security and isolation](https://docs.boat.dev/security.md).

## Safe for third parties

One switch sets the security of an environment.

> [card] On
>
> Use it for sandboxes that other people use, for example your own end users. **boat passes nothing of yours.** The sandbox gets no environment variables, no secret files, no GitHub access, no boat credentials, no agent logins and no repository setup scripts. This is true whatever the section toggles say. The sandbox cannot act on your account or your other sandboxes.

> [card] Off
>
> Use it for sandboxes that only you use. The four section toggles below apply. You choose exactly what goes in.

```bash CLI theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
boat env set base --safe-for-third-parties true
```

```bash curl theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
curl -sS -X PUT "$BOAT_API_BASE/environments/$ENV_ID" \
  -H "Authorization: Bearer $BOAT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"safeForThirdParties":true}'
```

```ts TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
await sandbox.updateEnvironment({
  environmentId: envId,
  safeForThirdParties: true,
});
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
from boat_sdk.models.update_sandbox_environment_request import UpdateSandboxEnvironmentRequest

sandbox.update_environment(env_id, UpdateSandboxEnvironmentRequest(safe_for_third_parties=True))
```

`$BOAT_API_BASE` is `https://boat.dev/api/v1`. Get `$ENV_ID` from `GET /environments` or `boat env list`.

> [!WARNING]
>
> When the switch is on, the toggle fields still show `true` in `boat env list` and the API. The `effective` field shows what sandboxes really get. A secret that you add to such an environment reaches no sandbox. The API answer then carries a `warning`.

Check what a sandbox received:

```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
boat env info base                      # safeForThirdParties: yes or no
boat exec <id> 'echo "[$STRIPE_KEY]"'   # [] means the variable did not arrive
```

### The `--no-env` flag

The `--no-env` flag (`noEnv` in the API) gives the same protection to one sandbox. boat keeps this flag forever.

* `boat new --no-env` works exactly like a start in an environment that is safe for third parties.
* Use the environment when more than a few sandboxes need this protection.
* The environment setting applies to every sandbox that uses it.
* The environment setting stays through forks and resumes. Your code does not have to pass a flag.

### What a normal sandbox receives

This table shows what a sandbox gets from your account when boat withholds nothing.

| Type | What boat passes in |
| - | - |
| Environment variables | Your environment's variables, your GitHub token, and your model credentials if you configured agents (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `CLAUDE_CODE_OAUTH_TOKEN`, `CHATGPT_ACCOUNT_ID`) |
| Credential files | Your secret files, the GitHub CLI login (`~/.config/gh/hosts.yml`), git credentials in cloned repositories, Claude and Codex logins (`~/.claude/.credentials.json`, `~/.codex/auth.json`), and the in-sandbox boat CLI token (`~/.config/ascii/boat/config.json`) |
| Scripts | The setup scripts of your repositories |

Every sandbox, protected or not, also gets two neutral variables: `BOAT_ID` and `ASCII_TOKEN`. `ASCII_TOKEN` can act only on this one sandbox. A protected sandbox receives nothing else, except the values that you pass with `env`.

### What a protected home contains

A protected sandbox does not start with an empty home. boat puts these defaults in every home. They are not your data, and they hold no account credentials.

| Location | Content |
| - | - |
| `~/.claude`, `~/.claude.json` | Claude Code skills, MCP configuration and default settings |
| `~/.codex`, `~/.config/opencode` | Codex and OpenCode skills and configuration |
| Default Chrome profile | Default preferences |
| Remote desktop key | A key for this sandbox only |

The credential files in the table above do not exist in a new protected sandbox.

### Protect an existing sandbox

A snapshot of a normal sandbox can contain your secrets. To protect a sandbox made from such a snapshot, resume or fork it with `--no-env`:

```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
boat resume <id> --no-env
boat fork <id> --no-env
```

Before the sandbox becomes reachable, boat removes every owner secret that the snapshot can contain:

* The managed `~/.bashrc` blocks.
* `~/.config/gh/hosts.yml`. boat also runs a `gh` logout.
* `~/.git-credentials`.
* The `~/.ssh/id_*` private keys.
* The Codex and Claude credential files.
* The in-sandbox boat CLI token.
* Every secret file that you configured.

boat keeps `authorized_keys` and `known_hosts`, so you can still reach the sandbox.

boat does not touch credentials that it did not write. These stay:

* `aws` and `gcloud` credentials.
* `.netrc` and `.npmrc`.
* Docker logins added inside the sandbox.

While the removal runs, SSH and desktop return a `sandbox_securing` error. Retry the request. This change goes one way only. The sandbox stays protected after it.

> [!WARNING]
>
> boat removes the Claude and Codex credential files even when the sandbox's own user signed in with a personal account inside the sandbox. boat cannot tell whose files they are. If they belong to the sandbox's user, back them up first and restore them after.

## The four section toggles

When *Safe for third parties* is off, four separate toggles decide what a sandbox receives. Each toggle is a section in the dashboard. Open a section to edit what is inside it.

| Section | CLI flag | What the sandbox gets | When you turn it off |
| - | - | - | - |
| GitHub repositories | `--github` | Your repositories cloned in, the GitHub token, and the repository setup scripts | `gh` and `git push` stop working. No setup script runs. |
| Secrets | `--secrets` | Your environment variables and secret files | Sandboxes drop them at their next start. boat keeps what you typed. |
| boat credentials | `--boat-credentials` | A boat API key, so the sandbox can snapshot, stop and resume itself | The sandbox cannot manage its own lifecycle |
| Agents credentials | `--agents-credentials` | The provider keys (Claude, Codex, and others) from the Agents & Proxying tab | Agents in the sandbox have no login |

```bash CLI theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
boat env set base --github true --secrets true --boat-credentials false --agents-credentials true
```

```bash curl theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
curl -sS -X PUT "$BOAT_API_BASE/environments/$ENV_ID" \
  -H "Authorization: Bearer $BOAT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"passGithub":true,"passSecrets":true,"passSandboxCredentials":false,"passAgentsCredentials":true}'
```

```ts TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
await sandbox.updateEnvironment({
  environmentId: envId,
  passGithub: true,
  passSecrets: true,
  passSandboxCredentials: false,
  passAgentsCredentials: true,
});
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
sandbox.update_environment(env_id, UpdateSandboxEnvironmentRequest(
    pass_github=True,
    pass_secrets=True,
    pass_sandbox_credentials=False,
    pass_agents_credentials=True,
))
```

## AI credentials

Two fields decide which AI credentials the environment's sandboxes get.

| Field | CLI flag | What it does |
| - | - | - |
| `credentialProfileId` | `--credential-profile <name\|id\|default>` | The [credential profile](https://docs.boat.dev/ai-credentials.md#credential-profiles) the sandboxes get. `null` (`default` in the CLI) means the sandbox owner's default profile |
| `proxyAiCredentials` | `--proxy-ai-credentials <true\|false>` | Only with *Safe for third parties* on. The sandboxes still get AI credentials, as [proxy placeholders](https://docs.boat.dev/ai-credentials.md#the-ai-credentials-proxy). Needs the proxy on for the profile owner, else `400 ai_proxy_off` |

```bash CLI theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
boat env set base --credential-profile work
boat env set customers --safe-for-third-parties true --proxy-ai-credentials true
```

```bash curl theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
curl -sS -X PUT "$BOAT_API_BASE/environments/$ENV_ID" \
  -H "Authorization: Bearer $BOAT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"credentialProfileId":"work"}'
```

```ts TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
await sandbox.updateEnvironment({ environmentId: envId, credentialProfileId: "work" });
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
sandbox.update_environment(env_id, UpdateSandboxEnvironmentRequest(credential_profile_id="work"))
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.