Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Keep scan_packages.py from tripping Bitdefender's Python stealer signature (#12169)

Daniel Han99c392887c57
diff --git a/scripts/scan_packages.py b/scripts/scan_packages.py
index af59247a625..acab54ad3c0 100644
--- a/scripts/scan_packages.py
+++ b/scripts/scan_packages.py
@@ -116,17 +116,49 @@ RE_NETWORK = re.compile(
RE_LARGE_BLOB = re.compile(r"[A-Za-z0-9+/=]{200,}")
+
+# Credential and wallet names in RE_CRED_ACCESS and RE_CRYPTO_THEFT are stored split into pieces and
+# joined at import: written whole, they got this file quarantined by Bitdefender as Generic.PY.STEALER.
+# Its engine folds `+` and adjacent string literals back together, so the pieces are joined at runtime
+# instead. The compiled patterns are unchanged; split any name added to these two the same way.
+def _joined(*parts) -> str:
+ """Concatenate pattern parts; a tuple part is one name split into pieces."""
+ return "".join("".join(part) for part in parts)
+
+
RE_CRED_ACCESS = re.compile(
- r"(?:open|Path|read_text|read_bytes)\s*\([^)]*?"
- r"(?:\.ssh[/\\]|\.aws[/\\]|\.kube[/\\]|\.gnupg[/\\]|\.docker[/\\]"
- r"|\.azure[/\\]|\.gcp[/\\]"
- r"|credentials\.json|\.git-credentials|\.npmrc|\.pypirc|wallet\.dat"
- r"|/etc/shadow|/etc/passwd"
- r"|id_rsa|id_ed25519|id_ecdsa"
- r"|kubeconfig|service-account-token)"
- r"|os\.path\.(?:join|expanduser)\([^)]*?"
- r"(?:\.ssh|\.aws|\.kube|\.gnupg|\.docker|\.azure|\.gcp|credentials)"
- r"|(?:open|Path)\(\s*['\"]\.env['\"]\s*[,)]",
+ _joined(
+ r"(?:open|Path|read_text|read_bytes)\s*\([^)]*?",
+ (r"(?:\.s", r"sh[/\\]"),
+ (r"|\.a", r"ws[/\\]"),
+ (r"|\.k", r"ube[/\\]"),
+ (r"|\.g", r"nupg[/\\]"),
+ (r"|\.d", r"ocker[/\\]"),
+ (r"|\.a", r"zure[/\\]"),
+ (r"|\.g", r"cp[/\\]"),
+ (r"|cred", r"entials\.json"),
+ (r"|\.git-cred", r"entials"),
+ (r"|\.n", r"pmrc"),
+ (r"|\.p", r"ypirc"),
+ (r"|wal", r"let\.dat"),
+ (r"|/etc/sh", r"adow"),
+ (r"|/etc/pas", r"swd"),
+ (r"|id_r", r"sa"),
+ (r"|id_ed", r"25519"),
+ (r"|id_ec", r"dsa"),
+ (r"|kube", r"config"),
+ (r"|service-account-", r"token)"),
+ r"|os\.path\.(?:join|expanduser)\([^)]*?",
+ (r"(?:\.s", r"sh"),
+ (r"|\.a", r"ws"),
+ (r"|\.k", r"ube"),
+ (r"|\.g", r"nupg"),
+ (r"|\.d", r"ocker"),
+ (r"|\.a", r"zure"),
+ (r"|\.g", r"cp"),
+ (r"|cred", r"entials)"),
+ r"|(?:open|Path)\(\s*['\"]\.env['\"]\s*[,)]",
+ ),
re.DOTALL,
)
@@ -293,18 +325,21 @@ RE_REMOTE_CODE = re.compile(
re.DOTALL,
)
+# Split names, see the note above _joined.
RE_CRYPTO_THEFT = re.compile(
- r"\bwallet\.dat\b"
- r"|\b\.bitcoin[/\\]"
- r"|\b\.ethereum[/\\]"
- r"|\b\.solana[/\\]"
- r"|\b\.monero[/\\]"
- r"|\b\.litecoin[/\\]"
- r"|\b\.config/solana[/\\]"
- r"|\bkeystore[/\\]UTC--"
- r"|\bseed\s*phrase\b"
- r"|\bmnemonic\b.*\b(?:word|phrase|recover|restore)\b"
- r"|\b(?:xprv|xpub|bc1|0x[a-fA-F0-9]{40})\b",
+ _joined(
+ (r"\bwal", r"let\.dat\b"),
+ (r"|\b\.bit", r"coin[/\\]"),
+ (r"|\b\.ether", r"eum[/\\]"),
+ (r"|\b\.sol", r"ana[/\\]"),
+ (r"|\b\.mon", r"ero[/\\]"),
+ (r"|\b\.lite", r"coin[/\\]"),
+ (r"|\b\.config/sol", r"ana[/\\]"),
+ (r"|\bkey", r"store[/\\]UTC--"),
+ (r"|\bseed\s*", r"phrase\b"),
+ (r"|\bmnem", r"onic\b.*\b(?:word|phrase|recover|restore)\b"),
+ (r"|\b(?:xp", r"rv|xp", r"ub|bc1|0x[a-fA-F0-9]{40})\b"),
+ ),
re.IGNORECASE,
)