Expand description
Lightweight content scanner for dependency lifecycle script bodies.
Pattern-matches dangerous shapes — shell-pipe (curl … | sh),
base64-deobfuscation (eval(atob(…))), credential-file reads
(~/.ssh, ~/.npmrc), secret-shaped process.env reads,
exfiltration endpoints (Discord/Telegram webhooks, OAST hosts,
bare-IP HTTP) — in a package’s preinstall / install /
postinstall scripts. Fired before the user is prompted to
approve a build so the prompt can carry more than just
name@version.
Pure regex matching — no AST parse, no shell-quoting awareness.
False positives are possible (an SDK that legitimately hits a
Discord webhook from a postinstall would flag), but lifecycle
script bodies are short and almost never contain bare
curl … | sh legitimately, so the FP rate is low in practice.
Sniffing is advisory: it never blocks an install or write. The
existing BuildPolicy allowlist remains the only gate on
whether scripts actually execute.
Structs§
- Suspicion
- One match against a script body.
Enums§
- Suspicion
Kind - Why a script body got flagged. Each variant carries a one-line
descriptionfor the user-facing warning and acategorytag used by interactive surfaces (aube approve-buildspicker labels) that need a short marker.
Functions§
- sniff_
lifecycle - Scan a dep’s manifest for suspicious lifecycle script bodies.
Returns one
Suspicionper (hook, rule) pair that matched. Empty result for packages with no scripts or no matches.