Glossary/Mistakes & leaks

Principle of least privilege

The principle of least privilege means giving any credential, whether a key, a token, or an account, only the specific access it needs to do its job, and nothing beyond that. It is one of the oldest ideas in security, and one of the most consistently useful.

Why it matters

In practice, this means preferring a scoped key over a full-access one, a read-only token over a read-write one, and a project-specific credential over an account-wide one, every time the option exists.

Is least privilege only relevant for large teams?

No, it applies just as much to a solo developer with a handful of API keys, since a leak's impact depends on scope, not team size.

What is the cost of following least privilege?

Mostly a little extra setup, creating a scoped key instead of reusing an existing broad one, which is a small trade for limiting what a leak can do.

Related

Looking for a different way to manage your keys? See the best Claude Code API key manager alternatives, or browse every term in the glossary.