Join our Newsletter — 33% off our NHI Course

What breaks when package publishing depends on long-lived credentials?

Long-lived publishing credentials turn a release pipeline into standing privilege. If an attacker steals the token once, they can publish malicious versions until someone notices and revokes it. That breaks the assumption that source control compromise is contained to code changes, because the attack can jump directly into software distribution. The safer model is short-lived, identity-bound publishing with explicit approval for release actions.

Why This Matters for Security Teams

Package publishing is not just another CI/CD action. It is the point where trusted source code becomes trusted software consumed downstream, so a stolen publishing credential can move an attacker from repository access into the supply chain itself. NHI Management Group’s Guide to the Secret Sprawl Challenge shows how quickly secrets escape their intended boundary once they are embedded in workflows, logs, or automation. That risk is amplified when the same credential can be reused across releases.

Current guidance from OWASP Non-Human Identity Top 10 and NIST SP 800-53 Rev 5 Security and Privacy Controls points toward short-lived, identity-bound access because standing secrets are difficult to contain once exposed. That matters even more for package publishing, where a single token can be enough to inject malicious artifacts into trusted registries. In practice, many security teams discover the blast radius only after a compromised release credential has already been used to ship a bad package, rather than through intentional review of release trust boundaries.

How It Works in Practice

The safer model treats publishing as a privileged, just-in-time operation rather than a permanent entitlement. Instead of storing a long-lived token in a build system, the pipeline authenticates the workload, receives a short-lived credential, and uses that credential only for a narrowly scoped publish step. That is the same basic pattern described in NHIMG’s Ultimate Guide to NHIs — Static vs Dynamic Secrets: credentials should be dynamic, bounded by time, and tied to the workload that is requesting them.

Operationally, the release path should separate build, test, approval, and publish actions. The build job should not automatically inherit publish rights. Instead, the pipeline should request an ephemeral token only after policy checks pass, then revoke it immediately after the artifact is signed and published. This reduces the value of any single compromise and makes replay attacks harder. Where supported, workload identity is preferable to shared secrets because it proves what the automation is, not just what password it knows. Standards such as NIST SP 800-63 Digital Identity Guidelines help frame authentication assurance, while Shai Hulud npm malware campaign illustrates how stolen automation secrets can be turned into software distribution abuse.

  • Issue credentials per release task, not per team or repository.
  • Bind publish rights to workload identity and environment context.
  • Require explicit approval for release actions that affect public distribution.
  • Revoke tokens immediately after publication and signing.
  • Log the identity, commit, build, and approver for every publish event.

These controls tend to break down in self-hosted runners, cached secret stores, and multi-tenant build farms because the publish identity can persist beyond the job that was supposed to own it.

Common Variations and Edge Cases

Tighter release controls often increase pipeline friction, so organisations have to balance delivery speed against the cost of stronger identity checks. That tradeoff is real, especially when teams publish many times per day or support multiple package ecosystems with different auth mechanisms. Best practice is evolving, and there is no universal standard for every registry yet, which is why many programmes still combine workload identity, short TTL secrets, and human approval for high-impact releases.

One common edge case is internal package publishing. Teams sometimes assume internal registries are safer and therefore leave long-lived credentials in place, but internal-only access can still become lateral movement if a developer workstation or runner is compromised. Another case is automated versioning systems that need to publish after every merge. Those systems should not be given broad registry privileges; they should receive scoped, ephemeral access only to the target namespace. NHI Management Group’s Guide to the Secret Sprawl Challenge and CI/CD pipeline exploitation case study are both useful reminders that the weakest point is often not the registry itself, but the automation surrounding it.

The practical rule is simple: if a credential can publish software for more than a short, explicit task window, it is standing privilege. That is the condition attackers look for first.

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 CSF 2.0 set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
OWASP Non-Human Identity Top 10 NHI-03 Long-lived publish tokens are a classic secret rotation and exposure risk.
OWASP Agentic AI Top 10 Autonomous release automation can publish without stable human oversight.
CSA MAESTRO MAESTRO addresses governance for automated actions that can affect supply chains.
NIST AI RMF GOVERN Release automation needs governance, accountability, and risk ownership.
NIST CSF 2.0 PR.AC-4 Least-privilege access is directly violated by standing publishing credentials.

Replace static publishing secrets with short-lived, scoped credentials and rotate any leftover tokens immediately.