tier-management
Audited by Socket on Aug 6, 2026
2 alerts found:
AnomalySecurityNo direct evidence of overt malware (e.g., backdoor/persistence/exfiltration to arbitrary domains) is present in this fragment. The dominant risks are (a) potential SQL injection/query manipulation via unsanitized USER_QUERY interpolation into an executed SQL command, (b) exposure of sensitive user data (including email) to stdout, and (c) runtime decryption/export of a Polar API token plus execution via npx/tsx (supply-chain/operational risk). Error suppression (2>/dev/null) further reduces detection capability.
No clear evidence of covert malware (no exfiltration/persistence/backdoor observed), but this module is security-critical due to high-impact, injection-prone design: it constructs D1 SQL via string interpolation with untrusted userId and executes it using execSync with `npx wrangler`. If an attacker can influence the stdin JSON, this can enable unauthorized database manipulation and potentially unsafe command/argument behavior. Logs also expose user identifiers and balance values. Require strict stdin validation and replace dynamic SQL/shell command construction with parameterized queries and safe exec argument handling.