CICD-SEC-6 Insufficient Credential Hygiene is an entry in the OWASP Top 10 CI/CD Security Risks covering weak handling of secrets in pipelines, such as credentials in source code, configuration or build logs, excessive permissions and no rotation. Attackers who find one gain access to repositories, registries or cloud. Defenders scan for secrets, use short-lived credentials and scope them narrowly.
What credential hygiene means in CI/CD
Credential hygiene is the discipline of keeping pipeline secrets hard to discover, hard to reuse and easy to revoke. In CI/CD, that means credentials should not appear in source code, build output, logs, images or shared configuration, and they should be treated as short-lived access material rather than durable pipeline fixtures.
The practical problem is that CI/CD systems concentrate trust. A single leaked token can expose repositories, artifact registries, deployment targets or cloud control planes, so the weakest secret handling step often becomes the easiest way into the whole delivery chain.
Why weak pipeline credentials are dangerous
Insufficient credential hygiene turns ordinary delivery automation into a durable access path. If a secret is embedded in a repo, echoed into logs or over-scoped for convenience, an attacker does not need to break the pipeline logic itself, they only need to recover the credential and use it elsewhere.
That is why secret exposure in CI/CD often has outsized blast radius. A token intended for one build step can become an entry point into source control, deployment infrastructure or cloud services, especially when reuse, broad permissions and slow rotation keep the credential valid long after it should have expired.
At the program level, this is exactly the kind of problem explored in Top 10 CI/CD Security Risks, where credential hygiene sits alongside other pipeline failure modes that make the delivery system itself an attack surface.
Where exposure usually enters the pipeline
The most common failure patterns are predictable: secrets committed to code, passed as plain environment values, printed by debug output, stored in build artifacts, copied into container layers or left in long-lived variables that many jobs can read. The core issue is not just storage, but uncontrolled propagation through places the operator does not continuously inspect.
Another common problem is permission drift. A pipeline credential that starts narrow may gradually gain extra rights as workflows change, while the original secret remains valid. That creates both overreach and persistence, because the credential can still be used even after the team has forgotten where it appears or who can call it.
For teams choosing defensive tooling, the CI/CD Security Tooling Buyer's Guide is useful because it ties secret scanning, workflow analysis and runner monitoring back to the specific delivery risks that make credential leakage hard to spot.
What good hygiene looks like in practice
Good credential hygiene in CI/CD is built around reduction, scoping and rotation. The strongest pattern is to replace durable shared secrets with short-lived credentials, federation or tightly scoped tokens wherever the platform supports it, then remove direct secret handling from code and logs as much as possible.
Equally important is lifecycle control. Secrets should be inventoried, rotated on a schedule and revoked quickly when they are exposed or no longer needed. Scanning helps, but scanning alone is not hygiene, it is detection after the fact. Prevention comes from limiting where secrets exist and how long they stay usable.
That operating model is described well in Secrets Management Guide, which connects centralisation, dynamic secrets and secretless access to the reduction of long-lived pipeline credentials.
For a more direct implementation lens, API Key Management Guide reinforces the same lifecycle pattern for bearer credentials: create, scope, rotate and revoke rather than letting keys accumulate as permanent access.
Detection and post-exposure review
When credential hygiene fails, the next question is not only whether the secret was exposed, but where it may have been copied and what it could reach. Review should cover source history, logs, artifacts, images, runner output and downstream systems that accepted the credential, because compromise often persists beyond the first leak point.
Post-exposure handling also depends on whether the secret was used to mint sessions, access cloud resources or trigger deployments. In those cases, simply changing the original value may not be enough, because any issued access, cached session or derivative credential may also need to be invalidated or rotated.
Secrets Scanning vs Secrets Management is a useful companion here because it separates detection from prevention and helps teams decide what to measure after a leak has been found.
Risk and Threat Considerations
Weak credential hygiene is dangerous because CI/CD systems often hold credentials that can move an attacker from a single pipeline into source repositories, registries or cloud infrastructure. Once exposed, a token may remain usable long enough to support theft, tampering or persistence unless it is found and revoked quickly.
Failure mechanism: Credentials are stored or echoed where they can be harvested, then reused because they are long-lived, over-scoped or difficult to inventory across jobs, logs and artifacts.
Impact: A leak can lead to repository access, deployment abuse, supply-chain compromise or cloud compromise, with the breach radius expanding well beyond the original build step.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10 and OWASP API Security Top 10 address the attack and risk surface, while CIS Controls v8 and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-02 — Secret Leakage | CI/CD secret leakage is a direct credential-hygiene failure mode. |
| Recommendation — Scan pipelines for exposed secrets and remove credentials from code, logs and images. | ||
| CIS Controls v8 | CIS-5 — Account Management | Credential hygiene depends on controlling lifecycle, scope and revocation of access material. |
| Recommendation — Reduce standing access and revoke unused pipeline credentials promptly. | ||
| NIST SP 800-53 Rev 5 | IA-5 — Authenticator Management | Pipeline secrets are authenticators whose lifecycle must be managed and rotated. |
| AC-6 — Least Privilege | Over-scoped CI/CD credentials are the core privilege problem in this term. | |
| Recommendation — Rotate and invalidate pipeline authenticators on a defined lifecycle. Restrict each CI/CD credential to the minimum permissions it needs. | ||
| OWASP API Security Top 10 | API2 — Broken Authentication | Leaked API or bearer credentials in pipelines create authentication abuse paths. |
| Recommendation — Harden authentication handling for any API credentials used in delivery automation. | ||
Practitioner Guidance
Why practitioners should care: Treat credential hygiene as a delivery-system control, not a secrets-only issue. The practical goal is to make credentials hard to expose, easy to replace and narrowly useful if they are stolen.
Common misunderstanding: Secret scanning alone does not solve this risk. It helps you find leaks, but it does not prevent overprivileged or long-lived credentials from being created in the first place.
Practitioner takeaway: Design CI/CD access so that the default state is short-lived, narrowly scoped and rapidly revocable, then use scanning and review to catch what prevention misses.
Related resources from NHI Mgmt Group
- What breaks when credential hygiene is weak in enterprise environments?
- Who is accountable when weak credential hygiene leads to a major outage?
- Why do AI agents create new authorization risk even when credential hygiene is strong?
- How do security teams know whether credential hygiene is actually reducing breach risk?
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 26, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org