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

// module 05 · Supply chain at fleet scale

Catching invented and too-new packages before merge

AI coding assistants name packages that don't exist, and the same invented names come back again and again, so attackers can register them. This lesson adds a small checker to the central gate: for every npm package a pull request adds, it asks the registry whether the name exists, when it was created and when the chosen version was published. Names that don't exist, packages younger than 30 days and versions younger than 7 days fail the PR. We show it on three PRs and are clear about what it can't see.

  • Lesson 17 of 34

Learning Objectives

  • Explain package hallucination and why repeated invented names are an attack surface
  • Find every package a PR adds, from `package.json` and from the lockfile
  • Query the npm registry for existence, creation date and version date, and fail closed on errors
  • Release the check as a new gate version with a self-test, and roll it out
  • Say which supply chain attacks this check misses and which earlier controls cover them

This lesson is for enrolled learners

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