Required Reading
~5 minAuto‑Score Flags
Programmatic signals to grade risk and block merges when necessary.
Signals
- Lifecycle scripts present (+3)preinstall/install/postinstall/prepare detected in package.json or script files.
- child_process in lifecycle files (+4)exec, spawn, execSync during install is a major warning sign.
- Network calls in lifecycle files (http/https/net) (+4)Downloading data/binaries or beaconing during install increases risk.
- Access to sensitive paths/env (.ssh, .aws, .npmrc, process.env.*TOKEN|KEY) (+5)Likely credential theft or environment exfiltration.
- Obfuscation patterns (_0x[a-f0-9]+, large encoded arrays, Buffer.from(base64)) (+3)Conceals behavior; often paired with payload delivery.
- Remote binary hosts not on trusted GitHub Releases/CDN (+4)Unknown hosts are common in malicious native add-ons.
- New maintainer recently or repo removed (+3)Ownership changes can precede compromise.
- Name looks like a typo/brandjack of top packages (+5)Typosquats target common imports and CI scripts.
- Writes to HOME or user directories during install (+3)Modifies ~/.npmrc, ~/.ssh, or caches unexpectedly.
- Contacts Discord/Telegram/Pastebin during install (+4)Common exfil endpoints for malware campaigns.
- Dynamic eval/Function with obfuscated strings (+3)Hides runtime behavior; often decodes payloads.
- chmod +x and executing downloaded binaries (+5)Strong indicator of a payload dropper.
- Install‑time telemetry of CI metadata (+2)Grayware behavior that can leak sensitive org information.
How to use
- Compute a simple risk score; block merges when score exceeds your threshold.
- Log which flags fired; link to triage results to guide reviewers.
- Whitelist known safe build-time packages with native compiles from trusted sources.
- Require checksum/signature verification when remote binaries are allowed.
- Alert when maintainer changes or repository becomes inactive.