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.
- package/LICENSE +21 -0
- package/README.md +134 -2
- package/THIRD_PARTY_NOTICES.md +79 -0
- package/bin/lilith.mjs +147 -0
- package/package.json +43 -4
- package/skills/lilith/SKILL.md +61 -0
- package/skills/lilith/agents/openai.yaml +4 -0
- package/skills/lilith/checks/firebase_check.md +45 -0
- package/skills/lilith/checks/supabase_check.sql +211 -0
- package/skills/lilith/guides/cleanup-code.md +56 -0
- package/skills/lilith/guides/cleanup-ui.md +54 -0
- package/skills/lilith/guides/fixes/S1.md +6 -0
- package/skills/lilith/guides/fixes/S10.md +3 -0
- package/skills/lilith/guides/fixes/S11.md +3 -0
- package/skills/lilith/guides/fixes/S12.md +3 -0
- package/skills/lilith/guides/fixes/S13.md +3 -0
- package/skills/lilith/guides/fixes/S14.md +9 -0
- package/skills/lilith/guides/fixes/S2.md +15 -0
- package/skills/lilith/guides/fixes/S3.md +25 -0
- package/skills/lilith/guides/fixes/S4.md +11 -0
- package/skills/lilith/guides/fixes/S5.md +3 -0
- package/skills/lilith/guides/fixes/S6.md +7 -0
- package/skills/lilith/guides/fixes/S7.md +16 -0
- package/skills/lilith/guides/fixes/S8.md +11 -0
- package/skills/lilith/guides/fixes/S9.md +3 -0
- package/skills/lilith/guides/fixing.md +9 -0
- package/skills/lilith/guides/security-core.md +66 -0
- package/skills/lilith/guides/server.md +73 -0
- package/skills/lilith/guides/stacks/ai.md +14 -0
- package/skills/lilith/guides/stacks/firebase.md +13 -0
- package/skills/lilith/guides/stacks/stripe.md +13 -0
- package/skills/lilith/guides/stacks/supabase.md +31 -0
- package/skills/lilith/guides/ui/charts.md +10 -0
- package/skills/lilith/guides/ui/examples.md +30 -0
- package/skills/lilith/guides/ui/surface.md +11 -0
- package/skills/lilith/scripts/count_tells.py +384 -0
- package/skills/lilith/scripts/lilith_scan.py +750 -0
- package/skills/lilith/templates/report.md +64 -0
- package/src/agents.mjs +54 -0
- package/src/install.mjs +71 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Report template
|
|
2
|
+
|
|
3
|
+
Fill this in. Skip any section that's empty. Write in the user's language.
|
|
4
|
+
|
|
5
|
+
- ๐ด and ๐ : in full, what / why / fix, up to 3 short lines each.
|
|
6
|
+
- ๐ก: one line each.
|
|
7
|
+
- โช Cleanup: grouped counts only ("34 leftover logs in 12 files"). Details only if the user asks.
|
|
8
|
+
- ๐ก: one line each, or skip.
|
|
9
|
+
|
|
10
|
+
| Level | Meaning |
|
|
11
|
+
|---|---|
|
|
12
|
+
| ๐ด Critical | A stranger, without logging in, can today: read or change your database, spend your money (API keys, payments), take over accounts, or run code on your server. Fix before launch. |
|
|
13
|
+
| ๐ High | A logged-in user can see or change other users' data, become admin, or skip paying. Fix before launch. |
|
|
14
|
+
| ๐ก Medium | A real problem with limited damage or unusual conditions (no rate limit on login, verbose errors). Fix soon. |
|
|
15
|
+
| โช Cleanup | Not dangerous. Makes the app look AI-made or harder to change later. |
|
|
16
|
+
| ๐ก Nice to have | Good practice, no real attack path found. |
|
|
17
|
+
|
|
18
|
+
```markdown
|
|
19
|
+
# ๐ก๏ธ Security check: <project name>
|
|
20
|
+
|
|
21
|
+
**Stack:** <e.g. Next.js + Supabase + Stripe, hosted on Vercel>
|
|
22
|
+
**Live database:** <"checked (Supabase query results pasted)" / "checked (Firebase rules pasted)" / "NOT checked: only the code was read, the database rules running now may differ" / "no database"> (never leave this line out)
|
|
23
|
+
**Verdict:** <one line, e.g. "2 things to fix before launch, then you're good to go">
|
|
24
|
+
|
|
25
|
+
| ๐ด Critical | ๐ High | ๐ก Medium | โช Cleanup |
|
|
26
|
+
|---|---|---|---|
|
|
27
|
+
| 1 | 1 | 2 | 9 |
|
|
28
|
+
|
|
29
|
+
## ๐ด Fix before launch
|
|
30
|
+
|
|
31
|
+
### 1. Your OpenAI key is visible to every visitor (S2)
|
|
32
|
+
**What:** `NEXT_PUBLIC_OPENAI_KEY` in `src/lib/ai.ts:4` is sent to the browser.
|
|
33
|
+
**Why it matters:** anyone can copy it and spend your OpenAI budget.
|
|
34
|
+
**Fix:** move the call to a server route (I can do this), then create a new key in the OpenAI dashboard and delete the old one (only you can do this).
|
|
35
|
+
|
|
36
|
+
## ๐ High
|
|
37
|
+
...
|
|
38
|
+
|
|
39
|
+
## ๐ก Medium
|
|
40
|
+
- No rate limit on login (S8): `app/api/auth/login/route.ts`, add a per-IP limit.
|
|
41
|
+
|
|
42
|
+
## โช Cleanup (counts only, ask me for details)
|
|
43
|
+
- 34 leftover logs in 12 files (C1) ยท 3 fake testimonials (C2) ยท 6 eyebrow labels, 4 emoji headings (U1, U11)
|
|
44
|
+
|
|
45
|
+
## Kept on purpose (cleanup runs only)
|
|
46
|
+
- `{isLive && <Badge>Live</Badge>}`: shows real state (U9)
|
|
47
|
+
|
|
48
|
+
## โ
Checked, no problems found
|
|
49
|
+
S4 login checks on API routes, S5 other users' data, S9 unsafe HTML ...
|
|
50
|
+
|
|
51
|
+
## โญ๏ธ Didn't apply
|
|
52
|
+
S7 payments (no payments in this app), server guide (hosted on Vercel)
|
|
53
|
+
|
|
54
|
+
## ๐ Only you can do this
|
|
55
|
+
- [ ] Rotate the OpenAI key: platform.openai.com โ API keys
|
|
56
|
+
- [ ] Set a monthly spending limit with your AI provider
|
|
57
|
+
- [ ] Supabase โ Advisors โ Security Advisor: fix every red item
|
|
58
|
+
- [ ] If "Live database: NOT checked": run `checks/supabase_check.sql` in the SQL Editor (or paste your Firebase rules) and send me the result
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
Fix the critical ones, or continue to cleanup?
|
|
62
|
+
|
|
63
|
+
<sub>Checked with Lilith, a security check for vibecoded apps ยท github.com/Sunnik21/lilith ยท found N issues in M checks. This is a check, not a guarantee.</sub>
|
|
64
|
+
```
|
package/src/agents.mjs
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Where each coding agent looks for Agent Skills.
|
|
2
|
+
// Paths match the `skills` CLI (npm: skills), so both installers agree.
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
|
|
5
|
+
export function agentTable(env, home) {
|
|
6
|
+
const claudeHome = env.CLAUDE_CONFIG_DIR?.trim() || join(home, ".claude");
|
|
7
|
+
const codexHome = env.CODEX_HOME?.trim() || join(home, ".codex");
|
|
8
|
+
const configHome = env.XDG_CONFIG_HOME?.trim() || join(home, ".config");
|
|
9
|
+
|
|
10
|
+
return Object.freeze({
|
|
11
|
+
claude: {
|
|
12
|
+
name: "Claude Code",
|
|
13
|
+
globalDir: join(claudeHome, "skills"),
|
|
14
|
+
projectDir: ".claude/skills",
|
|
15
|
+
detectDir: claudeHome,
|
|
16
|
+
},
|
|
17
|
+
codex: {
|
|
18
|
+
name: "Codex",
|
|
19
|
+
globalDir: join(home, ".agents", "skills"),
|
|
20
|
+
projectDir: ".agents/skills",
|
|
21
|
+
detectDir: codexHome,
|
|
22
|
+
},
|
|
23
|
+
cursor: {
|
|
24
|
+
name: "Cursor",
|
|
25
|
+
globalDir: join(home, ".cursor", "skills"),
|
|
26
|
+
projectDir: ".agents/skills",
|
|
27
|
+
detectDir: join(home, ".cursor"),
|
|
28
|
+
},
|
|
29
|
+
gemini: {
|
|
30
|
+
name: "Gemini CLI",
|
|
31
|
+
globalDir: join(home, ".gemini", "skills"),
|
|
32
|
+
projectDir: ".agents/skills",
|
|
33
|
+
detectDir: join(home, ".gemini"),
|
|
34
|
+
},
|
|
35
|
+
copilot: {
|
|
36
|
+
name: "GitHub Copilot",
|
|
37
|
+
globalDir: join(home, ".copilot", "skills"),
|
|
38
|
+
projectDir: ".agents/skills",
|
|
39
|
+
detectDir: join(home, ".copilot"),
|
|
40
|
+
},
|
|
41
|
+
opencode: {
|
|
42
|
+
name: "OpenCode",
|
|
43
|
+
globalDir: join(configHome, "opencode", "skills"),
|
|
44
|
+
projectDir: ".agents/skills",
|
|
45
|
+
detectDir: join(configHome, "opencode"),
|
|
46
|
+
},
|
|
47
|
+
windsurf: {
|
|
48
|
+
name: "Windsurf",
|
|
49
|
+
globalDir: join(home, ".codeium", "windsurf", "skills"),
|
|
50
|
+
projectDir: ".windsurf/skills",
|
|
51
|
+
detectDir: join(home, ".codeium", "windsurf"),
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
}
|
package/src/install.mjs
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// Copy the skill folder into agent skill directories, or remove it again.
|
|
2
|
+
import { cpSync, existsSync, readFileSync, rmSync, mkdirSync } from "node:fs";
|
|
3
|
+
import { basename, join, resolve } from "node:path";
|
|
4
|
+
|
|
5
|
+
export const SKILL_NAME = "lilith";
|
|
6
|
+
|
|
7
|
+
const SKIP_NAMES = new Set(["__pycache__", ".DS_Store"]);
|
|
8
|
+
|
|
9
|
+
// Pick the agents to act on: the ones asked for, or the ones found on this machine.
|
|
10
|
+
export function selectAgents(table, requested, existsFn = existsSync) {
|
|
11
|
+
if (requested.length > 0) {
|
|
12
|
+
const unknown = requested.filter((id) => !(id in table));
|
|
13
|
+
if (unknown.length > 0) {
|
|
14
|
+
throw new Error(
|
|
15
|
+
`Unknown agent: ${unknown.join(", ")}. Known: ${Object.keys(table).join(", ")}`
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
return requested;
|
|
19
|
+
}
|
|
20
|
+
return Object.keys(table).filter((id) => existsFn(table[id].detectDir));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// One target folder per skills directory; several agents can share one.
|
|
24
|
+
export function planTargets(table, agentIds, { project, cwd }) {
|
|
25
|
+
const byDir = new Map();
|
|
26
|
+
for (const id of agentIds) {
|
|
27
|
+
const base = project ? resolve(cwd, table[id].projectDir) : table[id].globalDir;
|
|
28
|
+
const dir = join(base, SKILL_NAME);
|
|
29
|
+
const agents = byDir.get(dir) ?? [];
|
|
30
|
+
byDir.set(dir, [...agents, table[id].name]);
|
|
31
|
+
}
|
|
32
|
+
return [...byDir].map(([dir, agents]) => ({ dir, agents }));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// True when the folder holds a Lilith skill (safe to replace or remove).
|
|
36
|
+
export function isOurSkill(dir) {
|
|
37
|
+
const skillFile = join(dir, "SKILL.md");
|
|
38
|
+
if (!existsSync(skillFile)) return false;
|
|
39
|
+
const head = readFileSync(skillFile, "utf8").slice(0, 500);
|
|
40
|
+
return new RegExp(`^name:\\s*${SKILL_NAME}\\s*$`, "m").test(head);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function copySkill(sourceDir, targetDir) {
|
|
44
|
+
mkdirSync(join(targetDir, ".."), { recursive: true });
|
|
45
|
+
cpSync(sourceDir, targetDir, {
|
|
46
|
+
recursive: true,
|
|
47
|
+
filter: (src) => !SKIP_NAMES.has(basename(src)) && !src.endsWith(".pyc"),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function installTo(sourceDir, target, { force }) {
|
|
52
|
+
if (existsSync(target.dir)) {
|
|
53
|
+
if (!isOurSkill(target.dir) && !force) {
|
|
54
|
+
return { ...target, status: "skipped", reason: "folder exists and is not Lilith (use --force)" };
|
|
55
|
+
}
|
|
56
|
+
rmSync(target.dir, { recursive: true, force: true });
|
|
57
|
+
copySkill(sourceDir, target.dir);
|
|
58
|
+
return { ...target, status: "updated" };
|
|
59
|
+
}
|
|
60
|
+
copySkill(sourceDir, target.dir);
|
|
61
|
+
return { ...target, status: "installed" };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function uninstallFrom(target) {
|
|
65
|
+
if (!existsSync(target.dir)) return { ...target, status: "absent" };
|
|
66
|
+
if (!isOurSkill(target.dir)) {
|
|
67
|
+
return { ...target, status: "skipped", reason: "folder is not Lilith, left as is" };
|
|
68
|
+
}
|
|
69
|
+
rmSync(target.dir, { recursive: true, force: true });
|
|
70
|
+
return { ...target, status: "removed" };
|
|
71
|
+
}
|