lilith-skill 0.0.0-stage → 0.1.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.
Files changed (40) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +134 -2
  3. package/THIRD_PARTY_NOTICES.md +79 -0
  4. package/bin/lilith.mjs +147 -0
  5. package/package.json +43 -4
  6. package/skills/lilith/SKILL.md +61 -0
  7. package/skills/lilith/agents/openai.yaml +4 -0
  8. package/skills/lilith/checks/firebase_check.md +45 -0
  9. package/skills/lilith/checks/supabase_check.sql +211 -0
  10. package/skills/lilith/guides/cleanup-code.md +56 -0
  11. package/skills/lilith/guides/cleanup-ui.md +54 -0
  12. package/skills/lilith/guides/fixes/S1.md +6 -0
  13. package/skills/lilith/guides/fixes/S10.md +3 -0
  14. package/skills/lilith/guides/fixes/S11.md +3 -0
  15. package/skills/lilith/guides/fixes/S12.md +3 -0
  16. package/skills/lilith/guides/fixes/S13.md +3 -0
  17. package/skills/lilith/guides/fixes/S14.md +9 -0
  18. package/skills/lilith/guides/fixes/S2.md +15 -0
  19. package/skills/lilith/guides/fixes/S3.md +25 -0
  20. package/skills/lilith/guides/fixes/S4.md +11 -0
  21. package/skills/lilith/guides/fixes/S5.md +3 -0
  22. package/skills/lilith/guides/fixes/S6.md +7 -0
  23. package/skills/lilith/guides/fixes/S7.md +16 -0
  24. package/skills/lilith/guides/fixes/S8.md +11 -0
  25. package/skills/lilith/guides/fixes/S9.md +3 -0
  26. package/skills/lilith/guides/fixing.md +9 -0
  27. package/skills/lilith/guides/security-core.md +66 -0
  28. package/skills/lilith/guides/server.md +73 -0
  29. package/skills/lilith/guides/stacks/ai.md +14 -0
  30. package/skills/lilith/guides/stacks/firebase.md +13 -0
  31. package/skills/lilith/guides/stacks/stripe.md +13 -0
  32. package/skills/lilith/guides/stacks/supabase.md +31 -0
  33. package/skills/lilith/guides/ui/charts.md +10 -0
  34. package/skills/lilith/guides/ui/examples.md +30 -0
  35. package/skills/lilith/guides/ui/surface.md +11 -0
  36. package/skills/lilith/scripts/count_tells.py +384 -0
  37. package/skills/lilith/scripts/lilith_scan.py +750 -0
  38. package/skills/lilith/templates/report.md +64 -0
  39. package/src/agents.mjs +54 -0
  40. package/src/install.mjs +71 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 YOUR NAME
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,135 @@
1
- # Temporary Holding Version
1
+ # Lilith
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ ```text
4
+ owUzOoMdQwdd0XXXYJJUUzurt\(){{}}}[[[[[[[]]]]]??????--------___+~>!" '"l><~++~>!;`
5
+ dJnfuZakZXYYCJnt\\/tfncYCLJzn/(){}[]]????????---------___++~<iI` 'I+][[]_i;`
6
+ OzjtfnCpkOYcunvvj\()1{11)(/jnczcr|}[??---------_____+++~~>i;' ^i+-+!,.
7
+ OYvnnncQk#hobOXvczcvx/|){{}}}{)\/t\{]?-----____++++~<>i;" 'Iii;' ";:,":l>-{)+:.
8
+ bbkao*#W8@$$$$$%&M#*#dCuf\(11{{}{{1){]-____++++~~<>!:. .":;". `!}uQQOpoM8BB&adZCznf|{{
9
+ LCQmh%$$$$$BB$$$$B%%$$$%aZXx/(){{}[[]?__++++~~<>i;' ^,,"' ^i}xLd*&B$$$$$$$BMW%$$$&dz([
10
+ pdo8$$@MdZQQk%@8#d0QZhW@$$$WbCr|1[]?-_+++~~~>iI^ . :-fLkM88#kqboM&&M*hwzxnJp#B$Wb0
11
+ *MB$$Bk0Yzczp%$8&Moa#&Mohoo*MWomv)]_+~~<<>i!;^ >\Jd#WWM&&M#8$$%&MokOu{}})jQMBWb0
12
+ pmwb#Wo0x\((zb%&MohkkwYjxwpUjvdhwYt]<>!I,. I]fUpW&d0OdQf[upaao#&&0['."]nQLC/l'
13
+ pqOJC0mQv|1{\vqkmJczUJLQJUOqdkdQUc(~: '!1\/vkkqZLcUUznnnrzYqZ1 +t|-"
14
+ okOznjxYLz/1{{|YLnn/t/tftrjncvx1~;' "|r)|()(|\|(|\/uj> l<!
15
+ &Wh0n\)(\junt)1)\xc/~I!<+?{{(< '<?+:'`^;!+}}, :: '<
16
+ 8&MhOYr\)))(|tft\||(((|(1_;. '''.. ' !_
17
+ %88&*wXunx/()11{11)1}?<, ":'
18
+ 8888&Mh0nttjjj/)1}]_!'
19
+ ```
20
+
21
+ Lilith is an agent skill that checks apps built with AI tools for the security holes those tools tend to leave: secret keys shipped to the browser, Supabase tables without row level security, API routes that never check who is calling, payment webhooks nobody verifies. It explains each finding in plain language and fixes the ones you approve. After security it can also clean up leftover AI code and UI.
22
+
23
+ ## Install
24
+
25
+ ```bash
26
+ npx lilith-skill
27
+ ```
28
+
29
+ The installer finds the coding agents on your machine (Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf) and copies the skill to where each one looks for skills. Run it again to update. It needs Node.js 18 or later. The quick scan also uses Python 3.8+ when it is installed; without Python the agent reads the code instead.
30
+
31
+ ```bash
32
+ npx lilith-skill --agent claude # one agent only
33
+ npx lilith-skill --project # install into the current project
34
+ npx lilith-skill scan . # run the quick scan yourself
35
+ npx lilith-skill uninstall
36
+ ```
37
+
38
+ Other tools that support [Agent Skills](https://agentskills.io) can install it with `npx skills add Sunnik21/lilith -g`.
39
+
40
+ If you build in Lovable, Bolt or v0 and have no terminal, paste the prompt from [PROMPT.md](PROMPT.md) into the project chat instead.
41
+
42
+ ## Usage
43
+
44
+ Type `/lilith` in your agent, or ask in plain words: "check my app before launch", "is my app safe?", "clean up my landing page", "help me secure my VPS".
45
+
46
+ Lilith reports first and changes nothing until you agree. A report looks like this:
47
+
48
+ ```
49
+ Live database: checked (Supabase query results pasted)
50
+ 🔴 Critical 1 🟠 High 1 🟡 Medium 2 ⚪ Cleanup 9
51
+
52
+ 🔴 1. Your OpenAI key is visible to every visitor (S2)
53
+ What: NEXT_PUBLIC_OPENAI_KEY in src/lib/ai.ts:4 is sent to the browser.
54
+ Why it matters: anyone can copy it and spend your OpenAI budget.
55
+ Fix: move the call to a server route (I can do this), then replace the key
56
+ in the OpenAI dashboard (only you can do this).
57
+
58
+ Want me to fix the 🔴 ones now?
59
+ ```
60
+
61
+ ## Why
62
+
63
+ - CVE-2025-48757 (CVSS 9.3, critical): insufficient Row Level Security in apps generated by Lovable "allows remote unauthenticated attackers to read or write to arbitrary database tables of generated sites" ([NVD](https://nvd.nist.gov/vuln/detail/CVE-2025-48757)). Lovable disputes the CVE, saying each customer is responsible for protecting their app's data.
64
+ - The researcher's scan "identified 303 endpoints across 170 projects (approximately 10.3% of the 1645 analyzed) with inadequate RLS settings" ([Matt Palmer, May 29, 2025](https://mattpalmer.io/posts/statement-on-CVE-2025-48757/)).
65
+ - UpGuard "found 16,326 Supabase databases exposing readable tables" out of about 300,000 domains using Supabase, and 55.8% of them held personal information. Its explanation: "Tables created programmatically through the API, which is how coding agents interact with Supabase, do not enable RLS by default" ([UpGuard, September 23, 2026](https://www.upguard.com/blog/everything-everywhere-systemic-data-exposure-in-supabase-apps)).
66
+
67
+ Code alone can't show whether a live database is open. For Supabase, Lilith gives you a read-only query to run in the SQL Editor; it reads settings, not your data. For Firebase it asks for your deployed rules.
68
+
69
+ Lilith has no account and no server. Your code goes only to the AI agent you already use.
70
+
71
+ ## Checks
72
+
73
+ | ID | Check | Example |
74
+ |---|---|---|
75
+ | S1 | Secret keys in code or git | `sk_live_...` in a file, `.env` committed |
76
+ | S2 | Secrets sent to the browser | `NEXT_PUBLIC_OPENAI_KEY`, OpenAI called from React |
77
+ | S3 | Database open to everyone | Supabase RLS off, Firebase `allow read, write: if true` (plus the live database check) |
78
+ | S4 | Endpoints with no login check | `/api/notes` writes without checking the user |
79
+ | S5 | Seeing other users' data | change `/invoices/41` to `/42` |
80
+ | S6 | Trusting the browser | price or `isAdmin` taken from the request |
81
+ | S7 | Fake payments | Stripe webhook without signature check |
82
+ | S8 | No limits | AI endpoint anyone can call 100,000 times |
83
+ | S9 | Unsafe HTML | `dangerouslySetInnerHTML` with user text |
84
+ | S10 | File uploads | private files in a public bucket |
85
+ | S11 | AI features | secrets in the system prompt, AI tools with too much power |
86
+ | S12 | Debug doors | `/api/seed`, `admin@admin.com` / `admin123` |
87
+ | S13 | Old packages | critical `npm audit` results |
88
+ | S14 | CORS and headers | any site can call your API as the logged-in user |
89
+ | C1–C8 | Code cleanup | logs, fake data, dead buttons, giant files |
90
+ | U1–U20 | UI and copy | eyebrow labels, fake badges, gradients, "seamless", "elevate" |
91
+ | VPS | Own server | firewall, SSH keys, closed database ports |
92
+
93
+ Each check, with how to spot and fix it, is in [skills/lilith/guides](skills/lilith/guides).
94
+
95
+ ## Accuracy
96
+
97
+ The benchmark in [bench/](bench/) has three small apps written the way AI tools write them: Vite + React + Supabase, Next.js + Supabase + Stripe + OpenAI, and Express + Prisma + JWT. Between them they hold 31 planted security bugs and 17 decoys, things that look wrong but are fine, such as the Supabase anon key or `console.error` in an error handler. Each app also has a fixed version.
98
+
99
+ Full skill, one run per app, claude-opus-5-5 via `claude -p`, 2026-11-20 ([bench/RESULTS.md](bench/RESULTS.md)):
100
+
101
+ - Found all 31 planted bugs, including the ones no regex can see: users reading each other's data, prices trusted from the browser, a paid plan unlocked from `?success=true`.
102
+ - Flagged none of the 17 decoys.
103
+ - Raised 3 false alarms, all outdated-package warnings (S13), partly because the benchmark's lockfiles are empty.
104
+ - Matched our severity on 24 of 31; when it differed, it usually rated one level higher.
105
+
106
+ That is one run per app on 31 bugs in three small apps. Results vary between runs and models.
107
+
108
+ The quick scan on its own (`lilith_scan.py`, deterministic, runs in CI):
109
+
110
+ | | Before this benchmark | Now |
111
+ |---|---|---|
112
+ | Planted bugs found | 16/31 (52%) | 27/31 (87%) |
113
+ | Leads that were real bugs | 22/28 (79%) | 36/37 (97%) |
114
+ | Decoys flagged | 3/17 | 1/17 |
115
+ | Critical/high leads on the fixed apps | 3 | 0 |
116
+
117
+ The newer scanner patterns were written after looking at these apps, so the "Now" column is optimistic for other projects. The scanner still misses update policies that let users change their own `is_admin` or `plan` column, public storage buckets created in SQL, a paid plan unlocked in the browser, and secrets inside AI system prompts. It also flags credentialed CORS when the app uses no cookies. Those cases need reading, which is why the scan is only the first step.
118
+
119
+ To reproduce: `python3 bench/run_scanner.py` for the scanner, or `python3 bench/run_agent.py` for the full skill (needs the `claude` CLI, about $1.50 per run).
120
+
121
+ ## Limits
122
+
123
+ Lilith is a first check, not a penetration test. It reads your code and can't see settings that live only in your dashboards; it tells you what to check there. It never says an app is secure, only what it checked. If your app handles payments, health data or other sensitive data, get a human review as well.
124
+
125
+ ## Contributing
126
+
127
+ Each check is a short section in a Markdown file. To add one:
128
+
129
+ 1. Add a section to the right guide in `skills/lilith/guides/` with Spot it, Why and Fix.
130
+ 2. If a regex can find it, add a pattern to `skills/lilith/scripts/lilith_scan.py` and a case to `tests/test_scan.py`.
131
+ 3. Run `python3 tests/test_scan.py` and `python3 bench/run_scanner.py`. The scanner score must not drop.
132
+
133
+ ## License
134
+
135
+ MIT. See [LICENSE](LICENSE) and [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
@@ -0,0 +1,79 @@
1
+ # Third-party notices
2
+
3
+ Portions of this project are derived from MIT-licensed works. Their licenses follow.
4
+
5
+ ```
6
+ MIT License
7
+
8
+ Copyright (c) 2026 Felipe Basurto
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+ ```
28
+
29
+ ---
30
+
31
+ ```
32
+ MIT License
33
+
34
+ Copyright (c) 2025-2026 Cloudflare, Inc.
35
+
36
+ Permission is hereby granted, free of charge, to any person obtaining a copy
37
+ of this software and associated documentation files (the "Software"), to deal
38
+ in the Software without restriction, including without limitation the rights
39
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
40
+ copies of the Software, and to permit persons to whom the Software is
41
+ furnished to do so, subject to the following conditions:
42
+
43
+ The above copyright notice and this permission notice shall be included in all
44
+ copies or substantial portions of the Software.
45
+
46
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
48
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
49
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
50
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
51
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
52
+ SOFTWARE.
53
+ ```
54
+
55
+ ---
56
+
57
+ ```
58
+ MIT License
59
+
60
+ Copyright (c) 2026 Tibobfd
61
+
62
+ Permission is hereby granted, free of charge, to any person obtaining a copy
63
+ of this software and associated documentation files (the "Software"), to deal
64
+ in the Software without restriction, including without limitation the rights
65
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
66
+ copies of the Software, and to permit persons to whom the Software is
67
+ furnished to do so, subject to the following conditions:
68
+
69
+ The above copyright notice and this permission notice shall be included in all
70
+ copies or substantial portions of the Software.
71
+
72
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
73
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
74
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
75
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
76
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
77
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
78
+ SOFTWARE.
79
+ ```
package/bin/lilith.mjs ADDED
@@ -0,0 +1,147 @@
1
+ #!/usr/bin/env node
2
+ // Lilith installer: puts the skill where your coding agents find it.
3
+ import { spawnSync } from "node:child_process";
4
+ import { readFileSync, realpathSync } from "node:fs";
5
+ import { homedir } from "node:os";
6
+ import { dirname, join } from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+ import { parseArgs } from "node:util";
9
+
10
+ import { agentTable } from "../src/agents.mjs";
11
+ import { installTo, planTargets, selectAgents, uninstallFrom, SKILL_NAME } from "../src/install.mjs";
12
+
13
+ const ROOT = join(dirname(fileURLToPath(import.meta.url)), "..");
14
+ const SKILL_DIR = join(ROOT, "skills", SKILL_NAME);
15
+ const SCANNER = join(SKILL_DIR, "scripts", "lilith_scan.py");
16
+ const AGENT_IDS = Object.keys(agentTable({}, "~"));
17
+
18
+ const HELP = `Lilith: security check for vibecoded apps
19
+
20
+ Usage:
21
+ npx lilith-skill install for every agent found on this machine
22
+ npx lilith-skill install [opts] same, with options
23
+ npx lilith-skill uninstall remove it again
24
+ npx lilith-skill scan [path] run the quick scan (needs Python 3.8+)
25
+ npx lilith-skill agents list supported agents and where they look
26
+
27
+ Options:
28
+ -a, --agent <id> only this agent (repeatable): ${AGENT_IDS.join(", ")}
29
+ -p, --project install into the current project instead of your home folder
30
+ -f, --force replace a folder named "${SKILL_NAME}" that is not Lilith
31
+ -h, --help show this help
32
+ -v, --version show the version
33
+
34
+ Then open your project and tell your AI /${SKILL_NAME}.`;
35
+
36
+ const OPTIONS = {
37
+ agent: { type: "string", short: "a", multiple: true, default: [] },
38
+ project: { type: "boolean", short: "p", default: false },
39
+ force: { type: "boolean", short: "f", default: false },
40
+ help: { type: "boolean", short: "h", default: false },
41
+ version: { type: "boolean", short: "v", default: false },
42
+ };
43
+
44
+ function version() {
45
+ return JSON.parse(readFileSync(join(ROOT, "package.json"), "utf8")).version;
46
+ }
47
+
48
+ function splitAgents(values) {
49
+ return values.flatMap((v) => v.split(",")).map((v) => v.trim()).filter(Boolean);
50
+ }
51
+
52
+ function describe(result) {
53
+ const where = `${result.dir} (${result.agents.join(", ")})`;
54
+ const reason = result.reason ? `: ${result.reason}` : "";
55
+ return ` ${result.status.padEnd(9)} ${where}${reason}`;
56
+ }
57
+
58
+ function targetsFor(opts, ctx) {
59
+ const table = agentTable(ctx.env, ctx.home);
60
+ const ids = selectAgents(table, splitAgents(opts.agent));
61
+ if (ids.length === 0) {
62
+ ctx.out.error(
63
+ "No coding agent found in your home folder.\n" +
64
+ `Pick one: npx lilith-skill --agent claude (known: ${AGENT_IDS.join(", ")})`
65
+ );
66
+ return null;
67
+ }
68
+ return planTargets(table, ids, { project: opts.project, cwd: ctx.cwd });
69
+ }
70
+
71
+ function runInstall(opts, ctx) {
72
+ const targets = targetsFor(opts, ctx);
73
+ if (!targets) return 1;
74
+ const results = targets.map((t) => installTo(SKILL_DIR, t, { force: opts.force }));
75
+ ctx.out.log(`Lilith ${version()}`);
76
+ results.forEach((r) => ctx.out.log(describe(r)));
77
+ const ok = results.some((r) => r.status !== "skipped");
78
+ if (ok) ctx.out.log(`\nDone. Open your project and tell your AI /${SKILL_NAME}`);
79
+ return ok ? 0 : 1;
80
+ }
81
+
82
+ function runUninstall(opts, ctx) {
83
+ const targets = targetsFor(opts, ctx);
84
+ if (!targets) return 1;
85
+ targets.map(uninstallFrom).forEach((r) => ctx.out.log(describe(r)));
86
+ return 0;
87
+ }
88
+
89
+ function runAgents(ctx) {
90
+ const table = agentTable(ctx.env, ctx.home);
91
+ for (const [id, a] of Object.entries(table)) {
92
+ ctx.out.log(` ${id.padEnd(9)} ${a.name.padEnd(15)} ${a.globalDir} (project: ${a.projectDir})`);
93
+ }
94
+ return 0;
95
+ }
96
+
97
+ function runScan(args, ctx) {
98
+ const candidates = process.platform === "win32" ? ["py", "python", "python3"] : ["python3", "python"];
99
+ for (const py of candidates) {
100
+ const res = spawnSync(py, [SCANNER, ...args], { stdio: "inherit" });
101
+ if (res.error?.code === "ENOENT") continue;
102
+ if (res.error) {
103
+ ctx.out.error(`Could not run ${py}: ${res.error.message}`);
104
+ return 1;
105
+ }
106
+ return res.status ?? 1;
107
+ }
108
+ ctx.out.error(
109
+ "The quick scan needs Python 3.8+ (python.org). Without it, /lilith still works: the agent checks by reading."
110
+ );
111
+ return 1;
112
+ }
113
+
114
+ function dispatch(command, rest, ctx) {
115
+ if (command === "scan") return runScan(rest, ctx);
116
+ const opts = parseArgs({ args: rest, options: OPTIONS, allowPositionals: false }).values;
117
+ if (opts.help || command === "help") return ctx.out.log(HELP), 0;
118
+ if (opts.version) return ctx.out.log(version()), 0;
119
+ if (command === "install") return runInstall(opts, ctx);
120
+ if (command === "uninstall") return runUninstall(opts, ctx);
121
+ if (command === "agents") return runAgents(ctx);
122
+ ctx.out.error(`Unknown command: ${command}\n\n${HELP}`);
123
+ return 2;
124
+ }
125
+
126
+ export function main(argv, overrides = {}) {
127
+ const ctx = { env: process.env, home: homedir(), cwd: process.cwd(), out: console, ...overrides };
128
+ const words = argv.length === 0 || argv[0].startsWith("-") ? ["install", ...argv] : argv;
129
+ const [command, ...rest] = words;
130
+ try {
131
+ return dispatch(command, rest, ctx);
132
+ } catch (err) {
133
+ const usage = err.code?.startsWith("ERR_PARSE_ARGS") ? `\n\n${HELP}` : "";
134
+ ctx.out.error(`Error: ${err.message}${usage}`);
135
+ return usage ? 2 : 1;
136
+ }
137
+ }
138
+
139
+ function isEntryPoint() {
140
+ try {
141
+ return realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url));
142
+ } catch {
143
+ return false;
144
+ }
145
+ }
146
+
147
+ if (isEntryPoint()) process.exitCode = main(process.argv.slice(2));
package/package.json CHANGED
@@ -1,6 +1,45 @@
1
1
  {
2
2
  "name": "lilith-skill",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "Security check for vibecoded apps: an Agent Skill for Claude Code, Codex, Cursor, Copilot, Gemini CLI and more. Finds leaked keys, open Supabase/Firebase databases and missing login checks, in plain words.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/Sunnik21/lilith.git"
8
+ },
9
+ "homepage": "https://github.com/Sunnik21/lilith#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/Sunnik21/lilith/issues"
12
+ },
13
+ "type": "module",
14
+ "bin": {
15
+ "lilith-skill": "bin/lilith.mjs"
16
+ },
17
+ "files": [
18
+ "bin/",
19
+ "src/",
20
+ "skills/lilith/",
21
+ "!**/__pycache__/",
22
+ "!**/*.pyc",
23
+ "!**/.DS_Store",
24
+ "THIRD_PARTY_NOTICES.md"
25
+ ],
26
+ "scripts": {
27
+ "test": "node --test tests/*.test.mjs",
28
+ "test:py": "python3 tests/test_scan.py && python3 tests/test_supabase_check.py"
29
+ },
30
+ "engines": {
31
+ "node": ">=18.3"
32
+ },
33
+ "keywords": [
34
+ "agent-skill",
35
+ "skills",
36
+ "claude-code",
37
+ "codex",
38
+ "cursor",
39
+ "security",
40
+ "supabase",
41
+ "firebase",
42
+ "vibecoding"
43
+ ],
44
+ "license": "MIT"
45
+ }
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: lilith
3
+ description: Security check for vibecoded apps, in plain words for beginners. Finds leaked API keys, open Supabase or Firebase databases, missing login checks and unverified payments, then cleans up AI mess. Use when the user says "lilith", "check my app", "is my app safe", "security check", "audit", "clean up", "unslop", "before launch", or asks to secure a VPS.
4
+ ---
5
+
6
+ # Lilith: security check for vibecoded apps
7
+
8
+ You help someone launch an app they built with AI, usually a non-developer. Be a calm senior friend: find what is dangerous, explain it simply, fix it with permission.
9
+
10
+ **Talk:** the user's language, plain words (explain a technical term once); for every problem **what's wrong, why it matters (one real consequence), how to fix**; most dangerous first; no scaring or shaming; never "your app is secure", say what you checked; short messages.
11
+
12
+ ## Modes
13
+
14
+ | The user says | Mode |
15
+ |---|---|
16
+ | "/lilith", "check my app", "is it safe", "audit", "ready to launch?" | **Security** (default): code + live database, report, one question |
17
+ | "/lilith full", "check everything", "security and cleanup" | **Full**: security, then code cleanup, then UI and copy |
18
+ | "/lilith clean", "clean up", "unslop", "looks AI-made" | **Cleanup** only (code, then UI and copy) |
19
+ | "/lilith server", "VPS", "Hetzner", "self-host" | **Server**: follow guides/server.md |
20
+
21
+ Cleanup runs only when asked.
22
+
23
+ ## Steps
24
+
25
+ 1. **Scan.** `python3 <this-skill-folder>/scripts/lilith_scan.py <project-root>`: stack, size, leads (hints, not findings), **read plan**. No Python: check by reading. Tell the user the stack in one line.
26
+ 2. **Security.** Load what the table below says, go through S1 to S14, read the plan's files. A problem counts only if you can finish "[who] can [do what] to [whose data or money]".
27
+ 3. **Live database** (Supabase or Firebase in the stack): follow the live check in the stack file. Skipped → the report says "Live database: NOT checked".
28
+ 4. **Cleanup** (full or cleanup mode only): code, then UI and copy. Cleanup never changes what the app does.
29
+ 5. **Report** with templates/report.md. Security mode ends with exactly one question: "Fix the critical ones, or continue to cleanup?"
30
+ 6. **Fix** only with permission: follow guides/fixing.md.
31
+
32
+ ## Load this file when...
33
+
34
+ | File | When |
35
+ |---|---|
36
+ | guides/security-core.md | any security mode |
37
+ | guides/stacks/supabase.md | stack has Supabase (hands over the SQL check unread) |
38
+ | guides/stacks/firebase.md + checks/firebase_check.md | stack has Firebase |
39
+ | guides/stacks/stripe.md | stack has Stripe or Payments |
40
+ | guides/stacks/ai.md | stack has AI API |
41
+ | guides/cleanup-code.md | cleanup of code |
42
+ | guides/cleanup-ui.md | UI and copy cleanup (it routes to guides/ui/*) |
43
+ | templates/report.md | writing the report |
44
+ | guides/fixing.md + guides/fixes/S<n>.md | user agreed to fix S<n> (only those) |
45
+ | guides/server.md | server mode |
46
+
47
+ ## Reading rules (save the user's tokens)
48
+
49
+ - **Batch reads:** every extra turn re-sends the whole conversation. Open all guide files a step needs in one go (parallel reads), and read the plan's files in a few large parallel batches, not one per turn.
50
+ - Read the plan's files first. Open others only when the plan or a lead points there.
51
+ - Grep before opening a file. Over 300 lines: read the plan's line ranges only.
52
+ - Never read lockfiles, build output, `node_modules`, generated types or binaries. Never re-read a file.
53
+ - Size **large**: say so and ask: "riskiest files only, or the full check?"
54
+
55
+ ## Ground rules
56
+
57
+ - Read code. Never attack live sites, call production or use real users' data; give the owner a safe self-test.
58
+ - Never print a full secret: `sk_live_51H••••4f2a`.
59
+ - Don't invent problems. Unsure: "worth checking" + the exact question.
60
+ - Ask before `npm audit fix --force`, deleting files or rewriting git history.
61
+ - Project conventions beat Lilith's style rules.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Lilith"
3
+ short_description: "Make a vibecoded app safe and clean before launch"
4
+ default_prompt: "Run lilith on this project"
@@ -0,0 +1,45 @@
1
+ # Live rules check for Firebase
2
+
3
+ The rules file in the repo (`firestore.rules`, `storage.rules`, `database.rules.json`) is not always what is running. Rules can be edited in the console, or the file was never deployed. The rules that protect the data are the **deployed** ones, so check those.
4
+
5
+ ## What to ask the user (2 minutes)
6
+
7
+ Say, in their language:
8
+
9
+ > Your app's data is protected by "rules" stored in Firebase. I'll check the ones that are live right now. Copying them is safe: rules are settings, not your users' data.
10
+ >
11
+ > 1. Open console.firebase.google.com and pick your project.
12
+ > 2. **Firestore Database → Rules** tab. Copy everything in the editor and paste it here.
13
+ > 3. If you use them, do the same for **Storage → Rules** and **Realtime Database → Rules**.
14
+ >
15
+ > If you'd rather skip this, say "skip" and I'll mark the live rules as not checked.
16
+
17
+ ## What to do with the pasted rules
18
+
19
+ 1. **Compare with the repo.** If the repo has a rules file, diff it against the pasted text. If they differ, say so in one line: "The rules running now are not the ones in your code." The live rules decide what's protected, so judge those. Suggest deploying from the repo afterward (`firebase deploy --only firestore:rules,storage`) so they stay in sync.
20
+ 2. **Apply the S3 patterns** from [../guides/stacks/firebase.md](../guides/stacks/firebase.md) to the live rules:
21
+
22
+ | Pattern in live rules | Severity | Plain meaning |
23
+ |---|---|---|
24
+ | `allow read, write: if true;` (or `allow write: if true`) | 🔴 Critical | Anyone on the internet can read and change this data. |
25
+ | `".read": true` / `".write": true` (Realtime Database) | 🔴 Critical | Same, for Realtime Database. |
26
+ | `request.time < timestamp.date(...)` | 🔴 Critical | "Test mode": open to everyone until that date, then the app breaks. |
27
+ | `if request.auth != null` on data that belongs to one user (`users`, `orders`, `messages`, `profiles`) | 🟠 High | Any logged-in user can read or change every other user's data. Signing up is free, so this is close to open. |
28
+ | `allow read: if true` on truly public data (blog posts, product list) with no write rule for everyone | 💡 Fine | Say it's OK and why. |
29
+ | A wildcard `match /{document=**}` with a broad `allow` | 🔴/🟠 | That rule covers every collection, including ones added later. |
30
+
31
+ 3. **Report** each problem in the normal what / why / fix format. The fix is a rule that ties data to its owner:
32
+
33
+ ```
34
+ match /orders/{orderId} {
35
+ allow read, update, delete: if request.auth != null && request.auth.uid == resource.data.userId;
36
+ allow create: if request.auth != null && request.auth.uid == request.resource.data.userId;
37
+ }
38
+ ```
39
+
40
+ 4. In the report header write **Live database: checked (Firebase rules pasted on <date>)**. If the user skipped, write **Live database: NOT checked** and add the steps above to "Only you can do this".
41
+
42
+ ## Limits
43
+
44
+ - Pasted rules show what's allowed, not what data exists. A collection with no rule is denied by default, which is safe.
45
+ - Firebase App Check and API key restrictions live elsewhere in the console. Mention them under "Nice to have" only.