HackyJS CoursesMerge Gates: Hardening a GitHub Org for AI-Written Code

// module 05 · Supply chain at fleet scale

Lockfiles and install scripts

Without a lockfile, every install picks its own versions and Dependabot can't see most of what you run. This lesson commits a lockfile to every fleet repo, switches CI to `npm ci`, and turns off dependency install scripts, the most common way malicious npm packages run code. We test what npm 11, npm 12 and pnpm 12 actually do with install scripts, release-age limits and git dependencies, and add a gate check that fails a PR when dependencies change without the lockfile, or when the lockfile pulls code from outside the registry.

  • Lesson 16 of 34

Learning Objectives

  • Commit lockfiles across the fleet by PR and install from them with `npm ci`
  • Block dependency install scripts with `ignore-scripts`, `allowScripts` (npm) and `allowBuilds` (pnpm), and know which npm version does what by default
  • Use `min-release-age` and `minimumReleaseAge` to keep brand-new versions out at resolve time
  • Release a gate version that fails PRs whose lockfile is missing, stale or pointing outside the registry

This lesson is for enrolled learners

Log in, then enroll to read the full lesson, run its lab and take the quiz.