CtrlK
BlogDocsLog inGet started
Tessl Logo
PluginPublic

trysac/typosquat-detector

Flag PyPI and npm package names that imitate popular packages (homoglyphs, separator tricks, affixes, one-edit typos) and say which rule matched. Use when the user reviews new dependencies, requirements.txt or package.json entries.

Quality

95%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Low

Low-risk findings worth noting

Overview
Quality
Evals
Security
Files

SKILL.md

name:
typosquat-detector
description:
Flag PyPI and npm package names that imitate popular packages (homoglyphs, separator tricks, affixes, one-edit typos) and say which rule matched. Use when the user reviews new dependencies, requirements.txt or package.json entries.

typosquat-detector

Check candidate package names against a list of popular packages and report which rule matched which target. It runs locally with Python 3.10+ (standard library only); no package install and no network access are needed. It is defensive: use it to stop a suspicious dependency before install.

When to use

  • The user adds or reviews dependencies and wants to know if a name looks like a typo or imitation of a well-known package.
  • A pull request touches requirements.txt, pyproject.toml or package.json.
  • The user asks whether a specific package name is suspicious.

Workflow

  1. Collect the candidate names (for a dependency file, read only the package names, not versions).
  2. Run: python3 scripts/typosquat_detector.py reqeusts flask --ecosystem pypi Use --ecosystem npm for npm names (scoped names such as @scope/pkg are accepted).
  3. Each finding prints as candidate: rule -> target. Exit code 1 means findings, 0 none, 2 usage or invalid name (the reason is printed to stderr).
  4. A finding is a reason to look closer, not proof of malice: tell the user to verify the package on the registry (publisher, age, downloads, repository) before installing, and never install the flagged name just to test it.
  5. To check against the user's own popular or internal names, pass --popular names.txt (one name per line, at most 10,000 names and 1 MiB).

Rules

RuleMatches when
homoglyphequal to a target after mapping 0 1 3 5 rn vv to o l e s m w
separatorequal to a target after removing -, _, .
affixa target plus a known prefix or suffix (for example python- or -js)
distanceone edit (insert, delete, substitute, adjacent swap) from a target, both names 4+ characters

Per target the first matching rule is reported. A name equal to a target after normalisation (PEP 503 for PyPI, lowercase for npm) is the package itself and is skipped. Details are in references/rules.md.

Limits

  • Only PyPI and npm names; names over 214 characters are rejected.
  • The bundled popular list is small and dated: 20 PyPI and 15 npm names. A name that imitates a package that is not in the list is not detected; supply a larger list with --popular.
  • ASCII only: Unicode confusables, dependency confusion with private indexes and malicious code inside correctly named packages are out of scope.

Project source: https://github.com/Trysac/u256-typosquat-detector

SKILL.md

tile.json