Subscribe to the Non-Human & AI Identity Journal
Home FAQ Governance, Ownership & Risk What do teams get wrong about secrets management…
Governance, Ownership & Risk

What do teams get wrong about secrets management in pipelines and scripts?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated June 11, 2026 Domain: Governance, Ownership & Risk

They often treat the vault as the finish line. In practice, a secret can be copied into code, tickets, chat tools, and automation jobs, which means governance must include discovery, removal, and proof of cleanup. Rotation alone does not fix duplicate exposure.

Why This Matters for Security Teams

Secrets in pipelines and scripts are not just a storage problem. They are a propagation problem. Once a token, API key, or certificate lands in CI logs, build artifacts, shell history, chat threads, or copied helper scripts, the vault no longer represents the full control plane. That is why teams that focus only on issuance and rotation miss the actual exposure surface.

The operational risk is amplified by automation. Pipelines rerun, scripts get forked, and service accounts often outlive the job that needed them. NHIMG’s Guide to the Secret Sprawl Challenge frames this as a lifecycle failure, not a point-in-time leak. External guidance from the NIST Cybersecurity Framework 2.0 also supports treating credential exposure as an ongoing detect, respond, and recover issue rather than a one-time vaulting exercise.

NHIMG research in The State of Secrets in AppSec found that the average estimated time to remediate a leaked secret is 27 days, despite 75% of organisations expressing strong confidence in their secrets management capabilities. In practice, many security teams discover the real problem only after a secret has already been copied into places they do not monitor, rather than through intentional cleanup controls.

How It Works in Practice

Effective secrets management for pipelines and scripts starts with reducing the number of places a secret can exist. That means short-lived credentials, workload-scoped access, and removing hardcoded values from scripts entirely. The relevant control plane is the pipeline runtime, not just the secrets vault. If a job needs access, it should receive a narrowly scoped credential just in time, use it for one task, and lose it automatically when the task ends.

Teams usually need a layered approach:

  • issue ephemeral credentials per job or per deployment stage rather than reusing long-lived shared secrets;
  • scan source control, CI configuration, logs, and artefact stores for copied secrets;
  • block secret printing in build output and redact sensitive variables at the runner level;
  • prove cleanup by checking that the secret no longer exists in downstream copies after rotation;
  • bind access to workload identity so the job proves what it is, not just what it knows.

That last point matters because static credentials are easy to transplant. Guidance in the OWASP Non-Human Identity Top 10 and NHIMG’s Ultimate Guide to NHIs — Static vs Dynamic Secrets both point toward dynamic issuance and lifecycle controls, because scripts frequently outlive their original trust assumptions. In a mature setup, the pipeline does not embed secrets at all; it exchanges workload identity for a short-lived token at runtime and logs only non-sensitive audit metadata.

This works best when teams couple secret scanning with automated revocation and downstream search-and-destroy actions. These controls tend to break down in heavily customised CI runners and long-lived legacy automation because copied secrets persist outside the central secrets platform.

Common Variations and Edge Cases

Tighter secret controls often increase delivery friction, requiring organisations to balance developer speed against exposure reduction. That tradeoff becomes visible in repositories with many scripts, ad hoc release jobs, or external integrations that still expect static credentials.

There is no universal standard for every pipeline pattern yet, but current guidance suggests treating exceptions as temporary and documented. Build systems that cannot support ephemeral credentials should be prioritised for remediation, not left as permanent carve-outs. Secretless patterns, brokered access, and workload-bound tokens are usually better than widening the blast radius of a shared secret.

Two edge cases deserve attention. First, a secret that has been rotated can still remain dangerous if it was copied into issue trackers, cached logs, or copied shell history. Second, ephemeral credentials still fail if the script itself is broadly trusted and can exfiltrate the token during execution. That is why discovery, containment, and proof of deletion matter as much as issuance. NHIMG’s Top 10 NHI Issues and the CI/CD pipeline exploitation case study both show how quickly an automation trust gap becomes a broader identity problem.

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 CSA MAESTRO address the attack and risk surface, while NIST CSF 2.0 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP Non-Human Identity Top 10NHI-03Covers secret sprawl and weak lifecycle handling in non-human identities.
NIST CSF 2.0PR.AA-01Identity and access governance applies to pipeline credentials and scripts.
CSA MAESTROApplies lifecycle and workload identity controls to automated delivery systems.

Bind jobs to workload identity and issue short-lived credentials only for active tasks.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on June 11, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org