Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 2 min read

I built 4 pre-launch CLIs, and my own scanner failed open

Shipping with AI-assisted coding is a cheat code, right up until launch day. Then you notice there is no CSP, your .env.example is stale, and some GPL package is chilling 3 levels deep in node_modules. So I wrote 4 tiny

Shipping with AI-assisted coding is a cheat code, right up until launch day. Then you notice there is no CSP, your .env.example is stale, and some GPL package is chilling 3 levels deep in node_modules.

So I wrote 4 tiny CLIs. Zero deps, one command each:

npx github:6to90/launchcheck yoursite.com

I ran em on my own prod app. Not a flex.

  • launchcheck: 80/100. No CSP (-15), no og:image (-5).
  • envcheck: 16 env vars used in code but missing from .env.example. Anyone cloning my repo was cooked.
  • licensecheck: 1,197 packages, 0 strong copyleft, 7 weak copyleft, 2 source-available (FSL) I actually need to read.
  • secretscan: 7 hits, nothing scary. A local dev DB URL in a gitignored .env.local plus fake hosts in test files. No real prod keys. Phew.

Plot twist: my secret scanner failed open

Automated security reviews flagged bugs in my own code. Every. Single. One. Was real. Worst offender: run through npx, secretscan scanned nothing and exited 0. Full "all clear" on a folder stuffed with keys. πŸ’€

// before: false when launched through a symlink (exactly how npx runs bins)
if (import.meta.url === `file://${process.argv[1]}`) { run() }

// after
if (realpathSync(process.argv[1]) === fileURLToPath(import.meta.url)) { run() }

My tests passed because I only ever ran node secretscan.mjs directly. Classic.

More L is from the same pass:

  • UNLICENSED (proprietary) matched the UNLICENSE (public domain) prefix, so closed code got labeled permissive
  • nested node_modules and busted package.json files got skipped silently
  • one unreadable file crashed the entire scan
  • envcheck said "none" for const { A } = process.env

New rules: if a tool cannot check something, it says so (exit code 2), never "clean". Match whole identifiers, not prefixes. Test the real entry path.

All MIT, Node 18+, CI on 18/20/22. Regex-based, so not a replacement for gitleaks or a pen test.

Your turn: what score does your site get? Drop it below, I wanna see the worst one πŸ‘‡ And what check should I add next? Most-requested gets built first.

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.