Skip to content
LiveNext 15:18:48

Definition

What is Secrets management?

Secrets management is Secrets management is the practice of storing API keys, passwords and tokens in a protected vault, controlling who can read them and rotating them, instead of leaving them in code or plain files.

What it is

A "secret" is any value that grants access: an API key, a database password, an access token, a signing key. Secrets management is the set of habits and tools for keeping those values out of the wrong hands. The core idea is simple: secrets live in one protected place, and software fetches them when needed.

How it works

A secrets manager is a vault with rules. It encrypts what it stores, records who read what and when, and hands a secret only to an app or person with permission. Cloud providers and hosting platforms offer one, and so do standalone tools.

Good practice has a few parts:

  • Keep secrets out of code. A key committed to a repository, pasted into a chat or left in a shared document is effectively public once anyone copies it.
  • Give each key the least power it needs. One key per project, limited to the actions that project uses.
  • Set limits. A monthly spend cap or usage alert on an AI key turns a theft into a small bill instead of a large one.
  • Rotate. Replace keys on a schedule and immediately after any suspected exposure, so an old stolen copy stops working.
  • Log and alert. Watch for usage you did not cause.

Why it matters to you

AI keys are unusually valuable to thieves. A stolen key for a model provider spends real money on someone else's account, and the stolen access can be resold, a crime known as LLMjacking. A leaked database password is bad. A leaked AI key can also be a running meter.

AI agents raise the stakes. An agent that can call tools needs credentials, and if it is tricked by prompt injection it may expose them. Running agents in an agent sandbox and handing them short-lived, narrow credentials limits the damage.

An example

Instead of writing a key into a source file, a developer stores it in the host's secrets manager and reads it from the environment when the app starts. The key has a spend cap and works for one project. If it ever leaks, the owner revokes it, creates a new one in a minute, and the stolen copy is dead.

What to keep in mind

Environment variables on a hosting platform are convenient, but they are only as safe as that platform. Treat them as a place that can be breached, and cap and scope every key accordingly. Never paste a real key into an AI chat to ask for help.

Questions people ask

Where should I store my AI API keys?

In a secrets manager or your host's encrypted secret store, never in source code, chats or shared documents, with a spend cap and one project per key.

How often should API keys be rotated?

On a regular schedule, and immediately if you suspect exposure. Rotation makes any stolen copy useless.

Secrets management in the news