Quick reference
- Short-lived tokens from a broker, never a static key in a repo.
- One identity per job, scoped to the action it performs.
- The secret never reaches argv, a log line or an error trace.
- Rotate on a schedule, and rehearse the rotation.
- Revoke first, then investigate: quiet is not safe.
Explained
Short-lived. Ask a broker for a token at run time: cloud workload identity, Vault, or an OIDC exchange from the pipeline. A static key in a repository is a key you cannot rotate without a deploy.
One identity per job. A deploy job does not need every bucket, and a reporting job does not need production write access. Scope the role to the action, then name the action in the role description.
Out of sight. A secret passed as an argument is in the process list and the shell history. Read it from a file descriptor or the environment, and keep the error path from printing it.
Rotate and rehearse. A rotation you have never performed is a theory. Run it in staging, including the client that caches the old value.
Revoke first. When a token leaks, revoke before you investigate, because the investigation is slower than the attacker.
The honest caveat: short-lived is not the same as safe. A one-hour token logged at debug level is still a leak, and still valid for the rest of the hour.
The lesson: the best credential is the one the job never stores.
Your turn: Which of the five would your pipeline fail today?
Related on this site
More notes: Automation & tooling
- P1061Release automation commands
- P1059Observability as code
- P1058Scaffolding a new service from a template
- P1057Four numbers for automation
- P1056Idempotent scripts and safe re-runs
- P1055Cron to systemd timer: the migration path
- P1054Five signs your automation is fragile
- P1053Designing a CLI people keep using
Open in the notes app: search, filters, copy This note on GitHub