# Why you never need to paste a secret key into an AI coding agent

> Pasted secrets live on in chat transcripts and model-provider logs — real research this year found thousands of secrets tied to AI coding agent settings on public GitHub. Three real ways an agent gets access without ever seeing a secret key.

Source: https://scribase.com/never-give-ai-agent-api-keys

Paste a database password or a secret key into Claude Code, Codex or Cursor and it lives on in three places you do not control: the chat transcript, the model provider's logs, and whatever the agent writes next. Real research this year found this is not a hypothetical — thousands of real secrets tied to AI coding agent settings have turned up in public GitHub repositories.

## This already happens at scale

Security research this year (Apiiro, via GitHub) found thousands of exposed secrets in public files tied to AI coding agent settings — passwords, API tokens, SSH logins and cloud keys stored after a developer approved a command once and clicked "do not ask again." A pasted secret does not need an attacker to leak: it is already written down in a transcript, a log, or a committed settings file.

## Sources

- [Cybernews: thousands of secrets slipping into GitHub through AI coding agents](https://cybernews.com/security/ai-agents-leaking-secrets-on-github/)

## Three ways an agent gets access, none of them a secret key

- scribase login: the agent runs one command, shows you a link and a short code, you approve it in the browser, and it receives its own scoped, expiring token stored in the OS keychain — the command never prints the token.
- MCP with OAuth: add the hosted MCP server with no header; your editor opens a consent screen the first time it connects and you choose the access there.
- A temporary project: npx scribase init --temp --yes --json gives the agent a 72-hour project and a token scoped to only that project — no account, nothing to paste at all.

## Sources

- [Scribase docs: Why you never need to paste a secret key](https://docs.scribase.com/docs/agents/no-secret-keys)
- [Scribase docs: Temporary databases](https://docs.scribase.com/docs/agents/temporary-databases)

## When pasting one is genuinely the simplest option

Sometimes an agent runs headless with no browser. For that case, Account > Access tokens has Copy for your AI agent: an 8-hour token scoped to one project, without secret keys, that reads its own scope back to the agent (scb_agt_1p-rw-sqlw-mig-fn-x2609260412_...), so what is pasted is designed to be shared and expires on its own.

_What "Copy for your AI agent" actually copies_

```text
Scribase agent token (scoped to project web, read/write, expires in 8h,
revocable at console.scribase.com/account/tokens). Designed to be shared
with coding agents: scb_agt_1p-rw-sqlw-mig-fn-x2609260412_3f9a...
```

## Sources

- [Scribase docs: Why you never need to paste a secret key](https://docs.scribase.com/docs/agents/no-secret-keys)

## FAQ

**Is pasting a secret key into Claude Code or Cursor actually risky, or just bad practice?**

It is a real, measured risk, not just a style complaint: research this year found thousands of exposed secrets in public GitHub repositories tied specifically to AI coding agent settings, from developers who had pasted credentials and approved the command once.

**How does an agent sign in to Scribase without ever seeing a secret key?**

Three ways: scribase login (the agent gets a link and code, you approve in the browser, it receives its own token stored in the OS keychain), MCP with OAuth (the editor opens a consent screen), or a temporary project with no account at all. None of these puts a secret key in the agent's context.

**What if the agent has no browser at all, like a CI job or a headless host?**

Use "Copy for your AI agent" under Account > Access tokens: an 8-hour token scoped to one project, without secret keys, that describes its own scope so both you and the agent can read what it can do. It is designed to be pasted; a service_role-equivalent secret key is not.

**Does a pasted agent token expire, or does it live forever like a typical API key?**

By default an agent token expires in 8 hours (configurable from 30 minutes to never), is revocable immediately from the tokens page, and every request it makes is logged — so even a token that does leak has a short, auditable window.

## Related

- [Why you never need to paste a secret key, full docs](https://docs.scribase.com/docs/agents/no-secret-keys)
- [AI agent database permissions](https://scribase.com/ai-agent-database-permissions)
- [Temporary database for AI agents, no signup](https://scribase.com/temporary-database-for-ai-agents)
- [Approve an AI agent database change](https://scribase.com/approve-ai-agent-database-changes)