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

rules.mdreferences/

Typosquat rules

Reference for scripts/typosquat_detector.py. Behaviour is the same as the typosquat_detector Python package.

Name validation

  • Length at most 214 characters, otherwise input_too_large.
  • PyPI: the name must match the PEP 508 name pattern (letters, digits, ., _, -; starts and ends with a letter or digit), case-insensitive.
  • npm: after lowercasing, an optional @scope/ plus a name made of lowercase letters, digits and -, ., _, ~.
  • Anything else raises invalid_name; an unknown ecosystem raises invalid_ecosystem.

Normalisation

  • PyPI: lowercase, and every run of -, _, . becomes one -.
  • npm: lowercase only.

Rules (applied to the normalised candidate and target)

  1. homoglyph: lowercase both, replace rn with m and vv with w, then 0 1 3 5 with o l e s; equal results match.
  2. separator: remove -, _, . and spaces; equal results match.
  3. affix: the candidate equals the target with one of these added.
    • PyPI prefixes: python-, py-, py. Suffixes: -python, -py, py, -dev, -lib.
    • npm prefixes: node-, js-. Suffixes: -js, .js, js, -node.
  4. distance: optimal string alignment distance of exactly 1 (insertion, deletion, substitution or adjacent transposition), only when both names have at least 4 characters.

For each target the first matching rule wins. Findings are sorted by target.

Bundled popular names (dated data)

  • PyPI: requests, urllib3, numpy, pandas, boto3, botocore, setuptools, certifi, idna, charset-normalizer, python-dateutil, six, packaging, pyyaml, django, flask, cryptography, pydantic, typing-extensions, attrs.
  • npm: lodash, react, express, chalk, commander, axios, debug, typescript, webpack, moment, uuid, yargs, dotenv, vue, jquery.

Popular file (--popular FILE)

UTF-8, one name per line, blank lines ignored, at most 10,000 names and 1 MiB. The file replaces the bundled list for that run.

Reading results

Exit code 1 means at least one finding. The tool cannot tell a deliberate attack from an unrelated package that happens to be similar (for example flask and flasky); a human should check the registry page before deciding.

references

SKILL.md

tile.json