greenlitlab 0.1.1 → 0.2.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.1 (9 November 2026)
4
+
5
+ - Reads all of an app's code: lazy-loaded pages (Vite and Next.js chunk lists), every import form, chains of any depth, scripts with `?v=` addresses, and scripts on the app's own CDN. It used to stop after two rounds, so most code in larger apps went unread.
6
+ - Says what it didn't read. If a check runs out of room it reports how many scripts were left. If none of the app's code could be read, it gives no grade instead of an A.
7
+ - Grades match the danger: one critical problem means D at best, one high problem means C at best (a leaked master key used to earn a C, and a public `.git` folder a B).
8
+ - An A or B no longer sounds like an all-clear when the database wasn't checked, and there's now a prompt that has your builder check the database, for people without a terminal.
9
+ - A builder's "website not found" page, served with status 200, is now reported as not found instead of graded A.
10
+ - Clear errors in the CLI too, including for an address that doesn't exist.
11
+ - Web: the script and stylesheet addresses carry the version, because the 4-hour browser cache otherwise left returning visitors on old code after a deploy.
12
+ - Web: progress and errors now appear under the box instead of off screen. Results refresh after 2 minutes instead of 10, and the limit is 30 checks an hour.
13
+
14
+ ## 0.2.0 (8 November 2026)
15
+
16
+ - 18 more kinds of leaked keys: Supabase secret keys (sb_secret_) and access tokens, OpenRouter, xAI, Perplexity, Hugging Face, Replicate, Pinecone, GitLab, npm, Shopify, Brevo, Mailchimp, Mailgun, Telegram bots, secret Mapbox tokens, private keys and Google service-account JSON. `sk_live_` keys are named for Stripe, Clerk and similar.
17
+ - Clickjacking: flags a site any other site can put in a frame.
18
+ - With `--mine`: Supabase sign-up open to anyone without email confirmation (which turns "signed-in only" rules into "anyone"), storage buckets that list files to anyone, and public `.env` files or `.git` folders. Hosts that answer every path with the home page don't count.
19
+ - "Copy all fixes": every fix prompt in one, worst first, on the web, with `--prompt all`, and as `allFixes` in the MCP tool.
20
+
3
21
  ## 0.1.1 (8 November 2026)
4
22
 
5
23
  - Hosts that answer every missing file with the home page (Lovable, Netlify, Vercel) are no longer reported as publishing source maps.
package/README.md CHANGED
@@ -14,14 +14,19 @@ npx greenlitlab myapp.lovable.app
14
14
 
15
15
  | Check | Where it runs |
16
16
  |---|---|
17
- | Secret keys (Stripe, OpenAI, AWS, GitHub and more) in the JavaScript every visitor downloads | everywhere |
17
+ | Secret keys in the JavaScript every visitor downloads: 30 kinds, including Stripe, OpenAI, Anthropic, OpenRouter, Gemini, AWS, GitHub, Supabase secret keys, Telegram bots, private keys and service-account JSON | everywhere |
18
18
  | A Supabase `service_role` key in the browser | everywhere |
19
19
  | Source maps that hand out your source code | everywhere |
20
- | Missing security headers (CSP, framing) | everywhere |
20
+ | Clickjacking (no `frame-ancestors` or `X-Frame-Options`) and no Content-Security-Policy | everywhere |
21
21
  | Supabase tables anyone can read with the public key | your own app, `--mine` |
22
+ | Supabase storage buckets that list their files to anyone | your own app, `--mine` |
23
+ | Supabase sign-up open to anyone without email confirmation | your own app, `--mine` |
24
+ | A public `.env` file or `.git` folder | your own app, `--mine` |
22
25
  | Firebase Realtime Database and Firestore open to everyone | your own app, `--mine` |
23
26
 
24
- The database checks ask for a row count (Supabase) or one document name (Firebase), never for data. They run only when you say the app is yours, because testing someone else's database without permission isn't OK.
27
+ Greenlit reads all of the app's own scripts, including lazy-loaded pages and the app's own CDN, and tells you if a check ran out of room or couldn't read the code. Grades follow the danger: one critical problem means D at best, one high problem means C at best.
28
+
29
+ The owner-only checks ask for a row count (Supabase), one file or document name (storage, Firebase), or the sign-up settings, never for data, and never write anything. They run only when you say the app is yours, because testing someone else's database without permission isn't OK.
25
30
 
26
31
  ## Commands
27
32
 
@@ -29,6 +34,7 @@ The database checks ask for a row count (Supabase) or one document name (Firebas
29
34
  npx greenlitlab <url> # grade an app
30
35
  npx greenlitlab <url> --mine # your own app: database checks too
31
36
  npx greenlitlab <url> --prompt 1 # print fix prompt 1 only (pipe it to pbcopy)
37
+ npx greenlitlab <url> --prompt all # every fix in one prompt, worst first
32
38
  npx greenlitlab <url> --json # the full result
33
39
  npx greenlitlab <url> --fail-on high # exit 1 if anything this serious is found, for CI
34
40
  ```
@@ -40,7 +46,7 @@ The last result for each app is kept in `~/.greenlit/sites/` (grade, finding ids
40
46
  Add Greenlit as an MCP server:
41
47
 
42
48
  ```json
43
- { "mcpServers": { "greenlit": { "command": "npx", "args": ["-y", "greenlitlab@0.1.1", "mcp"] } } }
49
+ { "mcpServers": { "greenlit": { "command": "npx", "args": ["-y", "greenlitlab@0.2.0", "mcp"] } } }
44
50
  ```
45
51
 
46
52
  Then ask your agent to check the app it just deployed and apply the fixes. The `greenlit_check` tool returns the grade, every finding and its fix prompt.
package/bin/greenlit.mjs CHANGED
@@ -8,7 +8,7 @@ import fs from "node:fs";
8
8
  import path from "node:path";
9
9
  import { parseArgs } from "node:util";
10
10
  import { fileURLToPath } from "node:url";
11
- import { siteScan, compare, renderSite } from "../src/grade.mjs";
11
+ import { siteScan, compare, renderSite, allPrompts, explainError } from "../src/grade.mjs";
12
12
  import { SEVERITY } from "../src/severity.mjs";
13
13
  import { loadLast, saveRun } from "../src/history.mjs";
14
14
 
@@ -20,6 +20,7 @@ const HELP = `greenlit ${VERSION}: is your AI-built app safe to launch?
20
20
  npx greenlitlab <url> grade an app from what every visitor can see
21
21
  npx greenlitlab <url> --mine your own app: also check which database tables anyone can read
22
22
  npx greenlitlab <url> --prompt 1 print just fix prompt 1, to copy (add | pbcopy on a Mac)
23
+ npx greenlitlab <url> --prompt all every fix in one prompt, worst first
23
24
  npx greenlitlab <url> --json the full result as JSON
24
25
  npx greenlitlab <url> --fail-on high exit 1 if anything this serious is found (for CI)
25
26
  npx greenlitlab mcp run as an MCP server
@@ -66,12 +67,19 @@ if (opt.version) {
66
67
  result = await siteScan(target, { mine: opt.mine });
67
68
  } catch (e) {
68
69
  if (timer) (clearInterval(timer), process.stderr.write("\r\x1b[K"));
69
- console.error(`greenlit: ${e.message}`);
70
+ console.error(`greenlit: ${explainError(e.message)}`);
70
71
  process.exit(1);
71
72
  }
72
73
  if (timer) (clearInterval(timer), process.stderr.write("\r\x1b[K"));
73
74
 
74
- if (opt.prompt) {
75
+ if (opt.prompt === "all") {
76
+ const all = allPrompts(result);
77
+ if (!all) {
78
+ console.error("greenlit: nothing to fix here.");
79
+ process.exit(2);
80
+ }
81
+ console.log(all);
82
+ } else if (opt.prompt) {
75
83
  const withPrompt = result.findings.filter((f) => f.prompt);
76
84
  const p = withPrompt[Number(opt.prompt) - 1];
77
85
  if (!p) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "greenlitlab",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "description": "Is your AI-built app safe to launch? A grade from A to F for apps built with Lovable, Bolt, v0, Replit or Emergent, with a fix prompt for every problem.",
5
5
  "type": "module",
6
6
  "bin": {
package/server.json CHANGED
@@ -5,12 +5,12 @@
5
5
  "description": "Grade apps built with Lovable, Bolt, v0 or Replit A to F, with a fix prompt for every problem.",
6
6
  "websiteUrl": "https://greenlit.priberry.com",
7
7
  "repository": { "url": "https://github.com/priberry-data/greenlitlab", "source": "github" },
8
- "version": "0.1.1",
8
+ "version": "0.2.1",
9
9
  "packages": [
10
10
  {
11
11
  "registryType": "npm",
12
12
  "identifier": "greenlitlab",
13
- "version": "0.1.1",
13
+ "version": "0.2.1",
14
14
  "transport": { "type": "stdio" },
15
15
  "packageArguments": [{ "type": "positional", "value": "mcp" }]
16
16
  }
package/src/grade.mjs CHANGED
@@ -12,7 +12,8 @@ import { SEVERITY } from "./severity.mjs";
12
12
 
13
13
  // [pattern, id, what it is, what a stranger can do with it, where to revoke it]
14
14
  const SECRETS = [
15
- [/sk_live_[0-9A-Za-z]{20,}/, "stripe", "A live Stripe secret key", "Anyone can charge, refund and read your customers' payments.", "Stripe → Developers → API keys → Roll key", "STRIPE_SECRET_KEY"],
15
+ // sk_live_ is used by Stripe and by other services (Clerk, Paystack); the advice is the same for all of them.
16
+ [/\bsk_live_[0-9A-Za-z]{20,}/, "stripe", "A live secret key for payments or sign-in (Stripe, Clerk or similar)", "With Stripe, anyone can charge, refund and read your customers' payments; with Clerk, anyone can manage your users.", "the dashboard of the service it belongs to (Stripe: Developers → API keys → Roll key; Clerk: API keys → roll the secret key)", "STRIPE_SECRET_KEY"],
16
17
  [/rk_live_[0-9A-Za-z]{20,}/, "stripe-restricted", "A live Stripe restricted key", "Anyone can do whatever this key allows on your Stripe account.", "Stripe → Developers → API keys → delete the restricted key", "STRIPE_RESTRICTED_KEY"],
17
18
  [/sk-(proj|svcacct|admin)-[0-9A-Za-z_-]{20,}|sk-[0-9A-Za-z]{48}\b/, "openai", "An OpenAI API key", "Anyone can run up your OpenAI bill.", "platform.openai.com → API keys → revoke", "OPENAI_API_KEY"],
18
19
  [/sk-ant-[0-9A-Za-z_-]{20,}/, "anthropic", "An Anthropic API key", "Anyone can run up your Anthropic bill.", "console.anthropic.com → API keys → disable", "ANTHROPIC_API_KEY"],
@@ -23,6 +24,24 @@ const SECRETS = [
23
24
  [/SG\.[0-9A-Za-z_-]{20,}\.[0-9A-Za-z_-]{20,}/, "sendgrid", "A SendGrid API key", "Anyone can send email as you.", "SendGrid → Settings → API Keys → delete", "SENDGRID_API_KEY"],
24
25
  [/\bAC[0-9a-f]{32}\b[\s\S]{0,80}?\b[0-9a-f]{32}\b/, "twilio", "Twilio credentials", "Anyone can send texts and make calls on your account.", "Twilio console → Account → API keys & tokens → rotate the auth token", "TWILIO_AUTH_TOKEN"],
25
26
  [/gsk_[0-9A-Za-z]{40,}/, "groq", "A Groq API key", "Anyone can run up your Groq bill.", "console.groq.com → API Keys → delete", "GROQ_API_KEY"],
27
+ [/\bsb_secret_[0-9A-Za-z_-]{20,}/, "supabase-secret", "A Supabase secret key", "It skips every security rule: anyone can read, change and delete all of your data and users.", "Supabase → Project Settings → API Keys → delete this secret key and create a new one", "SUPABASE_SECRET_KEY"],
28
+ [/\bsbp_[0-9a-f]{40}\b/, "supabase-token", "A Supabase personal access token", "Anyone can manage your Supabase account: every project, database and setting.", "supabase.com → Account → Access Tokens → revoke", "SUPABASE_ACCESS_TOKEN"],
29
+ [/\bsk-or-v1-[0-9a-f]{64}\b/, "openrouter", "An OpenRouter API key", "Anyone can run up your OpenRouter bill on any model.", "openrouter.ai → Keys → delete", "OPENROUTER_API_KEY"],
30
+ [/\bxai-[0-9A-Za-z]{60,}/, "xai", "An xAI (Grok) API key", "Anyone can run up your xAI bill.", "console.x.ai → API Keys → delete", "XAI_API_KEY"],
31
+ [/\bpplx-[0-9A-Za-z]{40,}/, "perplexity", "A Perplexity API key", "Anyone can run up your Perplexity bill.", "perplexity.ai → Settings → API → revoke", "PERPLEXITY_API_KEY"],
32
+ [/\bhf_[0-9A-Za-z]{34,}/, "huggingface", "A Hugging Face token", "Anyone can use your Hugging Face account and, with a write token, change your models.", "huggingface.co → Settings → Access Tokens → delete", "HF_TOKEN"],
33
+ [/\br8_[0-9A-Za-z]{37}\b/, "replicate", "A Replicate API token", "Anyone can run up your Replicate bill.", "replicate.com → Account → API tokens → delete", "REPLICATE_API_TOKEN"],
34
+ [/\bpcsk_[0-9A-Za-z_]{40,}/, "pinecone", "A Pinecone API key", "Anyone can read, change and delete your vector database.", "app.pinecone.io → API Keys → delete", "PINECONE_API_KEY"],
35
+ [/\b(?:glpat|gldt)-[0-9A-Za-z_-]{20,}/, "gitlab", "A GitLab token", "Access to your code, and possibly the right to change it.", "GitLab → Preferences → Access Tokens → revoke", "GITLAB_TOKEN"],
36
+ [/\bnpm_[0-9A-Za-z]{36}\b/, "npm", "An npm token", "Anyone can publish packages as you, which can infect everyone who installs them.", "npmjs.com → Access Tokens → delete", "NPM_TOKEN"],
37
+ [/\bshp(?:at|ca|pa|ss)_[0-9a-fA-F]{32}\b/, "shopify", "A Shopify access token", "Anyone can read and change your store, orders and customers.", "Shopify admin → Apps → your app → API credentials → rotate", "SHOPIFY_ACCESS_TOKEN"],
38
+ [/\bxkeysib-[0-9a-f]{64}-[0-9A-Za-z]{16}\b/, "brevo", "A Brevo (Sendinblue) API key", "Anyone can send email as you and read your contacts.", "Brevo → SMTP & API → API Keys → delete", "BREVO_API_KEY"],
39
+ [/\b[0-9a-f]{32}-us\d{1,2}\b/, "mailchimp", "A Mailchimp API key", "Anyone can read your mailing list and send campaigns as you.", "Mailchimp → Profile → Extras → API keys → delete", "MAILCHIMP_API_KEY"],
40
+ [/\bkey-[0-9a-f]{32}\b/, "mailgun", "A Mailgun API key", "Anyone can send email as you.", "Mailgun → API Security → delete the key", "MAILGUN_API_KEY"],
41
+ [/\b\d{8,10}:AA[0-9A-Za-z_-]{33}\b/, "telegram", "A Telegram bot token", "Anyone can take over your bot and read the messages people send it.", "Telegram → @BotFather → /revoke", "TELEGRAM_BOT_TOKEN"],
42
+ [/\bsk\.eyJ[0-9A-Za-z_-]{20,}\.[0-9A-Za-z_-]{20,}/, "mapbox", "A secret Mapbox token", "Anyone can use your Mapbox account and run up your bill. (Public pk. tokens are fine.)", "account.mapbox.com → Tokens → delete", "MAPBOX_SECRET_TOKEN"],
43
+ [/-----BEGIN (?:RSA |EC |OPENSSH |ENCRYPTED )?PRIVATE KEY-----(?:\\n|\\r|\s)+[A-Za-z0-9+\/=]{60,}/, "private-key", "A private key", "Whatever this key signs in to or signs for, anyone can now do too.", "the service the key belongs to: replace the key pair there and delete the old one", "PRIVATE_KEY"],
44
+ [/"type"\s*:\s*"service_account"[\s\S]{0,400}"private_key"/, "gcp-service-account", "A Google Cloud or Firebase service-account key", "It's an admin key: anyone can reach your Firebase and Google Cloud data with full rights.", "Google Cloud console → IAM → Service Accounts → Keys → delete this key", "GOOGLE_APPLICATION_CREDENTIALS"],
26
45
  [/AIza[0-9A-Za-z_-]{35}(?=[\s\S]{0,400}(generativelanguage|gemini))/, "gemini", "A Google AI (Gemini) API key", "Anyone can run up your Gemini bill. (Firebase keys are public by design; this one sits next to Gemini calls.)", "aistudio.google.com → API keys → delete", "GEMINI_API_KEY"],
27
46
  ];
28
47
  const JWT = /eyJ[0-9A-Za-z_-]{10,}\.eyJ[0-9A-Za-z_-]{10,}\.[0-9A-Za-z_-]{10,}/g;
@@ -87,11 +106,11 @@ const safeUrl = (u, base) => {
87
106
  }
88
107
  };
89
108
 
90
- async function get(url, { timeout = 15000, headers = {}, method = "GET", max = 8 * 1024 * 1024, fetcher = fetch } = {}) {
109
+ async function get(url, { timeout = 15000, headers = {}, method = "GET", body = null, max = 8 * 1024 * 1024, fetcher = fetch } = {}) {
91
110
  const ctl = new AbortController();
92
111
  const t = setTimeout(() => ctl.abort(), timeout);
93
112
  try {
94
- const r = await fetcher(url, { method, headers: { "user-agent": "greenlit (+https://greenlit.priberry.com)", ...headers }, signal: ctl.signal, redirect: "follow" });
113
+ const r = await fetcher(url, { method, headers: { "user-agent": "greenlit (+https://greenlit.priberry.com)", ...headers }, ...(body != null && { body }), signal: ctl.signal, redirect: "follow" });
95
114
  const text = method === "HEAD" ? "" : await readCapped(r, max);
96
115
  return { status: r.status, headers: r.headers, text, url: r.url };
97
116
  } catch (e) {
@@ -101,6 +120,37 @@ async function get(url, { timeout = 15000, headers = {}, method = "GET", max = 8
101
120
  }
102
121
  }
103
122
 
123
+ // What went wrong, in words a non-developer can act on. Shared by the web check and the CLI.
124
+ export function explainError(message) {
125
+ const m = String(message);
126
+ const code = Number((m.match(/\((\d{3})\)$/) || [])[1]);
127
+ if (/look like a web address/.test(m)) return "That doesn't look like a web address. Try something like myapp.lovable.app.";
128
+ if (/isn't a web page/.test(m)) return "That address isn't a web page. Enter the address people open to use your app.";
129
+ if (code === 404) return "That address answered \"not found\". Check it's the live address of your app (open it in your browser first).";
130
+ if (code === 530) return "Nothing answers at that address. Check the spelling, and that the app is published.";
131
+ if (code === 401 || code === 403 || code === 429) return "That site turned the check away. It may be private, password-protected, or blocking automated visitors, so Greenlit can't grade it from here.";
132
+ if (code >= 500) return `That site had an error of its own (${code}). Open it in your browser to see if it's up, then try again.`;
133
+ if (/timed out/.test(m)) return "That site took too long to answer. Try again in a minute.";
134
+ return "Couldn't reach that site. Check the spelling, and that the app is published.";
135
+ }
136
+
137
+ // A script belongs to the app if it's on the same site (static.myapp.com for myapp.com) or on a hosting CDN.
138
+ // Scripts on anyone else's site (Stripe, analytics) are that company's code, not the app's.
139
+ const siteKey = (host) => {
140
+ const parts = host.toLowerCase().split(".");
141
+ const short = parts.length > 2 && parts.at(-1).length === 2 && /^(co|com|org|net|ac|gov|edu)$/.test(parts.at(-2));
142
+ return parts.slice(short ? -3 : -2).join(".");
143
+ };
144
+ const HOSTING_CDN = /(^|\.)(cloudfront\.net|azureedge\.net|b-cdn\.net|r2\.dev|fastly\.net|akamaized\.net|amazonaws\.com|storage\.googleapis\.com)$/i;
145
+
146
+ // Paths to other scripts mentioned inside a script or page: imports of every form, and the lists of lazy-loaded
147
+ // pages that Vite and Next.js keep ("assets/Page-abc.js", "static/chunks/abc.js"). This is where most of an app's code is.
148
+ const SCRIPT_REF = /["'`]((?:\.{0,2}\/|assets\/|_next\/|static\/chunks\/)[\w@.~\/-]+\.m?js(?:\?[^"'`\s]*)?)["'`]/g;
149
+ const resolveRef = (ref, from, origin) => (/^(assets|_next)\//.test(ref) ? safeUrl(ref, `${origin}/`) : ref.startsWith("static/chunks/") ? safeUrl(`/_next/${ref}`, origin) : safeUrl(ref, from));
150
+
151
+ // Builders and hosts often answer an address with nothing on it with a normal-looking page and status 200.
152
+ const DEAD_PAGE = /<title[^>]*>[^<]*(?:(?:website|site|page|project|app|application|deployment)\s+(?:was\s+|is\s+)?not\s+found|\b404\b)[^<]*<\/title>/i;
153
+
104
154
  // --- fix prompts ---------------------------------------------------------------------------------
105
155
  // Written for someone who can't read the code: what to do by hand first (revoking a key is something
106
156
  // no AI builder can do for you), then one prompt to paste into the builder's chat.
@@ -130,6 +180,30 @@ const P = {
130
180
  first: null,
131
181
  prompt: `Anyone on the internet can read the Firestore collection "${coll}". Rewrite my Firestore security rules so "${coll}" (and every other collection) is closed by default, and a signed-in user can only read and write documents they own, for example match /${coll}/{id} { allow read, write: if request.auth != null && request.auth.uid == resource.data.userId; }. Adjust the owner field to whatever this app uses. Show me the final rules.`,
132
182
  }),
183
+ signup: () => ({
184
+ first: "Supabase → Authentication → Sign In / Providers → Email: turn on \"Confirm email\". If only people you invite should get in, turn off \"Allow new users to sign up\" too.",
185
+ prompt: "In my Supabase project, anyone can create an account with any email address without confirming it. Find every Row Level Security policy that only checks that a user is signed in (for example `to authenticated using (true)`, or `auth.role() = 'authenticated'`), because to a stranger those are open. Rewrite each one so a user reaches only their own rows (auth.uid() = user_id), or only rows they were given access to. List each policy you changed, and show me the SQL.",
186
+ }),
187
+ storage: (bucket) => ({
188
+ first: null,
189
+ prompt: `In my Supabase project, anyone on the internet can list the files in the storage bucket "${bucket}". Change the storage policies so files in "${bucket}" can only be listed and read by the user who uploaded them (for example, store files under a folder named after auth.uid() and check (storage.foldername(name))[1] = auth.uid()::text). If some files must be public, keep them in a separate public bucket and tell me which. Show me the SQL.`,
190
+ }),
191
+ envFile: (path) => ({
192
+ first: `Assume every key in ${path} is public: revoke and replace each one in the dashboard of the service it belongs to.`,
193
+ prompt: `My live site serves the file ${path} to anyone who asks for it. Make sure ${path} is never deployed: add it to .gitignore and to the host's ignore settings, move its values into the host's environment variable settings, redeploy, and confirm that opening ${path} on the live site now returns "not found".`,
194
+ }),
195
+ gitDir: () => ({
196
+ first: "Assume anyone can now download your whole code history, including any key ever committed: revoke and replace those keys.",
197
+ prompt: "My live site serves its .git folder, so anyone can download my whole code history. Change the deployment so the .git folder is never uploaded or served (deploy only the build output folder), redeploy, and confirm that opening /.git/config on the live site returns \"not found\".",
198
+ }),
199
+ framing: () => ({
200
+ first: null,
201
+ prompt: "Any other website can show my app inside a hidden frame and trick my users into clicking things (clickjacking). Add the response header `Content-Security-Policy: frame-ancestors 'self'` (or `X-Frame-Options: DENY`) in my host's header settings, redeploy, and confirm the header is there. If this host doesn't let me set response headers, say so plainly instead of adding a meta tag, because a meta tag can't do this. Then tell me what my options are.",
202
+ }),
203
+ dbCheck: (db) =>
204
+ db === "Supabase"
205
+ ? "Check my Supabase database and change nothing yet. For every table, tell me whether Row Level Security is on, and which policies let someone read or change rows without signing in, or read rows that aren't theirs. Do the same for my storage buckets. Also tell me whether anyone can sign up without confirming their email. End with a plain list of what is open to strangers, worst first."
206
+ : "Check my Firebase security rules and change nothing yet. For Firestore, Realtime Database and Storage, tell me which paths someone can read or change without signing in, or read when the data isn't theirs. End with a plain list of what is open to strangers, worst first.",
133
207
  sourceMaps: () => ({
134
208
  first: null,
135
209
  prompt: "My production build publishes source maps, so anyone can read my app's original source code. Turn them off for production builds only (for Vite: build.sourcemap = false in vite.config), rebuild and redeploy. Don't change anything else.",
@@ -141,7 +215,8 @@ const P = {
141
215
  };
142
216
 
143
217
  // --- the check -----------------------------------------------------------------------------------
144
- export async function siteScan(target, { mine = false, fetcher = fetch, maxScripts = 40, maxBytes = 8 * 1024 * 1024 } = {}) {
218
+ export async function siteScan(target, { mine = false, fetcher = fetch, maxScripts = 400, maxBytes = 8 * 1024 * 1024, maxTotalBytes = 200 * 1024 * 1024, deadlineMs = 120000, scriptTimeoutMs = 15000 } = {}) {
219
+ const deadline = Date.now() + deadlineMs;
145
220
  const fetchOpts = (o = {}) => ({ max: maxBytes, ...o, fetcher });
146
221
  const url = safeUrl(/^https?:\/\//i.test(String(target).trim()) ? String(target).trim() : `https://${String(target).trim()}`);
147
222
  if (!url || !/^https?:$/.test(url.protocol) || !url.hostname.includes(".")) throw new Error(`"${target}" doesn't look like a web address`);
@@ -150,33 +225,76 @@ export async function siteScan(target, { mine = false, fetcher = fetch, maxScrip
150
225
 
151
226
  const page = await get(url.href, fetchOpts());
152
227
  if (!page.status || page.status >= 400) throw new Error(`could not load ${url.href} (${page.error || page.status})`);
153
- const origin = new URL(page.url || url.href).origin;
228
+ const pageType = page.headers?.get("content-type") || "";
229
+ if (pageType && !/html/i.test(pageType)) throw new Error(`${url.href} isn't a web page`);
230
+ if (DEAD_PAGE.test(page.text)) throw new Error(`could not load ${url.href} (404)`);
231
+ const pageUrl = page.url || url.href;
232
+ const origin = new URL(pageUrl).origin;
233
+ const site = siteKey(new URL(origin).hostname);
154
234
  const builder = detectBuilder(new URL(origin).host, page.text);
235
+ const isOwn = (href) => {
236
+ const h = new URL(href).hostname;
237
+ return siteKey(h) === site || HOSTING_CDN.test(h);
238
+ };
155
239
 
156
- // Every script the page loads from its own site, plus the scripts those import.
240
+ // Every script that belongs to the app: the ones the page loads, then whatever those mention, until none are left.
157
241
  const srcs = new Set();
158
- const collect = (html, base) => {
159
- for (const m of html.matchAll(/<script[^>]+src=["']([^"']+)["']/gi)) safeUrl(m[1], base) && srcs.add(safeUrl(m[1], base).href);
160
- for (const m of html.matchAll(/<link[^>]+href=["']([^"']+\.m?js)["']/gi)) safeUrl(m[1], base) && srcs.add(safeUrl(m[1], base).href);
242
+ const collect = (text, base) => {
243
+ for (const m of text.matchAll(SCRIPT_REF)) {
244
+ const u = resolveRef(m[1], base, origin);
245
+ if (u && /^https?:$/.test(u.protocol)) srcs.add(u.href);
246
+ }
161
247
  };
162
- collect(page.text, origin);
248
+ for (const m of page.text.matchAll(/<script[^>]+src=["']([^"']+)["']/gi)) safeUrl(m[1], pageUrl) && srcs.add(safeUrl(m[1], pageUrl).href);
249
+ for (const m of page.text.matchAll(/<link[^>]+href=["']([^"']+\.m?js(?:\?[^"']*)?)["']/gi)) safeUrl(m[1], pageUrl) && srcs.add(safeUrl(m[1], pageUrl).href);
250
+ collect(page.text, pageUrl);
251
+
163
252
  const bundles = [{ where: "the page itself", text: page.text }];
164
253
  const seen = new Set();
165
- // Two rounds: the scripts the page names, then the scripts those import. Six at a time.
166
- for (let pass = 0; pass < 2; pass++) {
167
- const batch = [...srcs].filter((src) => !seen.has(src) && new URL(src).origin === origin).slice(0, Math.max(0, maxScripts - seen.size));
254
+ let total = page.text.length;
255
+ let stopped = false;
256
+ let cut = 0;
257
+ let fetched = 0;
258
+ const retried = new Set();
259
+ const failed = new Set();
260
+ for (;;) {
261
+ const waiting = [...srcs].filter((src) => !seen.has(src) && isOwn(src));
262
+ if (!waiting.length) break;
263
+ const room = maxScripts - fetched;
264
+ if (room <= 0 || total >= maxTotalBytes || Date.now() > deadline) {
265
+ stopped = true;
266
+ break;
267
+ }
268
+ // Six at a time.
269
+ const batch = waiting.slice(0, Math.min(6, room));
168
270
  for (const src of batch) seen.add(src);
169
- for (let i = 0; i < batch.length; i += 6) {
170
- const got = await Promise.all(batch.slice(i, i + 6).map((src) => get(src, fetchOpts()).then((r) => ({ src, r }))));
171
- for (const { src, r } of got) {
172
- // Many hosts answer a missing file with the home page; that isn't a script.
173
- if (r.status !== 200 || /text\/html/i.test(r.headers?.get("content-type") || "")) continue;
174
- bundles.push({ where: new URL(src).pathname, text: r.text, url: src });
175
- for (const m of r.text.matchAll(/(?:import\(|from\s*)["'](\.{0,2}\/[^"']+\.m?js)["']/g)) safeUrl(m[1], src) && srcs.add(safeUrl(m[1], src).href);
271
+ fetched += batch.length;
272
+ const got = await Promise.all(batch.map((src) => get(src, fetchOpts({ timeout: scriptTimeoutMs })).then((r) => ({ src, r }))));
273
+ for (const { src, r } of got) {
274
+ // A file that wouldn't load isn't the same as a file that doesn't exist: try once more, then count it as unread.
275
+ if (r.status === 0 || r.status === 429 || r.status >= 500) {
276
+ if (retried.has(src)) failed.add(src);
277
+ else {
278
+ retried.add(src);
279
+ seen.delete(src);
280
+ }
281
+ continue;
176
282
  }
283
+ // Many hosts answer a missing file with the home page; that isn't a script.
284
+ if (r.status !== 200 || /text\/html/i.test(r.headers?.get("content-type") || "")) continue;
285
+ if (r.text.length >= maxBytes) cut++;
286
+ total += r.text.length;
287
+ bundles.push({ where: new URL(src).pathname, text: r.text, url: src });
288
+ collect(r.text, src);
177
289
  }
178
290
  }
291
+ const unread = [...srcs].filter((src) => !seen.has(src) && isOwn(src)).length + failed.size;
292
+ const scriptTags = [...page.text.matchAll(/<script[^>]+src=["']([^"']+)["']/gi)].map((m) => safeUrl(m[1], pageUrl)).filter((u) => u && /^https?:$/.test(u.protocol));
293
+ const elsewhere = scriptTags.filter((u) => !isOwn(u.href)).length;
294
+ // The page has scripts, but all of them live on another site, so its real code was never read.
295
+ const noCodeRead = bundles.length === 1 && elsewhere > 0;
179
296
 
297
+ let mapTries = 0;
180
298
  let supabase = null;
181
299
  let firebase = null;
182
300
  const keysSeen = new Set();
@@ -217,7 +335,9 @@ export async function siteScan(target, { mine = false, fetcher = fetch, maxScrip
217
335
  }
218
336
  const sm = b.url && b.text.match(/sourceMappingURL=([^\s'"]+\.map)/);
219
337
  const mapUrl = sm && safeUrl(sm[1], b.url)?.href;
220
- if (mapUrl && safeUrl(mapUrl).origin === origin && !findings.some((f) => f.id === "sourcemaps")) {
338
+ // A few tries are enough: an app either publishes its maps or it doesn't.
339
+ if (mapUrl && isOwn(mapUrl) && mapTries < 3 && !findings.some((f) => f.id === "sourcemaps")) {
340
+ mapTries++;
221
341
  // Check what comes back: hosts that answer every missing file with the home page would look "public" otherwise.
222
342
  const r = await get(mapUrl, fetchOpts({ max: 4096 }));
223
343
  if (r.status === 200 && /^\s*\{[\s\S]*"(version|mappings|sources)"/.test(r.text))
@@ -227,7 +347,11 @@ export async function siteScan(target, { mine = false, fetcher = fetch, maxScrip
227
347
 
228
348
  const database = supabase?.url && supabase.anon ? "Supabase" : firebase?.project ? "Firebase" : null;
229
349
  if (database && !mine)
230
- add({ id: "db:skipped", severity: "info", where: database, title: `Your ${database} database wasn't checked`, why: `This app uses ${database}. Greenlit can check which of its data anyone on the internet can read, but only on your own computer, for an app you own.`, fix: `Run \`npx greenlitlab ${url.host} --mine\` if this is your app.`, first: null, prompt: null });
350
+ add({ id: "db:skipped", severity: "info", where: database, title: `Your ${database} database wasn't checked`, why: `This app uses ${database}. Greenlit can check which of its data anyone on the internet can read, but only on your own computer, for an app you own.`, fix: `Run \`npx greenlitlab ${url.host} --mine\` if this is your app.`, first: null, prompt: null, checkPrompt: P.dbCheck(database) });
351
+ if (unread || cut)
352
+ add({ id: "coverage:partial", severity: "info", where: "your app's scripts", title: unread ? `${unread} of this app's scripts weren't read` : "Some of this app's scripts were too big to read to the end", why: `Greenlit read ${bundles.length - 1} scripts, but couldn't get through the rest in one check. A problem in those wouldn't show up here.`, fix: `Run \`npx greenlitlab ${url.host}\` on your computer, which reads them all.`, first: null, prompt: null });
353
+ if (noCodeRead)
354
+ add({ id: "coverage:none", severity: "info", where: "your app's scripts", title: "This app's code wasn't read", why: `All ${elsewhere} of its scripts load from other sites, and Greenlit can't tell which of them are yours. Only the page itself and its settings were checked.`, fix: "If your app loads its code from a site of its own, check that site's address too.", first: null, prompt: null });
231
355
 
232
356
  // Supabase: with the public anon key, which tables can anyone read?
233
357
  let tables = null;
@@ -255,6 +379,42 @@ export async function siteScan(target, { mine = false, fetcher = fetch, maxScrip
255
379
  }
256
380
  }
257
381
 
382
+ // Your own app only: files that should never be on a live site. A real .env has KEY=value lines; a real .git
383
+ // folder has a config file with [core]. Anything else (often the home page served for every path) doesn't count.
384
+ if (mine) {
385
+ for (const path of ["/.env", "/.env.local", "/.env.production"]) {
386
+ const r = await get(new URL(path, origin).href, fetchOpts({ max: 4096 }));
387
+ if (r.status === 200 && !/^\s*</.test(r.text) && /^[A-Z][A-Z0-9_]*=/m.test(r.text)) {
388
+ add({ id: `exposed:${path}`, severity: "critical", where: path, title: `Your ${path} file is public`, why: "This file usually holds every secret key the app uses, and anyone can download it.", fix: `Stop deploying ${path}, then revoke every key it contained.`, ...P.envFile(path) });
389
+ break;
390
+ }
391
+ }
392
+ const g = await get(new URL("/.git/config", origin).href, fetchOpts({ max: 4096 }));
393
+ if (g.status === 200 && /\[core\]/.test(g.text))
394
+ add({ id: "exposed:git", severity: "high", where: "/.git/", title: "Your code history (.git folder) is public", why: "Anyone can download your full source code and every past version of it, including keys that were committed once and later removed.", fix: "Deploy only the build output, never the .git folder.", ...P.gitDir() });
395
+ }
396
+
397
+ // Your own app only: Supabase settings that quietly make "signed-in users only" mean "anyone".
398
+ if (mine && supabase?.url && supabase.anon) {
399
+ const h = { apikey: supabase.anon, ...(supabase.anon.startsWith("eyJ") && { authorization: `Bearer ${supabase.anon}` }) };
400
+ const st = await get(`${supabase.url}/auth/v1/settings`, fetchOpts({ headers: h, max: 65536 }));
401
+ try {
402
+ const cfg = JSON.parse(st.text);
403
+ if (st.status === 200 && cfg.disable_signup === false && cfg.mailer_autoconfirm === true)
404
+ add({ id: "supabase:open-signup", severity: "high", where: "Supabase Auth settings", title: "Anyone can sign up with any email, without confirming it", why: "Rules that only check \"is the user signed in?\" protect nothing: a stranger can make an account in seconds, even with someone else's email address.", fix: "Turn on email confirmation in Supabase Auth, and make every policy check who owns the row, not just that someone is signed in.", ...P.signup() });
405
+ } catch {}
406
+ // Storage: which common buckets list their files to anyone? Asks for one file name, never the file.
407
+ for (const bucket of ["avatars", "uploads", "files", "documents", "images", "attachments", "receipts", "invoices", "private"]) {
408
+ const r = await get(`${supabase.url}/storage/v1/object/list/${bucket}`, fetchOpts({ method: "POST", headers: { ...h, "content-type": "application/json" }, body: JSON.stringify({ prefix: "", limit: 1, offset: 0 }), max: 65536 }));
409
+ let n = 0;
410
+ try {
411
+ n = Array.isArray(JSON.parse(r.text)) ? JSON.parse(r.text).length : 0;
412
+ } catch {}
413
+ if (r.status === 200 && n > 0)
414
+ add({ id: `supabase:storage:${bucket}`, severity: /receipt|invoice|document|private|attachment/.test(bucket) ? "critical" : "high", where: `Supabase storage bucket "${bucket}"`, title: `Anyone can list the files in the storage bucket "${bucket}"`, why: "Strangers can see every file name in it and, if the files are readable too, download them. Greenlit asked for one file name and opened nothing.", fix: `In Supabase → Storage → Policies, limit "${bucket}" so users list and read only their own files.`, ...P.storage(bucket) });
415
+ }
416
+ }
417
+
258
418
  // Firebase: is the Realtime Database or a common Firestore collection open to anyone?
259
419
  let firebaseOpen = null;
260
420
  if (mine && firebase?.project) {
@@ -290,19 +450,36 @@ export async function siteScan(target, { mine = false, fetcher = fetch, maxScrip
290
450
  if (!page.headers?.get("content-security-policy") && !/http-equiv=["']Content-Security-Policy/i.test(page.text))
291
451
  add({ id: "csp", severity: "low", where: "response headers", title: "No Content-Security-Policy", why: "If an attacker gets a script into the page (through a comment, a profile field or a dependency), nothing stops it from sending your users' data out.", fix: "Add a Content-Security-Policy header in your host's settings.", ...P.csp([...thirdParty].slice(0, 6)) });
292
452
 
453
+ const csp = page.headers?.get("content-security-policy") || "";
454
+ if (!page.headers?.get("x-frame-options") && !/frame-ancestors/i.test(csp))
455
+ add({ id: "framing", severity: "low", where: "response headers", title: "Other sites can put your app in a frame", why: "A malicious page can show your app inside an invisible frame and trick your users into clicking buttons they can't see (clickjacking).", fix: "Add the header Content-Security-Policy: frame-ancestors 'self' (or X-Frame-Options: DENY).", ...P.framing() });
456
+
293
457
  const penalty = findings.reduce((a, f) => a + SEVERITY[f.severity], 0);
294
458
  const score = Math.max(0, 100 - penalty);
295
- const grade = score >= 90 ? "A" : score >= 75 ? "B" : score >= 60 ? "C" : score >= 40 ? "D" : "F";
459
+ // With none of the app's code read and nothing serious seen, there's no honest grade to give.
460
+ const ungraded = noCodeRead && penalty < SEVERITY.high;
461
+ const grade = ungraded ? "?" : score >= 90 ? "A" : score >= 75 ? "B" : score >= 60 ? "C" : score >= 40 ? "D" : "F";
462
+ // A good grade says only what was looked at, so it can't be read as "the database is safe too".
463
+ const good = grade === "A" || grade === "B";
464
+ const incomplete = unread > 0 || cut > 0;
465
+ const verdict = ungraded
466
+ ? "Not graded: Greenlit couldn't read this app's code."
467
+ : good && database && !mine
468
+ ? `Nothing serious in the ${incomplete ? "code Greenlit read" : "code"}. Your database still needs checking.`
469
+ : good && incomplete
470
+ ? "Nothing serious in the code Greenlit read. Some of it wasn't read."
471
+ : VERDICT[grade];
296
472
  const order = ["critical", "high", "medium", "low", "info"];
297
473
  findings.sort((a, b) => order.indexOf(a.severity) - order.indexOf(b.severity));
298
474
  return {
299
475
  url: origin,
300
476
  builder,
301
- score,
477
+ score: ungraded ? null : score,
302
478
  grade,
303
- verdict: VERDICT[grade],
479
+ verdict,
304
480
  mine,
305
481
  scripts: bundles.length - 1,
482
+ scriptsUnread: unread,
306
483
  supabase: supabase ? { project: supabase.ref, checked: mine, readable: tables } : null,
307
484
  firebase: firebase ? { project: firebase.project, checked: mine, readable: firebaseOpen } : null,
308
485
  findings,
@@ -310,6 +487,15 @@ export async function siteScan(target, { mine = false, fetcher = fetch, maxScrip
310
487
  };
311
488
  }
312
489
 
490
+ // Every fix prompt in one, worst first, for people who'd rather paste once. The builder still gets one
491
+ // problem at a time, and checks in after each.
492
+ export function allPrompts(r) {
493
+ const list = r.findings.filter((f) => f.prompt);
494
+ if (!list.length) return "";
495
+ const head = `My app has ${list.length} security problem${list.length > 1 ? "s" : ""} to fix. Work through them in this order, one at a time. After each one, tell me what you changed before moving on. Don't change anything unrelated.`;
496
+ return [head, ...list.map((f, i) => `${i + 1}. ${f.title}.\n${f.prompt}`)].join("\n\n");
497
+ }
498
+
313
499
  export const VERDICT = {
314
500
  A: "Nothing serious a stranger can use against you.",
315
501
  B: "No open doors, a few loose ends.",
@@ -352,10 +538,10 @@ export function renderSite(r, change, { color = true, mine = r.mine } = {}) {
352
538
  const k = (code) => (s) => (color ? `\x1b[${code}m${s}\x1b[0m` : s);
353
539
  const red = k("31"), green = k("32"), yellow = k("33"), dim = k("2"), bold = k("1"), cyan = k("36");
354
540
  const col = { critical: red, high: red, medium: yellow, low: dim, info: dim };
355
- const gcol = r.score >= 75 ? green : r.score >= 55 ? yellow : red;
541
+ const gcol = r.grade === "A" || r.grade === "B" ? green : r.grade === "C" || r.grade === "?" ? yellow : red;
356
542
  const L = [];
357
543
  L.push("", `${bold("Greenlit check")} · ${r.url}${r.builder ? ` · built with ${r.builder}` : ""} · ${r.scripts} scripts read${r.supabase ? " · Supabase" : ""}${r.firebase ? " · Firebase" : ""}`, "");
358
- L.push(` Grade ${gcol(bold(r.grade))} ${gcol(`${r.score}/100`)} ${r.verdict}`);
544
+ L.push(` Grade ${gcol(bold(r.grade))} ${r.score == null ? "" : `${gcol(`${r.score}/100`)} `}${r.verdict}`);
359
545
  if (change) {
360
546
  const arrow = change.after.score > change.before.score ? green : change.after.score < change.before.score ? red : dim;
361
547
  L.push(` ${arrow(`Was ${change.before.grade} (${change.before.score}) on ${change.since.slice(0, 10)}, now ${change.after.grade} (${change.after.score}).`)}`);
@@ -374,12 +560,18 @@ export function renderSite(r, change, { color = true, mine = r.mine } = {}) {
374
560
  if (f.prompt) {
375
561
  L.push(` ${cyan(`Then paste this into ${r.pasteInto}:`)}`);
376
562
  L.push(wrap(f.prompt, 84, ` ${dim("│")} `));
377
- } else L.push(wrap(`${green("Next:")} ${f.fix}`, 88, " "));
563
+ } else {
564
+ L.push(wrap(`${green("Next:")} ${f.fix}`, 88, " "));
565
+ if (f.checkPrompt) {
566
+ L.push(` ${cyan(`Or paste this into ${r.pasteInto} to have it check:`)}`);
567
+ L.push(wrap(f.checkPrompt, 84, ` ${dim("│")} `));
568
+ }
569
+ }
378
570
  L.push("");
379
571
  }
380
572
  L.push(dim(`Read only what the site serves to every visitor${mine ? "; database checked with counts and names only, never data" : ""}.`));
381
573
  if (n) {
382
- L.push(dim(`Fix the red items first, one prompt at a time. Copy one prompt: npx greenlitlab ${new URL(r.url).host}${mine ? " --mine" : ""} --prompt 1 | pbcopy`));
574
+ L.push(dim(`Fix the red items first, one prompt at a time. Copy one prompt: npx greenlitlab ${new URL(r.url).host}${mine ? " --mine" : ""} --prompt 1 | pbcopy (or --prompt all for every fix in one)`));
383
575
  L.push(dim("After the fixes are live, run this same command again: it shows what got fixed."));
384
576
  }
385
577
  return L.join("\n");
package/src/mcp.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  // Greenlit as an MCP server (stdio, newline-delimited JSON-RPC), so an agent in Claude, Cursor or VS Code
2
2
  // can grade the app it just deployed and apply the fix prompts itself.
3
3
  import readline from "node:readline";
4
- import { siteScan, compare } from "./grade.mjs";
4
+ import { siteScan, compare, allPrompts } from "./grade.mjs";
5
5
 
6
6
  const TOOLS = [
7
7
  {
8
8
  name: "greenlit_check",
9
9
  description:
10
- "Grade a deployed web app (built with Lovable, Bolt, v0, Replit, Emergent or by hand) A to F for what a stranger can use against it: secret keys shipped in its JavaScript, a Supabase service_role key in the browser, source maps, missing security headers. Every finding has a plain-English reason and a fix prompt. Reads only what the site serves to every visitor. Call it again after a fix: `change` shows what got fixed. For database checks on the user's own app, have them run `npx greenlitlab <url> --mine`.",
10
+ "Grade a deployed web app (built with Lovable, Bolt, v0, Replit, Emergent or by hand) A to F for what a stranger can use against it: secret keys shipped in its JavaScript (Stripe, OpenAI, OpenRouter, Supabase secret keys and 25 more kinds), a Supabase service_role key in the browser, source maps, clickjacking and missing security headers. Every finding has a plain-English reason and a fix prompt; `allFixes` has every fix in one prompt, worst first. Reads only what the site serves to every visitor. Call it again after a fix: `change` shows what got fixed. For the user's own app, have them run `npx greenlitlab <url> --mine`: it also checks which database tables and storage buckets anyone can read, open sign-up, and public .env or .git files.",
11
11
  inputSchema: { type: "object", properties: { url: { type: "string", description: "The app's address, for example myapp.lovable.app" } }, required: ["url"], additionalProperties: false },
12
12
  annotations: { readOnlyHint: true, openWorldHint: true },
13
13
  },
@@ -21,7 +21,7 @@ async function call(name, args = {}) {
21
21
  // Remembered for this session only, so a second call shows what the fixes changed.
22
22
  const change = compare(last.get(result.url), result);
23
23
  last.set(result.url, { at: new Date().toISOString(), score: result.score, grade: result.grade, findings: result.findings.map(({ id, severity, title }) => ({ id, severity, title })) });
24
- return { ...result, change };
24
+ return { ...result, change, allFixes: allPrompts(result) };
25
25
  }
26
26
 
27
27
  export function serve({ version, input = process.stdin, output = process.stdout } = {}) {
package/src/severity.mjs CHANGED
@@ -1,2 +1,2 @@
1
- // How much each finding takes off a 100-point score. "info" is a note, not a problem: it costs nothing.
2
- export const SEVERITY = { critical: 40, high: 15, medium: 5, low: 1, info: 0 };
1
+ // How much each finding takes off a 100-point score. One critical problem means D at best, one high means C at best. "info" is a note, not a problem: it costs nothing.
2
+ export const SEVERITY = { critical: 45, high: 30, medium: 5, low: 1, info: 0 };