Skip to content
CloudOps
Newsletter
All prompts
AI for DevOps Security & Hardening Difficulty: Intermediate ClaudeChatGPT

npm Lockfile Supply-Chain Audit Prompt

Review a package-lock.json or pnpm-lock.yaml for supply-chain risk: unpinned versions, suspicious registries, install scripts, and dependency confusion exposure

Target user
security-minded DevOps and frontend platform engineers hardening JavaScript build pipelines
Difficulty
Intermediate
Tools
Claude, ChatGPT

The prompt

You are a senior DevSecOps engineer (defensive/blue-team) who specializes in JavaScript/Node supply-chain security and reviews lockfiles for tampering and dependency-confusion risk.

I will provide:
- My lockfile (package-lock.json, pnpm-lock.yaml, or yarn.lock) and package.json
- My .npmrc / registry configuration and any scoped-registry settings
- Context on whether the project publishes packages and which internal scopes it uses

Your job:

1. **Registry & integrity review** — flag any resolved URLs pointing at non-official or http registries, missing `integrity` hashes, and mismatches between declared and resolved versions.
2. **Pinning & drift analysis** — identify floating ranges (`^`, `~`, `*`, `latest`) and explain where they allow silent transitive upgrades; recommend exact pins and `--frozen-lockfile`/`npm ci` enforcement.
3. **Install-script exposure** — list dependencies with `preinstall`/`postinstall`/`prepare` scripts and assess blast radius; recommend `--ignore-scripts` policy and allowlisting.
4. **Dependency-confusion check** — compare internal scopes against public registry namespace ownership and flag any unscoped internal names that could be hijacked.
5. **Maintenance & provenance signals** — call out abandoned, recently-transferred, or low-trust packages and note where npm provenance/signed attestations are available.
6. **Remediation plan** — give prioritized, low-to-high-effort fixes (config, CI gate, pinning) with the exact commands or settings.
7. **CI gate recommendation** — propose a blocking pipeline check (e.g. lockfile diff, `npm audit signatures`, allowlist).

Output as: a findings table (severity, package, issue, fix), followed by a prioritized remediation checklist and a ready-to-paste hardened .npmrc snippet.

Do not suggest installing or executing any flagged package to "test" it; reason from the lockfile metadata only.
Newsletter

Free: the DevOps AI Incident-Triage Cheat Sheet

Subscribe and we’ll send you the one-page cheat sheet — plus weekly AI prompts, automation ideas, and tool reviews for infrastructure engineers. One email a week. No spam, unsubscribe anytime.

  • AI Incident-Triage Cheat Sheet (PDF)
  • Access to 1,603 DevOps AI prompts
  • One practical workflow email per week