Skip to main content
04.08.2026

Keyv NPM Compromise: SRE Response Guide

head-image

On August 4, 2026, Aikido reported an active Shai-Hulud style npm supply chain attack affecting keyv, flat-cache, file-entry-cache, cacheable, and related packages. Socket's analysis confirmed the malicious lifecycle hook pattern.

Keyv itself is a widely used key-value storage library, with its upstream project at the Keyv GitHub repository. Many teams may not import these packages directly, but still receive them through linting, cache, build, or framework tooling.

What Happened?

According to Aikido, an attacker compromised a maintainer account and cut releases for multiple npm packages. The malicious packages included a preinstall script that ran setup.mjs, downloaded Bun, and executed an obfuscated payload.

The reported payload targeted npm tokens, GitHub tokens, AWS credentials, Kubernetes service account tokens, Vault tokens, .env files, Terraform files, SSH material, and other local secrets. It could also use stolen rights to spread further.

The uncomfortable detail is provenance. The poisoned versions were reportedly published through legitimate GitHub Actions flows, so a green provenance check was not enough to prove the release was safe.

Immediate Triage

Start with dependency inventory. Search lockfiles and recent container images for affected names and versions.

rg '"(keyv|flat-cache|file-entry-cache|cacheable|cache-manager|@cacheable/)' package-lock.json pnpm-lock.yaml yarn.lock
npm ls keyv flat-cache file-entry-cache cacheable cache-manager

Then check CI runs from the exposure window. Prioritize installs, package publishing, Docker builds, release signing, deployment, and cloud authentication.

If a runner installed an affected version, assume environment secrets may be exposed.

Containment Checklist

Treat this like a build-system breach:

  • Pause high-risk publishing workflows until lockfiles are reviewed
  • Rotate npm tokens, GitHub PATs, GitHub App tokens, cloud credentials, and Vault tokens exposed to affected jobs
  • Review GitHub Actions permissions and remove broad contents: write or packages: write grants where they are not needed
  • Check repositories for unexpected commits, especially config changes under .vscode/ or .claude/
  • Rebuild release artifacts from known-good dependency locks after rotation

Do not rotate only application secrets. CI often holds the keys that publish the next artifact.

Hardening After The Fire

JavaScript supply chain defense needs layers. Pin versions and review lockfile changes, but also restrict install scripts.

For high-risk pipelines, consider npm ci --ignore-scripts where builds allow it. If scripts are required, run installs in a network-restricted environment.

Short-lived credentials also matter. Use scoped npm tokens, GitHub environments, tight OIDC subjects, and cloud roles that cannot enumerate unrelated secrets.

Finally, send CI telemetry somewhere searchable. Responders need to know which jobs installed it, which secrets were present, and which artifacts were produced afterward.

Conclusion

The Keyv npm compromise is not just a package story. It is a CI, secrets, and incident-response story. Use it to test dependency inventory, runner isolation, credential scope, and release rollback.

If your team wants AI-assisted incident workflows with strong operational context, Akmatori helps SRE teams investigate alerts, coordinate response, and automate safe infrastructure actions. Powered by Gcore for global infrastructure reliability.

Automate incident response and prevent on-call burnout with AI-driven agents!