Subscribe to the Non-Human & AI Identity Journal

What should teams do after a malicious repository or package is discovered?

Contain the repository, revoke any credentials that could have been exposed, and rotate secrets used by the affected developer and CI paths. Then inspect adjacent repositories for reused tokens, copied package names, and shared maintainer identities. The goal is to cut off both the delivery path and any persisted non-human access.

Why This Matters for Security Teams

A malicious repository or package is not just a software supply chain problem. It is often a credential exposure event, a trust collapse, and a persistence opportunity for non-human identities already used in development and CI/CD. The immediate risk is not limited to the compromised artifact itself. Reused tokens, cached secrets, maintainer accounts, and automation paths can remain valid after the package is removed.

NHIMG research shows 91.6% of secrets remain valid five days after the targeted organisation is notified, which is why containment must move faster than normal ticket-driven remediation. The same pattern appears in incidents such as the GitHub Action tj-actions Supply Chain Attack, where CI exposure expanded well beyond the original compromise. Security teams should treat the discovery as an identity incident, not only a package hygiene issue, and align the response to controls such as NIST SP 800-53 Rev 5 Security and Privacy Controls.

In practice, many security teams encounter the real blast radius only after a downstream build or deployment path has already reused the exposed secret.

How It Works in Practice

The response should start by isolating the malicious repository or package and then tracing every non-human identity that touched it. That includes build agents, release pipelines, package maintainers, automation bots, signing services, and any service accounts that pulled from the compromised source. If a token, API key, certificate, or credential could have been exposed, revoke it immediately and replace it with fresh, short-lived access tied to the affected workflow.

A practical workflow usually looks like this:

  • Freeze distribution, mirrors, and automated dependency updates for the affected artifact.
  • Identify every developer, CI job, and deployment path that authenticated to the repository or registry.
  • Rotate secrets used in those paths, including secrets stored in environment variables, vaults, and pipeline variables.
  • Search for adjacent abuse by scanning sibling repositories, shared runners, forked code, and copied package names.
  • Validate maintainer identities and review whether any over-privileged service accounts can still publish or sign artifacts.

That response is consistent with NHIMG guidance in the NHI Lifecycle Management Guide and the Ultimate Guide to NHIs, both of which stress lifecycle control, offboarding, and visibility. For teams building a formal response process, the identity and access review should map to NIST SP 800-53 Rev 5 access and credential-management controls so revocation is auditable, not ad hoc.

Where possible, replace long-lived credentials with ephemeral, per-task access and log every token issuance, package pull, and signing event so you can confirm the compromise window. These controls tend to break down when organisations rely on shared CI runners and legacy publishing scripts because the same secret is reused across many repos and is difficult to enumerate quickly.

Common Variations and Edge Cases

Tighter containment often increases delivery friction, requiring organisations to balance rapid revocation against build stability and release pressure. That tradeoff is real, especially when the malicious package sits inside a critical dependency chain or when multiple teams share the same automation identity.

Best practice is evolving on how far to extend the blast-radius search, but current guidance suggests moving beyond the obvious repository and checking for copied package names, forked maintainers, mirrored registries, and hidden reuse of the same token family. Incidents like the LiteLLM PyPI package breach and Millions of Misconfigured Git Servers Leaking Secrets show why package compromise often coexists with broader secret exposure in code and CI.

In mature environments, the harder question is not whether to rotate secrets, but whether the organisation can prove which identities were exposed and whether any were provisioned outside standard workflows. Where package signing, artifact promotion, and CI access are split across multiple platforms, response teams may need to coordinate with platform owners to revoke keys, reissue certificates, and rebaseline trust across several registries at once. There is no universal standard for this yet, so the safest approach is to assume every shared automation identity is contaminated until proven otherwise.

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 Covers secret rotation and revocation after NHI exposure.
OWASP Agentic AI Top 10 A1 Agentic and automated build paths can persist access after compromise.
CSA MAESTRO M4 Addresses identity and privilege control for autonomous workflows.
NIST AI RMF Supports governance, mapping, and monitoring of AI-adjacent automated identities.
NIST CSF 2.0 PR.AC-4 Access control and revocation are central after package compromise.

Inventory automated identities and stop any workflow that can still act on exposed trust.