Does your Mac clipboard history leak API keys?

Often, yes, by design: a clipboard manager records what you copy, and API keys get copied. Here is what is stored, what macOS offers to mark secrets, and how ClipVigil handles them.

Published and updated

The short answer

It can. Any clipboard manager that records everything you copy will record the API key you copy from a dashboard or a terminal, and keep it for as long as its history lasts.

Whether that is a problem depends on four things: whether the app skips items that password managers mark as sensitive, where the history is stored and whether it is encrypted, how long secrets are kept, and who or what can see the panel, for example a screen share.

What a clipboard manager stores

A typical clipboard manager keeps the content you copied (text, images, file references), the app you copied it from, a timestamp, and a search index so you can find it again. Most keep this in a database on your disk, and some add cloud sync.

Each of those is a copy of your secret that outlives the moment you pasted it. That is the whole risk, and it is a quiet one: nothing looks wrong until the history is shown on a call, read by another process, or restored from a backup.

How macOS marks sensitive items

macOS does not label secrets on its own. Instead there is a community convention, published at nspasteboard.org: an app that puts sensitive data on the pasteboard adds an extra type next to it.

Password managers are the main apps that set these types. They are a request, not an enforcement: a clipboard manager has to choose to honour them, and it should check the types before it reads the content. Newer macOS versions also ask before an app reads the pasteboard in the background (System Settings → Privacy & Security → Paste from Other Apps).

Where secrets leak from history

How ClipVigil handles secrets

Every copy passes through the same checks, in order. All of them run on your Mac.

  1. Pasteboard types first. ClipVigil reads the types before the content. Items marked concealed, transient or auto-generated are not read or recorded.
  2. Excluded apps. Copies from apps on your exclusion list, such as 1Password, Bitwarden and Keychain Access by default, are not recorded.
  3. Secret scanner. Built-in rules match AWS, GitHub, OpenAI, Anthropic, Stripe, Slack and Google keys, JWTs, private keys and database URLs with passwords. Plain UUIDs and Git SHAs are left alone.
  4. Redact, keep out of search, destroy. A hit is shown with its prefix and last four characters, never written to the search index, and destroyed after 30 seconds by default, or not recorded at all. Deleted data is overwritten.
  5. Encrypted at rest. The history database uses SQLCipher, with its key stored in your Keychain. Touch ID can lock the panel, and the panel is hidden from screen recording and sharing.

Nothing in this path touches the network: the code that captures, stores and scans the clipboard has no networking in it.

What no clipboard manager can fix

Detection is best effort. A key in a format the rules do not know, or a password you invented, looks like ordinary text and may be stored as such. And while a secret sits on the system clipboard, any app that is allowed to read the pasteboard can read it. ClipVigil protects its own history, not the system pasteboard.

A checklist for any clipboard manager

ClipVigil’s answers to that checklist are on the privacy page and in the docs.

Keep reading