Companion Notes: Typosquatting and Your Package Name

These notes are structured like the chapter list of a short talk-through video, but they stand on their own as text and nothing needs to be played. They cover typosquatting from two angles: making sure your new name is not dangerously close to someone else's, and reducing the chance that someone squats on yours.

Part 1: What typosquatting looks like

A typosquat is a package published under a name that a hurried developer might type by mistake, or confuse with a popular one. The patterns are predictable:

The payload is usually an install script or import-time code that harvests environment variables, credentials or tokens. Security teams across the major registries regularly report and remove such packages, which is why this is worth thinking about even for small projects.

Part 2: Checking a name before you claim it

When you choose a name, you want it to be clearly yours and not accidentally one keystroke from an established package. A quick routine:

  1. Search the registry for the name and for its separator variants. On PyPI, normalisation means hyphens, underscores and dots are already treated as the same, but similar-looking names may still exist.
  2. Try common misspellings of your own name and of any popular package it resembles.
  3. If your name differs from a popular package by only one or two characters, choose another. Even an honest project in that position will attract suspicion and misdirected installs.

npm also refuses some new names that are too similar to existing ones, for example differing only in punctuation, so a name that seems free may still be rejected.

Part 3: Defending your own users

Once you have users, you are a potential target. A few low-cost measures help:

Part 4: If you find a lookalike

Do not install it to investigate on a machine with real credentials. Report it through the registry's official abuse or security reporting channel, which npm, PyPI and crates.io all provide, and include the package name and why you believe it is impersonating yours. Then add a short note to your README stating the one correct package name.

Recap

Choose a name with breathing room, check its variants, put your packages under a visible owner, and report lookalikes rather than arguing with them. Most of the defence is simply making the right name easy to find and type.

Related pages