They should do both, but secret rotation comes first when install-time execution has already occurred. Provenance controls reduce future exposure, while rotated and revoked secrets cut off the attacker’s immediate ability to persist, republish, or move laterally through CI/CD and GitHub. Recovery is slow if credential reuse remains intact.
Why the answer changes once execution has already happened
After a registry compromise, the decision is not between “trust the package” and “rotate the secret” as independent controls. If install-time execution has already occurred, the attacker may already have copied tokens, API keys, signing material, or CI/CD credentials. In that state, provenance work still matters, but it is slower-moving defensive work than cutting off the attacker’s current access path.
The practical distinction is between future exposure and immediate containment. Provenance controls help you decide what was legitimate, what should be rebuilt, and how to harden future ingestion. Secret rotation and revocation remove the attacker’s ability to reuse what they already captured, which is why credential hygiene becomes the first recovery move when compromise may have reached runtime or build-time execution.
This is why package provenance and secret rotation are complementary but not interchangeable. A clean provenance story does not neutralise an already-exposed token, and a rotated token does not prove the package was safe. Teams need both, but the order should reflect whether the compromise was read-only exposure or active execution.
What provenance can and cannot do during recovery
Package provenance is most valuable for narrowing trust. It helps teams answer whether the artifact came from the expected source, whether a publish path was altered, and whether downstream consumers should treat the package as suspect. That makes it essential for rebuild decisions, package replacement, and post-incident validation of dependency integrity.
What it does not do is stop an attacker who already obtained usable secrets during the compromise. If the compromise included install-time code execution, the attacker may have gained immediate persistence through CI/CD variables, GitHub access, signing keys, or other credentials embedded in the environment. In that case, provenance is part of the clean-up and prevention phase, not the first containment step.
For package-focused follow-up, the best next question is whether the malicious artifact was merely downloaded or actually executed. The answer determines whether the team needs only dependency replacement and rebuilds, or a broader identity and secrets response as well.
Why secret rotation comes first when execution happened
When an attacker has executed code during install, the fastest path to limiting damage is to revoke and rotate anything the code could have reached. That includes registry tokens, CI/CD secrets, deployment credentials, OAuth tokens, signing keys, and any other reusable material that could support persistence or lateral movement.
Rotation is first because it shrinks blast radius immediately. It cuts off reuse across build systems, source control, and release tooling, and it forces the attacker back out of trusted paths even before the provenance investigation is complete. If teams delay rotation while they “finish understanding the package,” they often preserve the attacker’s best foothold.
Provenance work still follows quickly, because the team needs to know how the compromise entered the pipeline and whether the artifact should be rebuilt from a trusted source. But recovery is materially slower if the compromised secret remains valid anywhere in the toolchain.
Risk and Threat Considerations
The main risk is not the registry event by itself, but the combination of trusted package execution and long-lived credentials. A compromised package can turn a software supply-chain event into an identity compromise event, especially when build systems reuse secrets across environments or allow broad token scope.
Failure mechanism: Malicious package code runs during install, reads secrets from the local environment or CI context, and uses those credentials to persist, republish, or move laterally before the provenance review is complete.
Impact: Attackers can retain access after the package is removed, because the real persistence point is the stolen secret rather than the package itself. That can extend compromise across CI/CD, source control, registries, and downstream deployment paths.
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 addresses the attack and risk surface, while SLSA 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 | Compromised packages can expose reusable credentials and tokens. |
| NHI-07 — Long-Lived Secrets | Recovery is slower when credentials remain valid after compromise. | |
| Recommendation — Rotate exposed secrets immediately and revoke any tokens the package could have reached. Replace long-lived secrets with shorter-lived credentials and force rapid expiry. | ||
| SLSA | Supply-chain Levels for Software Artifacts | Provenance is central to deciding whether a compromised package can be trusted again. |
| Recommendation — Rebuild from trusted provenance and strengthen artifact integrity checks before republishing. | ||
| NIST SP 800-53 Rev 5 | IA-5 — Authenticator Management | Secret rotation and revocation are authenticator lifecycle actions after compromise. |
| SA-12 — Supply Chain Protection | Registry compromise is a software supply-chain event requiring provenance controls. | |
| Recommendation — Rotate, revoke, and reissue authenticators that may have been exposed. Apply supply-chain protections to verify source integrity and rebuild trust in acquired software. | ||
Practitioner Guidance
What to prioritise: If there is any credible chance of install-time execution, treat secret rotation and token revocation as the first containment action, then rebuild trust with provenance checks. If the package was only downloaded or inspected, provenance analysis can move ahead of broader credential changes.
What to verify: Confirm which secrets the package could access in the exact execution context, including inherited environment variables, mounted credentials, cached tokens, and any automation identities available to the build runner or developer workstation.
Common mistake: Teams often replace the package and call the incident handled while leaving CI/CD, GitHub, or registry credentials untouched. That preserves the attacker’s easiest reuse path and turns a supply-chain event into a recurring account-compromise problem.
Practitioner takeaway: Provenance answers whether the software is trustworthy enough to keep; secret rotation answers whether the attacker still has a live path to operate. When execution has already occurred, cut off access first, then finish the provenance work.
Related resources from NHI Mgmt Group
- Should organisations prioritise secret rotation or dependency review after a package compromise?
- Should teams prioritise secret discovery or rotation first after exposure?
- What should teams do in the first 24 to 72 hours after suspected package compromise?
- Which controls should teams prioritise after a package supply chain compromise?
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 October 12, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org