periderm-cli 0.1.78 → 0.1.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,26 +1,74 @@
1
1
  # periderm-cli
2
2
 
3
- Pre-launch scanner for web and mobile codebases — context-aware checks for JS, TS, Flutter, React Native, and Swift.
4
-
5
- ## Install
6
-
7
- **Important:** This is a CLI tool and must be installed globally.
3
+ **The pre-launch scanner for apps built with AI.** One command checks your codebase for the problems that lose users, drain your wallet or get you sued — then tells you exactly how to fix each one.
8
4
 
9
5
  ```bash
10
6
  npm install -g periderm-cli
7
+ periderm login
8
+ periderm scan
11
9
  ```
12
10
 
13
- Or use the install script from your Periderm dashboard docs (`curl -fsSL https://periderm-cli.vercel.app//install.sh | bash`).
11
+ You get a verdict (**LAUNCH READY**, **HOLD** or **DO NOT LAUNCH**), a 0–100 launch confidence score, and a report where every finding has the file and line, why it matters, the exact fix, and a prompt you can paste into Cursor, Claude Code or ChatGPT.
12
+
13
+ Your code is scanned on your machine — it is not uploaded.
14
+
15
+ ## Why
16
+
17
+ AI coding tools write code that runs. They also routinely ship:
18
+
19
+ - API keys and secrets in client code
20
+ - routes and Supabase functions anyone can call without logging in
21
+ - `catch {}` blocks that swallow errors so failures are invisible
22
+ - polling loops and recursion that run up your cloud bill
23
+ - a privacy policy that says one thing while the code does another
24
+
25
+ Linters, type checkers and dependency scanners don't look for these. Periderm does.
26
+
27
+ ## What it checks (150+ checks)
28
+
29
+ | Area | Examples |
30
+ | --- | --- |
31
+ | Security | hardcoded secrets, missing authorization, Supabase `SECURITY DEFINER` functions open to `anon`, XSS via `dangerouslySetInnerHTML`, client-trusted user IDs |
32
+ | Reliability | silent catch blocks, unhandled fetches, effects without cleanup, missing loading and error states |
33
+ | Cost | `setInterval` polling against your database or API, unbounded recursion |
34
+ | Legal | legal pages that contradict your code, and compliance gaps in signup, email, billing, uploads and tracking that can lead to fines |
35
+ | SEO & polish | titles, descriptions, Open Graph, favicon, robots.txt, placeholder text, dead links |
36
+ | Code quality | an ML defect predictor (trained on the PROMISE dataset) flags your most complex files |
14
37
 
15
- ## Quick start
38
+ Works with JavaScript, TypeScript, React, Next.js, TanStack, Supabase, Firebase, React Native / Expo, Flutter and Swift.
39
+
40
+ ## Make your AI coding agent check its own work
16
41
 
17
42
  ```bash
18
- periderm login # authenticate once
19
- periderm scan # scan + upload to your dashboard
20
- periderm watch # rerun on file change
21
- periderm whoami # show current token + plan
43
+ periderm agents
22
44
  ```
23
45
 
24
- ## Project context
46
+ Adds a short rule to `AGENTS.md` (and with `--all`: `CLAUDE.md`, Cursor, Copilot and Windsurf rule files) so your agent runs `periderm scan` after every change and keeps fixing findings until the verdict is LAUNCH READY.
47
+
48
+ ## Commands
49
+
50
+ | Command | What it does |
51
+ | --- | --- |
52
+ | `periderm scan` | Scan the current project and save the report to your dashboard (`--local` to keep it on your machine) |
53
+ | `periderm review --deep` | AI agent review for edge cases static checks miss (Scale / Unlimited) |
54
+ | `periderm agents` | Install the "always scan before you're done" rule for AI coding agents |
55
+ | `periderm watch` | Re-scan when files change |
56
+ | `periderm login` / `logout` / `whoami` | Manage the linked account |
57
+
58
+ Reports are written to `.periderm/last-report.md` and `.periderm/last-report.json`.
59
+
60
+ ## Free Lighthouse score checker
61
+
62
+ Check any live site's performance, accessibility, best practices and SEO scores — with Core Web Vitals and an AI fix plan — at [periderm-cli.vercel.app/lighthouse](https://periderm-cli.vercel.app/lighthouse). No account needed.
63
+
64
+ ## Pricing
65
+
66
+ - **Starter** — free: unlimited local scans, 15 cloud scans a month
67
+ - **Scale** — $9 one-time: 100 scan credits that never expire, AI reviewer, deep review
68
+ - **Unlimited** — $19/month or $190/year
69
+
70
+ ## Links
25
71
 
26
- Full docs live on your Periderm dashboard at `/docs`.
72
+ - Website & dashboard: https://periderm-cli.vercel.app
73
+ - Docs: https://periderm-cli.vercel.app/docs
74
+ - For AI assistants: https://periderm-cli.vercel.app/llms.txt
@@ -324,7 +324,11 @@ const dangerousHtml = (source, file) => {
324
324
  // standard, safe way to embed JSON-LD (especially with "<" escaped).
325
325
  // Only look at this element's own opening tag and this value — never neighbouring code.
326
326
  const ownTag = source.slice(source.lastIndexOf("<", m.index), m.index);
327
- const isJsonLd = /application\/ld\+json/.test(ownTag) && /JSON\.stringify\s*\(/.test(expr);
327
+ // The value may be built inline or in a constant: `const LD = JSON.stringify(...)`.
328
+ const builtWithStringify = /JSON\.stringify\s*\(/.test(expr) ||
329
+ (/^[A-Za-z_$][\w$]*$/.test(expr) &&
330
+ new RegExp(`\\b(?:const|let|var)\\s+${expr}\\s*=\\s*JSON\\.stringify\\s*\\(`).test(source));
331
+ const isJsonLd = /application\/ld\+json/.test(ownTag) && builtWithStringify;
328
332
  const escapesTags = /JSON\.stringify\s*\([^)]*\)\s*\.replace\(\s*\/<\/g/.test(expr);
329
333
  if (!isLiteral && !hasSanitize && !isJsonLd && !escapesTags) {
330
334
  out.push(mkFinding({
@@ -731,6 +735,50 @@ const idorDataFetch = (source, file) => {
731
735
  return out;
732
736
  };
733
737
  // ───────────────────────────────────────────────────────────────────────
738
+ // 20b. Server code that trusts a user id sent by the browser
739
+ // ───────────────────────────────────────────────────────────────────────
740
+ // `.eq("user_id", data.userId)` looks like an ownership check, but when `data` is the request
741
+ // payload the caller simply sends someone else's id and gets (or deletes) their rows.
742
+ const CLIENT_USER_ID_RE = /\.eq\(\s*["'](?:user_id|owner_id|userId)["']\s*,\s*(?:data|body|input|args|payload|params|req\.body|request\.body)\.(?:userId|user_id|uid|ownerId)\s*\)|\buser_id\s*:\s*(?:data|body|input|args|payload)\.(?:userId|user_id|uid)\b/g;
743
+ const AUTH_EVIDENCE_RE = /\.middleware\(\s*\[[^\]]*(?:auth|Auth|session|Session)|requireAuth|requireSupabaseAuth|withAuth|getServerSession|auth\(\)|\.auth\.getUser\(|verifyToken|cli_tokens|context\.userId\s*!==|!==\s*context\.userId/;
744
+ const clientTrustedUserId = (source, file) => {
745
+ const out = [];
746
+ if (!/\.(ts|tsx|js|jsx|mjs)$/.test(file))
747
+ return out;
748
+ if (!CLIENT_USER_ID_RE.test(source))
749
+ return out;
750
+ CLIENT_USER_ID_RE.lastIndex = 0;
751
+ // Judge each server function on its own: auth on one function doesn't protect its neighbour.
752
+ const starts = [...source.matchAll(/createServerFn\s*\(/g)].map((m) => m.index ?? 0);
753
+ const blocks = starts.length > 0
754
+ ? starts.map((st, i) => [st, starts[i + 1] ?? source.length])
755
+ : /server\s*:\s*\{\s*handlers|export\s+(?:async\s+)?function\s+(?:GET|POST|PUT|PATCH|DELETE)\b/.test(source) || /(^|\/)api\//.test(file)
756
+ ? [[0, source.length]]
757
+ : [];
758
+ for (const [from, to] of blocks) {
759
+ const block = source.slice(from, to);
760
+ if (AUTH_EVIDENCE_RE.test(block))
761
+ continue;
762
+ const m = new RegExp(CLIENT_USER_ID_RE.source).exec(block);
763
+ if (!m)
764
+ continue;
765
+ const line = lineOf(source, from + m.index);
766
+ out.push(mkFinding({
767
+ id: "client-trusted-user-id",
768
+ category: "Security",
769
+ severity: "critical",
770
+ file,
771
+ line,
772
+ message: "Server code uses a user ID sent by the browser to decide whose data to read or change.",
773
+ why: "Anyone can send another user's ID in the request and read, overwrite or delete that user's data. Filtering by user_id only protects you if the id comes from the verified session, not the request.",
774
+ fix: "Require authentication on this function (e.g. an auth middleware) and take the user id from the verified session (context.userId / auth.uid()), never from the request body.",
775
+ aiPrompt: `In ${file} near line ${line}, a server function filters or writes rows using a user id taken from the request payload. Add the project's auth middleware to this function, remove userId from its input, and use the authenticated user's id from the session instead. Check every other server function in the file for the same pattern.`,
776
+ }));
777
+ break; // one finding per file is enough to fix the pattern
778
+ }
779
+ return out;
780
+ };
781
+ // ───────────────────────────────────────────────────────────────────────
734
782
  // 21. Dead End Page (No Navigation/Layout)
735
783
  // ───────────────────────────────────────────────────────────────────────
736
784
  const deadEndPage = (source, file) => {
@@ -1365,6 +1413,7 @@ const CHECKS = [
1365
1413
  unauthAdmin,
1366
1414
  missingRateLimit,
1367
1415
  idorDataFetch,
1416
+ clientTrustedUserId,
1368
1417
  deadEndPage,
1369
1418
  dbPollingAbuse,
1370
1419
  iconButtonNoLabel,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "periderm-cli",
3
- "version": "0.1.78",
4
- "description": "Periderm CLI: A pre-launch checklist to catch user-losing bugs, legal liabilities, revenue leaks, runaway cloud bills and so many more before you ship.",
3
+ "version": "0.1.80",
4
+ "description": "Pre-launch code scanner for apps built with AI: finds leaked secrets, missing auth, silent failures, runaway cloud costs and legal gaps before you ship.",
5
5
  "type": "module",
6
6
  "preferGlobal": true,
7
7
  "bin": {
@@ -34,7 +34,23 @@
34
34
  "mobile",
35
35
  "Japheth",
36
36
  "periderm",
37
- "launch"
37
+ "launch",
38
+ "vibe-coding",
39
+ "ai-code-review",
40
+ "ai-generated-code",
41
+ "security-scanner",
42
+ "code-scanner",
43
+ "pre-launch-checklist",
44
+ "supabase",
45
+ "nextjs",
46
+ "cursor",
47
+ "claude-code",
48
+ "copilot",
49
+ "gdpr",
50
+ "coppa",
51
+ "lighthouse",
52
+ "launch-readiness",
53
+ "sast"
38
54
  ],
39
55
  "homepage": "https://periderm-cli.vercel.app",
40
56
  "repository": {