Skip to content

Commit 250f2e2

Browse files
committed
feat: implement typosquatting detection for package names
Adds a new security analysis feature to detect potential typosquatting in package names. Compares the package name against a list of popular packages using the Jaro-Winkler similarity algorithm. Packages exceeding a configurable threshold are flagged. Includes a default popular package list and an option for a custom list via configuration. Signed-off-by: Amine <[email protected]>
1 parent 92e5e6f commit 250f2e2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/macaron/malware_analyzer/pypi_heuristics/metadata/typosquatting_presence.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def substitution_func(self, char1: str, char2: str) -> float:
104104
-------
105105
float
106106
0.0 if the characters are the same, `self.keyboard` if they are
107-
neighbors on a QWERTY keyboard, and `self.cost` otherwise.
107+
neighbors on a QWERTY keyboard, otherwise `self.cost` .
108108
"""
109109
if char1 == char2:
110110
return 0.0

0 commit comments

Comments
 (0)