Plaintext storage breaks containment. Anyone with access to the repository, build environment, or deployment logs may inherit secret exposure, and the secret often persists long after the job ends. It also makes rotation harder, because updates must be coordinated across multiple systems. On an incident timeline, that delay can turn a local leak into an enterprise problem.
Why Plaintext Secrets Break Containment
Plaintext secrets in pipeline configs or environment files turn a narrow deployment detail into a broad access problem. Once a token, API key, or certificate is written into code, logs, or exported environment state, it can be copied by anyone who can read the repository, inspect build output, or access an ephemeral runner snapshot. The issue is not only exposure. It is persistence, because the same secret often remains valid across systems long after the initial leak.
That is why NHIMG treats hardcoded secrets as a containment failure, not just a hygiene issue. The problem shows up across code review, CI/CD, and incident response, especially when teams assume a private repo is safe. NHIMG research on Guide to the Secret Sprawl Challenge shows how quickly secrets spread once they are copied into multiple control planes. OWASP also treats exposed non-human credentials as a core identity risk in the OWASP Non-Human Identity Top 10.
In practice, many security teams discover the blast radius only after a leaked build artifact or runner log has already been harvested for later reuse.
How Secret Exposure Moves Through CI/CD and Runtime
When secrets live in plaintext pipeline configurations, they do not stay in one place. A value embedded in a YAML file can surface in Git history, environment exports, build metadata, job traces, cache layers, deployment manifests, and support tickets. If the same value is reused across environments, one disclosure becomes a credential-foraging event across development, staging, and production.
The operational failure is that access control around the repository does not equal access control around the secret. A developer, contractor, or automation account may not have production access, yet still inherit the secret through source control or build visibility. That is why current guidance favors short-lived, scoped credentials and runtime issuance over static values. The NHIMG Ultimate Guide to NHIs explains why static secrets are structurally weaker than dynamic ones in automated systems.
- Use secret managers and inject values at runtime, not in source files.
- Prefer ephemeral tokens with tight TTLs over long-lived API keys.
- Mask secrets in logs, but do not rely on masking as containment.
- Rotate immediately after exposure, then invalidate downstream sessions and caches.
For implementation, NIST guidance on digital identity and zero trust supports the same direction: rely on verified workload identity and minimize standing privilege, rather than trusting files to remain private. See the NIST Zero Trust Architecture and the NIST Digital Identity Guidelines for the policy logic behind reducing credential lifetime. These controls tend to break down when pipeline secrets are copied into build images or shared runners because the secret can outlive the job that first used it.
Common Failure Modes and What Changes in Real Environments
Tighter secret handling often increases deployment overhead, requiring organisations to balance speed of delivery against the cost of rotation, orchestration, and debugging. That tradeoff is real, especially in legacy pipelines where teams have built convenience around static environment files.
One common exception is the belief that a masked variable is safe enough. Best practice is evolving, but current guidance suggests masking only reduces casual exposure. It does not stop replay from a compromised runner, a leaked artifact, or an operator with broad log access. Another edge case is temporary infrastructure: ephemeral environments still leak if the bootstrap process writes secrets to disk or exports them into crash dumps.
NHIMG research on the CI/CD pipeline exploitation case study and the Reviewdog GitHub Action supply chain attack shows how pipeline trust can be abused once secrets are present in build context. In current practice, the most resilient response is to remove plaintext secrets entirely, scope every credential to a single workload, and treat revocation as part of the deployment path, not an afterthought. The remaining weak spot is any environment where third-party actions, shared runners, or long-lived service accounts still depend on static credentials.
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, OWASP Agentic AI Top 10 and CSA MAESTRO address the attack and risk surface, while NIST AI RMF and NIST Zero Trust (SP 800-207) set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-01 | Hardcoded plaintext secrets are a primary non-human identity exposure risk. |
| OWASP Agentic AI Top 10 | A-03 | Agentic pipelines amplify the blast radius of exposed secrets and token reuse. |
| CSA MAESTRO | MAESTRO-3 | Pipeline secrets undermine runtime trust and workload isolation in agentic systems. |
| NIST AI RMF | Secret leakage is an AI system governance and accountability risk. | |
| NIST Zero Trust (SP 800-207) | PR.AC | Zero trust requires minimizing standing access for secrets in automated pipelines. |
Eliminate embedded secrets and replace them with managed, short-lived workload credentials.
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Reviewed and updated by the NHIMG editorial team on August 24, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org