Designing a CI/CD pipeline developers will not route around
A pipeline succeeds when it is fast enough to trust and strict enough to matter. Getting that balance wrong is why teams disable checks.
Credentials in repositories remain one of the most common causes of breach, and it is one of the most preventable.
Secrets end up in repositories because it is the path of least resistance during development and nobody removes them afterwards. Git history means deleting the file later does not remove the secret.
Assume any credential that has ever been committed is compromised and rotate it, rather than assessing whether it was likely to have been found.
A secrets manager — the cloud provider's own, or a dedicated product — gives encrypted storage, access control, audit logging and rotation. Applications fetch secrets at runtime using workload identity rather than holding a static key.
Environment variables injected at deployment are acceptable for many cases and are considerably better than files in a repository, provided the deployment system itself stores them securely.
Add secret scanning to the pipeline and to pre-commit hooks so a credential is caught before it is pushed. Most platforms provide this natively at no cost.
Scan the existing history as well. Repositories that have been running for years almost always contain something, and finding it deliberately is better than finding out another way.
Exposure is common enough that the response should be rehearsed rather than improvised. Speed matters more than investigation, because the credential is already out.
The last step is what prevents recurrence. Most exposures trace to a missing scanning step or an unclear process rather than to carelessness.
They are a reasonable mechanism provided the values come from a secure store and are not printed in logs or exposed in error pages. The weakness is usually elsewhere in the chain.
Frequently enough that a leaked credential has limited useful life. Short-lived automatically issued tokens are better than any manual rotation schedule.
Never bake them in. Images get pushed to registries and shared. Inject at runtime instead.
Keep reading
A pipeline succeeds when it is fast enough to trust and strict enough to matter. Getting that balance wrong is why teams disable checks.
Four measures describe delivery performance well. They are useful for finding constraints and harmful when used to compare teams.
Progressive delivery limits how many users a bad release can reach. The mechanism matters less than having a rehearsed way back.