# Secrets Management

> Keeping passwords and keys out of your code, in a safe place apps read from.

**Field:** Software Development  
**Category:** Security  
**Also known as:** Secret Management, Secrets Manager, Vault, Secrets

## Think of it like

Think of it like a safe for your keys. You do not leave them taped to the front door.

## Definition

Secrets management keeps passwords and keys out of your code. A secret in a code file ends up in every copy of the repo, forever. Instead, apps read secrets from settings or a vault when they start. A vault also logs who read each secret. It makes them easy to change, too. Changing secrets on a schedule is called rotation.

## Example

Lucy moves her database password out of config.js and into a vault. Her app reads it when it starts. The repo no longer holds it.

## Example code

```console
$ export DATABASE_PASSWORD='s3cret'
$ node app.js
```

The app reads the password from a setting, not from a file in the repo.

## Why it matters

Leaked secrets are one of the commonest causes of breaches. Code gets shared; secrets must not travel with it.

## Common mistake

Deleting a leaked key from the latest commit and stopping there. It is still in Git history; revoke it and make a new one.

## Three principles

- **Never in code.** Not even once.
- **Read at start-up.** From the environment or a vault.
- **Rotate.** Change them on a schedule.

## Related terms

- [API Key](https://learn.benibix.com/term/development/api-key)
- [Environment Variable](https://learn.benibix.com/term/infrastructure/environment-variable)
- [Principle of Least Privilege](https://learn.benibix.com/term/development/principle-of-least-privilege)
- [Encryption](https://learn.benibix.com/term/development/encryption)
- [Secret Scanning](https://learn.benibix.com/term/development/secret-scanning)

---

Source: https://learn.benibix.com/term/development/secrets-management
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
