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

# Security and secrets

> Handle API keys, provider keys, Debug UI URLs, CDP URLs, policies, and user-provided secrets safely.

Agentic web workflows can touch real applications, credentials, files, and signed browser capabilities. Keep secrets out of prompts and logs, and use policy boundaries before the browser touches sensitive systems.

## Credentials

| Credential                  | Where it belongs                                                                                                           |
| --------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| Webcompute API key          | `web login`, `WEBCOMPUTE_API_KEY`, or `new Web({ apiKey })`                                                                |
| Model provider key          | Provider-specific environment variable such as `OPENROUTER_API_KEY`, `OPENAI_API_KEY`, or another verified model route key |
| User secrets for agent runs | `--secret name=ENV_VAR` in the CLI or SDK `variables` with domain scope                                                    |
| Debug UI and CDP URLs       | Short-lived internal logs or UI only, never public transcripts                                                             |

Do not paste real keys into prompts, issue trackers, source control, or shared transcripts.

## Signed browser capabilities

Debug UI and CDP URLs are bearer capabilities. Anyone with the URL can inspect or control the browser within that capability's scope.

Use them intentionally:

* Request `--debug-url` only when a human needs it.
* Redact signed URLs from logs.
* Avoid passing signed URLs back into untrusted model prompts.
* Close browsers when inspection is complete.

## Policy boundaries

Browser policy lets you limit where a browser can go and how it handles downloads, uploads, private-network access, and approvals.

```ts theme={null}
const browser = await web.browser.create({
  policy: {
    allowedDomains: ["sec.gov"],
    downloads: { mode: "allow", maxBytes: 25_000_000 },
    uploads: { mode: "requireApproval" },
    approvals: { destructiveActions: "requireApproval" },
  },
});
```

Use strict domain policy for workflows with known targets. Use approvals when the workflow can touch authentication, file upload, form submission, destructive actions, payments, purchases, legal acceptance, or other sensitive behavior.

Reference: [secrets and user input](/agent-workflows/secrets-and-user-input), [policy and proxy](/production/policy-and-proxy), [policy reference](/reference/policy-reference), [proxy reference](/reference/proxy-reference), and [environment variables](/reference/environment-variables).
