soundings-cli 0.1.0 → 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/LICENSE +2 -2
- package/LICENSE-COMMERCIAL.md +8 -1
- package/README.md +4 -4
- package/dist/cli.js +257 -19
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -6,8 +6,8 @@ Soundings is source-available. It is not open source in the OSI sense. Two licen
|
|
|
6
6
|
|
|
7
7
|
| Part | Licence |
|
|
8
8
|
| --- | --- |
|
|
9
|
-
| Everything in this repository and package **except** `
|
|
10
|
-
| `
|
|
9
|
+
| Everything in this repository and package **except** the paid features listed in `LICENSE-COMMERCIAL.md` | Functional Source License 1.1, Apache 2.0 future licence (`FSL-1.1-ALv2`), below |
|
|
10
|
+
| The paid features: the files and folders listed in section 1 of [`LICENSE-COMMERCIAL.md`](LICENSE-COMMERCIAL.md), and the parts of `dist/` compiled from them | Soundings Commercial Licence, in [`LICENSE-COMMERCIAL.md`](LICENSE-COMMERCIAL.md) | Soundings Commercial Licence, in [`LICENSE-COMMERCIAL.md`](LICENSE-COMMERCIAL.md) |
|
|
11
11
|
|
|
12
12
|
In plain terms, and not replacing either licence:
|
|
13
13
|
|
package/LICENSE-COMMERCIAL.md
CHANGED
|
@@ -4,7 +4,14 @@ Copyright 2026 Dynamo Maritime Ltd, registered in England and Wales, company num
|
|
|
4
4
|
|
|
5
5
|
## 1. What this licence covers
|
|
6
6
|
|
|
7
|
-
"Paid Features" means the source code
|
|
7
|
+
"Paid Features" means the source code of these files and folders of Soundings, and that code in any compiled or bundled form, including the parts of `dist/` built from it:
|
|
8
|
+
|
|
9
|
+
- `src/documents/build.ts`;
|
|
10
|
+
- the `src/import/` folder;
|
|
11
|
+
- these files in `src/export/`: `docx.ts`, `footnotes.ts`, `html.ts`, `markdown-model.ts`, `questionnaire.ts`, `render.ts` and `zip.ts`; and
|
|
12
|
+
- the parts of `src/cli/main.ts` that run the `answers`, `answer` and `document` commands and the `html` and `docx` export formats.
|
|
13
|
+
|
|
14
|
+
Everything else in Soundings is licensed separately under the Functional Source License (see `LICENSE`). That includes the scanner, the question flow, the `verify` command, the fixed wording in `src/export/notice.ts` and `src/documents/templates.ts`, and the licence check itself (which section 4 still protects). If a file is added to the list above in a later release, the change is recorded in `CHANGELOG.md`.
|
|
8
15
|
|
|
9
16
|
"Licence Key" means a key issued by us, or by a reseller acting for us, when you buy a Soundings plan (for example Pro or Agency). "Plan" means the plan the Licence Key was issued for, together with its limits, such as the number of machines.
|
|
10
17
|
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Soundings scans a project on your own machine and records what it finds: which AI providers it calls, where data is stored and sent, how users sign in, how keys are handled. Answers to a client's security questionnaire are then built from those findings, and anything the code can't tell it becomes a question for you. Your code never leaves your machine.
|
|
6
6
|
|
|
7
|
-
Status: 0.1.
|
|
7
|
+
Status: 0.2.1. Scanning, questions, answers, questionnaire import, verification, licensing, the five documents and the exports work. Available on npm as `soundings-cli`.
|
|
8
8
|
|
|
9
9
|
```
|
|
10
10
|
soundings scan . # what does the code show?
|
|
@@ -16,8 +16,8 @@ soundings verify draft.md # check any text against the evidence
|
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
```
|
|
19
|
-
Soundings 0.
|
|
20
|
-
|
|
19
|
+
Soundings 0.2.1 · notes-saas · nextjs, react, stripe, supabase-js
|
|
20
|
+
11 files, 15 detectors, 62 ms. Your code never left this machine.
|
|
21
21
|
|
|
22
22
|
AI providers
|
|
23
23
|
EV-3acc7131 OpenAI [stated by the code]
|
|
@@ -31,7 +31,7 @@ soundings verify draft.md # check any text against the evidence
|
|
|
31
31
|
|
|
32
32
|
## What it does
|
|
33
33
|
|
|
34
|
-
- **Scans locally.** No network calls, no telemetry, no upload. It reads JavaScript and
|
|
34
|
+
- **Scans locally.** No network calls, no telemetry, no upload. It reads JavaScript, TypeScript and Python projects (Next.js, Node/Express, FastAPI, Flask, Django, Supabase, Firebase, Stripe, Azure and the main AI SDKs) and reports anything else as "couldn't determine".
|
|
35
35
|
- **Writes evidence, not code.** `soundings-evidence.json` holds file paths, line numbers and one-sentence claims. It never holds source code or secret values, and the scan fails loudly if a secret would end up in it.
|
|
36
36
|
- **Says how sure it is.** Each fact is stated by the code, inferred, or "not found by the scan". An empty search is never presented as proof.
|
|
37
37
|
- **Asks instead of guessing.** What the code can't show (a hosting region, an account setting at a provider, how long data is kept) becomes a question with a stable ID.
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/*! Soundings (c) 2026 Dynamo Maritime Ltd. Licensed under FSL-1.1-ALv2, except
|
|
3
|
-
* which
|
|
2
|
+
/*! Soundings (c) 2026 Dynamo Maritime Ltd. Licensed under FSL-1.1-ALv2, except the paid features listed in LICENSE-COMMERCIAL.md,
|
|
3
|
+
* which are under the Soundings Commercial Licence. See LICENSE. */
|
|
4
4
|
|
|
5
5
|
// src/cli/index.ts
|
|
6
6
|
import { createInterface } from "readline/promises";
|
|
@@ -1579,6 +1579,91 @@ function calls(ast) {
|
|
|
1579
1579
|
});
|
|
1580
1580
|
return out;
|
|
1581
1581
|
}
|
|
1582
|
+
function namedImports(ast, modules) {
|
|
1583
|
+
const out = /* @__PURE__ */ new Map();
|
|
1584
|
+
if (modules.size === 0) return out;
|
|
1585
|
+
walkAst(ast, (n) => {
|
|
1586
|
+
if (n.type !== "ImportDeclaration" || !modules.has(n.source.value)) return void 0;
|
|
1587
|
+
for (const s of n.specifiers) {
|
|
1588
|
+
if (s.type === "ImportSpecifier") out.set(s.local.name, s.imported.type === "Identifier" ? s.imported.name : s.imported.value);
|
|
1589
|
+
}
|
|
1590
|
+
return void 0;
|
|
1591
|
+
});
|
|
1592
|
+
return out;
|
|
1593
|
+
}
|
|
1594
|
+
var FUNCTION_TYPES = /* @__PURE__ */ new Set(["FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression", "ObjectMethod", "ClassMethod", "ClassPrivateMethod"]);
|
|
1595
|
+
function declaredBy(s) {
|
|
1596
|
+
switch (s.type) {
|
|
1597
|
+
case "VariableDeclaration":
|
|
1598
|
+
return s.declarations.flatMap((d) => boundNames(d.id));
|
|
1599
|
+
case "FunctionDeclaration":
|
|
1600
|
+
case "ClassDeclaration":
|
|
1601
|
+
case "TSEnumDeclaration":
|
|
1602
|
+
return s.id ? [s.id.name] : [];
|
|
1603
|
+
case "ExportNamedDeclaration":
|
|
1604
|
+
case "ExportDefaultDeclaration":
|
|
1605
|
+
return s.declaration ? declaredBy(s.declaration) : [];
|
|
1606
|
+
default:
|
|
1607
|
+
return [];
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
function varNames(body) {
|
|
1611
|
+
const out = [];
|
|
1612
|
+
walkAst(body, (n) => {
|
|
1613
|
+
if (FUNCTION_TYPES.has(n.type)) return false;
|
|
1614
|
+
if (n.type === "VariableDeclaration" && n.kind === "var") for (const d of n.declarations) out.push(...boundNames(d.id));
|
|
1615
|
+
return void 0;
|
|
1616
|
+
});
|
|
1617
|
+
return out;
|
|
1618
|
+
}
|
|
1619
|
+
function scopeBindings(n) {
|
|
1620
|
+
switch (n.type) {
|
|
1621
|
+
case "Program":
|
|
1622
|
+
case "BlockStatement":
|
|
1623
|
+
case "StaticBlock":
|
|
1624
|
+
case "TSModuleBlock":
|
|
1625
|
+
return n.body.flatMap(declaredBy);
|
|
1626
|
+
case "SwitchStatement":
|
|
1627
|
+
return n.cases.flatMap((c) => c.consequent.flatMap(declaredBy));
|
|
1628
|
+
case "ForStatement":
|
|
1629
|
+
return n.init ? declaredBy(n.init) : [];
|
|
1630
|
+
case "ForInStatement":
|
|
1631
|
+
case "ForOfStatement":
|
|
1632
|
+
return declaredBy(n.left);
|
|
1633
|
+
case "CatchClause":
|
|
1634
|
+
return boundNames(n.param);
|
|
1635
|
+
case "ClassExpression":
|
|
1636
|
+
return n.id ? [n.id.name] : [];
|
|
1637
|
+
case "FunctionDeclaration":
|
|
1638
|
+
case "FunctionExpression":
|
|
1639
|
+
case "ArrowFunctionExpression":
|
|
1640
|
+
case "ObjectMethod":
|
|
1641
|
+
case "ClassMethod":
|
|
1642
|
+
case "ClassPrivateMethod":
|
|
1643
|
+
return [
|
|
1644
|
+
...n.params.flatMap((p) => boundNames(p)),
|
|
1645
|
+
...n.type === "FunctionExpression" && n.id ? [n.id.name] : [],
|
|
1646
|
+
...varNames(n.body)
|
|
1647
|
+
];
|
|
1648
|
+
default:
|
|
1649
|
+
return [];
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
function localBinding(ast) {
|
|
1653
|
+
const parents = /* @__PURE__ */ new Map();
|
|
1654
|
+
walkAst(ast, (n, parent) => {
|
|
1655
|
+
if (parent) parents.set(n, parent);
|
|
1656
|
+
});
|
|
1657
|
+
const cache = /* @__PURE__ */ new Map();
|
|
1658
|
+
return (at, name) => {
|
|
1659
|
+
for (let p = parents.get(at); p; p = parents.get(p)) {
|
|
1660
|
+
let names = cache.get(p);
|
|
1661
|
+
if (!names) cache.set(p, names = new Set(scopeBindings(p)));
|
|
1662
|
+
if (names.has(name)) return true;
|
|
1663
|
+
}
|
|
1664
|
+
return false;
|
|
1665
|
+
};
|
|
1666
|
+
}
|
|
1582
1667
|
var endsWith = (chain, tail) => chain !== null && chain.length >= tail.length && tail.every((t, i) => chain[chain.length - tail.length + i] === t);
|
|
1583
1668
|
function boundNames(p) {
|
|
1584
1669
|
if (!p) return [];
|
|
@@ -2030,16 +2115,20 @@ var AI_CALL_TAILS = [
|
|
|
2030
2115
|
["messages", "stream"],
|
|
2031
2116
|
["generate_content"],
|
|
2032
2117
|
["generate_content_async"],
|
|
2033
|
-
["generate_text"]
|
|
2118
|
+
["generate_text"],
|
|
2119
|
+
["chat", "complete"],
|
|
2120
|
+
["chat", "complete_async"],
|
|
2121
|
+
["chat", "stream"],
|
|
2122
|
+
["chat", "stream_async"]
|
|
2034
2123
|
];
|
|
2035
2124
|
var CONTENT_KEYS = /* @__PURE__ */ new Set(["content", "prompt", "input", "contents", "text", "system", "messages", "query"]);
|
|
2036
|
-
function aiPayload(lines, calls2, funcs) {
|
|
2125
|
+
function aiPayload(lines, calls2, funcs, ownTails = []) {
|
|
2037
2126
|
const params = new Set(funcs.flatMap((f) => f.params));
|
|
2038
2127
|
for (const n of handlerInputs(funcs)) params.add(n);
|
|
2039
2128
|
const reqVars = requestVariables2(lines);
|
|
2040
2129
|
let best = null;
|
|
2041
2130
|
for (const c of calls2) {
|
|
2042
|
-
if (!AI_CALL_TAILS.some((t) => callEndsWith(c.chain, t))) continue;
|
|
2131
|
+
if (!AI_CALL_TAILS.some((t) => callEndsWith(c.chain, t)) && !ownTails.some((t) => c.chain.length > t.length && callEndsWith(c.chain, t))) continue;
|
|
2043
2132
|
const roots = /* @__PURE__ */ new Set();
|
|
2044
2133
|
for (const v of valuesOf(c.args, CONTENT_KEYS)) {
|
|
2045
2134
|
if (v.length === 1 && v[0].t === "str" && !isFString(v[0].s)) continue;
|
|
@@ -2180,6 +2269,22 @@ var AI_PROVIDERS = [
|
|
|
2180
2269
|
{ id: "ai-provider/openai-sdk", subject: "OpenAI", packages: ["openai", "@ai-sdk/openai"], pyModules: ["openai", "langchain_openai"] },
|
|
2181
2270
|
{ id: "ai-provider/anthropic-sdk", subject: "Anthropic", packages: ["@anthropic-ai/sdk", "@ai-sdk/anthropic"], pyModules: ["anthropic", "langchain_anthropic"] },
|
|
2182
2271
|
{ id: "ai-provider/google-sdk", subject: "Google AI", packages: ["@google/generative-ai", "@google/genai", "@ai-sdk/google"], pyModules: ["google.generativeai", "google.genai", "langchain_google_genai", "vertexai"] },
|
|
2272
|
+
{ id: "ai-provider/mistral-sdk", subject: "Mistral", packages: ["@mistralai/mistralai", "@ai-sdk/mistral"], pyModules: ["mistralai", "langchain_mistralai"] },
|
|
2273
|
+
{
|
|
2274
|
+
id: "ai-provider/cohere-sdk",
|
|
2275
|
+
subject: "Cohere",
|
|
2276
|
+
packages: ["cohere-ai", "@ai-sdk/cohere"],
|
|
2277
|
+
pyModules: ["cohere", "langchain_cohere"],
|
|
2278
|
+
calls: { js: [["chat"], ["chatStream"]], py: [["chat"], ["chat_stream"]] }
|
|
2279
|
+
},
|
|
2280
|
+
{ id: "ai-provider/groq-sdk", subject: "Groq", packages: ["groq-sdk", "@ai-sdk/groq"], pyModules: ["groq"] },
|
|
2281
|
+
{
|
|
2282
|
+
id: "ai-provider/bedrock-sdk",
|
|
2283
|
+
subject: "AWS Bedrock",
|
|
2284
|
+
packages: ["@aws-sdk/client-bedrock-runtime", "@ai-sdk/amazon-bedrock"],
|
|
2285
|
+
pyModules: ["langchain_aws"],
|
|
2286
|
+
commands: ["ConverseCommand", "ConverseStreamCommand"]
|
|
2287
|
+
},
|
|
2183
2288
|
{ id: "ai-provider/vercel-ai-sdk", subject: "Vercel AI SDK", packages: ["ai"], pyModules: [] }
|
|
2184
2289
|
];
|
|
2185
2290
|
function providersIn(f) {
|
|
@@ -2238,19 +2343,46 @@ var AI_CALL_TAILS2 = [
|
|
|
2238
2343
|
["messages", "create"],
|
|
2239
2344
|
["messages", "stream"],
|
|
2240
2345
|
["generateContent"],
|
|
2241
|
-
["generateContentStream"]
|
|
2346
|
+
["generateContentStream"],
|
|
2347
|
+
["chat", "complete"],
|
|
2348
|
+
["chat", "stream"]
|
|
2242
2349
|
];
|
|
2243
2350
|
var AI_CALL_FUNCTIONS = /* @__PURE__ */ new Set(["generateText", "streamText", "generateObject", "streamObject", "embed", "embedMany"]);
|
|
2351
|
+
var AI_CALL_MODULES = /* @__PURE__ */ new Set(["ai"]);
|
|
2244
2352
|
var CONTENT_KEYS2 = /* @__PURE__ */ new Set(["content", "prompt", "input", "contents", "text", "system", "messages"]);
|
|
2245
|
-
function payloadIn(f) {
|
|
2353
|
+
function payloadIn(f, providers) {
|
|
2246
2354
|
const requestVars = requestVariables(f.ast);
|
|
2247
2355
|
const params = paramNames(f.ast);
|
|
2356
|
+
const ownTails = providers.flatMap((p) => p.calls?.js ?? []);
|
|
2357
|
+
const commands = new Set(providers.flatMap((p) => p.commands ?? []));
|
|
2358
|
+
const fnNames = namedImports(f.ast, AI_CALL_MODULES);
|
|
2359
|
+
const commandNames = namedImports(f.ast, new Set(providers.flatMap((p) => p.commands ? p.packages : [])));
|
|
2360
|
+
let bound;
|
|
2361
|
+
const resolve2 = (aliases, name, at) => {
|
|
2362
|
+
const imported = aliases.get(name);
|
|
2363
|
+
if (imported === void 0 || imported === name) return name;
|
|
2364
|
+
return (bound ??= localBinding(f.ast))(at, name) ? name : imported;
|
|
2365
|
+
};
|
|
2248
2366
|
let best = null;
|
|
2367
|
+
const sends = [];
|
|
2249
2368
|
for (const call of calls(f.ast)) {
|
|
2250
|
-
const isAiCall = call.chain !== null && AI_CALL_TAILS2.some((t) => endsWith(call.chain, t)) || call.chain !== null && call.chain.length === 1 && AI_CALL_FUNCTIONS.has(call.chain[0]);
|
|
2251
|
-
if (
|
|
2369
|
+
const isAiCall = call.chain !== null && AI_CALL_TAILS2.some((t) => endsWith(call.chain, t)) || call.chain !== null && call.chain.length === 1 && call.node.type === "CallExpression" && AI_CALL_FUNCTIONS.has(resolve2(fnNames, call.chain[0], call.node.callee)) || call.chain !== null && ownTails.some((t) => call.chain.length > t.length && endsWith(call.chain, t));
|
|
2370
|
+
if (isAiCall && call.node.type === "CallExpression") sends.push({ args: call.node.arguments, ...call.line ? { line: call.line } : {} });
|
|
2371
|
+
}
|
|
2372
|
+
if (commands.size > 0) {
|
|
2373
|
+
walkAst(f.ast, (n) => {
|
|
2374
|
+
if (n.type !== "NewExpression") return void 0;
|
|
2375
|
+
const chain = chainOf(n.callee);
|
|
2376
|
+
const line = lineOf(n);
|
|
2377
|
+
const name = chain?.length === 1 ? resolve2(commandNames, chain[0], n.callee) : chain?.[chain.length - 1];
|
|
2378
|
+
if (name && commands.has(name)) sends.push({ args: n.arguments, ...line ? { line } : {} });
|
|
2379
|
+
return void 0;
|
|
2380
|
+
});
|
|
2381
|
+
}
|
|
2382
|
+
sends.sort((a, b) => (a.line ?? 0) - (b.line ?? 0));
|
|
2383
|
+
for (const call of sends) {
|
|
2252
2384
|
const roots = /* @__PURE__ */ new Set();
|
|
2253
|
-
for (const arg of call.
|
|
2385
|
+
for (const arg of call.args) {
|
|
2254
2386
|
walkAst(arg, (n) => {
|
|
2255
2387
|
if (n.type === "ObjectProperty" && !n.computed) {
|
|
2256
2388
|
const key = n.key.type === "Identifier" ? n.key.name : n.key.type === "StringLiteral" ? n.key.value : null;
|
|
@@ -2274,7 +2406,7 @@ var dataFlowDetector = {
|
|
|
2274
2406
|
for (const f of ctx.py) {
|
|
2275
2407
|
const providers = AI_PROVIDERS.filter((p) => p.pyModules.length > 0 && importsPy(f, ...p.pyModules));
|
|
2276
2408
|
if (providers.length === 0) continue;
|
|
2277
|
-
const payload = aiPayload(f.lines, f.calls, f.funcs);
|
|
2409
|
+
const payload = aiPayload(f.lines, f.calls, f.funcs, providers.flatMap((p) => p.calls?.py ?? []));
|
|
2278
2410
|
if (!payload) continue;
|
|
2279
2411
|
for (const p of providers) {
|
|
2280
2412
|
facts.push({
|
|
@@ -2292,7 +2424,7 @@ var dataFlowDetector = {
|
|
|
2292
2424
|
for (const f of ctx.js) {
|
|
2293
2425
|
const providers = providersIn(f);
|
|
2294
2426
|
if (providers.length === 0) continue;
|
|
2295
|
-
const payload = payloadIn(f);
|
|
2427
|
+
const payload = payloadIn(f, providers);
|
|
2296
2428
|
if (!payload) continue;
|
|
2297
2429
|
for (const p of providers) {
|
|
2298
2430
|
facts.push({
|
|
@@ -2625,6 +2757,98 @@ function storeDetector(spec) {
|
|
|
2625
2757
|
]
|
|
2626
2758
|
};
|
|
2627
2759
|
}
|
|
2760
|
+
var ENGINES = {
|
|
2761
|
+
postgresql: { subject: "PostgreSQL", engine: "postgresql" },
|
|
2762
|
+
postgres: { subject: "PostgreSQL", engine: "postgresql" },
|
|
2763
|
+
mysql: { subject: "MySQL", engine: "mysql" },
|
|
2764
|
+
sqlite: { subject: "SQLite", engine: "sqlite" },
|
|
2765
|
+
mongodb: { subject: "MongoDB", engine: "mongodb" },
|
|
2766
|
+
sqlserver: { subject: "SQL Server", engine: "sqlserver" },
|
|
2767
|
+
cockroachdb: { subject: "CockroachDB", engine: "cockroachdb" }
|
|
2768
|
+
};
|
|
2769
|
+
var PRISMA_STRING = /"(?:[^"\\\n]|\\.)*"/.source;
|
|
2770
|
+
var blankLineComments = (text) => text.replace(new RegExp(`${PRISMA_STRING}|\\/\\/[^\\n]*`, "g"), (m) => m.startsWith("//") ? " ".repeat(m.length) : m);
|
|
2771
|
+
function prismaProviders(text) {
|
|
2772
|
+
const code = blankLineComments(text);
|
|
2773
|
+
const out = [];
|
|
2774
|
+
for (const block of code.matchAll(/\bdatasource\s+\w+\s*\{([^}]*)\}/g)) {
|
|
2775
|
+
const body = block[1];
|
|
2776
|
+
const m = [...body.matchAll(new RegExp(`${PRISMA_STRING}|\\bprovider\\s*=\\s*"([^"\\n]*)"`, "g"))].find((x) => x[0].startsWith("provider"));
|
|
2777
|
+
if (!m) continue;
|
|
2778
|
+
const start = (block.index ?? 0) + block[0].indexOf(body) + (m.index ?? 0);
|
|
2779
|
+
out.push({ provider: m[1].trim().toLowerCase(), offset: start });
|
|
2780
|
+
}
|
|
2781
|
+
return out;
|
|
2782
|
+
}
|
|
2783
|
+
var prisma = {
|
|
2784
|
+
id: "data-store/prisma",
|
|
2785
|
+
skipReason: (ctx) => ctx.hasDep("@prisma/client") ? null : "no Prisma client in dependencies",
|
|
2786
|
+
run: (ctx) => {
|
|
2787
|
+
const imports = ctx.js.flatMap((f) => {
|
|
2788
|
+
const imp = importsModule(f, "@prisma/client");
|
|
2789
|
+
return imp ? [{ file: f.file, ...imp.line ? { line: imp.line } : {} }] : [];
|
|
2790
|
+
});
|
|
2791
|
+
if (imports.length === 0) return [];
|
|
2792
|
+
const facts = [];
|
|
2793
|
+
const schemas = ctx.project.files.filter((f) => f.endsWith(".prisma") && isProductFile(f)).sort();
|
|
2794
|
+
for (const file of schemas) {
|
|
2795
|
+
const text = ctx.project.read(file);
|
|
2796
|
+
if (text === null) continue;
|
|
2797
|
+
for (const { provider, offset } of prismaProviders(text)) {
|
|
2798
|
+
const known = ENGINES[provider];
|
|
2799
|
+
if (!known) continue;
|
|
2800
|
+
facts.push({
|
|
2801
|
+
kind: "data_store",
|
|
2802
|
+
subject: known.subject,
|
|
2803
|
+
claim: `The app stores data in ${known.subject} through Prisma, as set by the datasource provider in its Prisma schema.`,
|
|
2804
|
+
attributes: { engine: known.engine },
|
|
2805
|
+
confidence: "high",
|
|
2806
|
+
detector: "data-store/prisma",
|
|
2807
|
+
key: file,
|
|
2808
|
+
// The schema line is the source of the engine; the import only has to exist for the fact to.
|
|
2809
|
+
locations: [{ file, line: ctx.project.position(file, offset).line }]
|
|
2810
|
+
});
|
|
2811
|
+
}
|
|
2812
|
+
}
|
|
2813
|
+
if (facts.length > 0) return facts;
|
|
2814
|
+
return [
|
|
2815
|
+
{
|
|
2816
|
+
kind: "data_store",
|
|
2817
|
+
subject: "SQL database (Prisma)",
|
|
2818
|
+
claim: "The app uses the Prisma client, but no Prisma schema in the project says which database engine it connects to.",
|
|
2819
|
+
attributes: { engine: "sql" },
|
|
2820
|
+
confidence: "medium",
|
|
2821
|
+
detector: "data-store/prisma",
|
|
2822
|
+
key: imports[0].file,
|
|
2823
|
+
locations: imports
|
|
2824
|
+
}
|
|
2825
|
+
];
|
|
2826
|
+
}
|
|
2827
|
+
};
|
|
2828
|
+
var DRIZZLE_CORE = { "drizzle-orm/pg-core": "postgresql", "drizzle-orm/mysql-core": "mysql", "drizzle-orm/sqlite-core": "sqlite" };
|
|
2829
|
+
var drizzle = {
|
|
2830
|
+
id: "data-store/drizzle",
|
|
2831
|
+
skipReason: (ctx) => ctx.hasDep("drizzle-orm") ? null : "no Drizzle ORM in dependencies",
|
|
2832
|
+
run: (ctx) => ctx.js.flatMap((f) => {
|
|
2833
|
+
const uses = f.imports.filter((i) => i.source === "drizzle-orm" || i.source.startsWith("drizzle-orm/"));
|
|
2834
|
+
if (uses.length === 0) return [];
|
|
2835
|
+
const fact = (subject, engine, claim, line) => ({
|
|
2836
|
+
kind: "data_store",
|
|
2837
|
+
subject,
|
|
2838
|
+
claim,
|
|
2839
|
+
attributes: { engine },
|
|
2840
|
+
confidence: "high",
|
|
2841
|
+
detector: "data-store/drizzle",
|
|
2842
|
+
key: f.file,
|
|
2843
|
+
locations: [{ file: f.file, ...line ? { line } : {} }]
|
|
2844
|
+
});
|
|
2845
|
+
const specific = uses.flatMap((i) => {
|
|
2846
|
+
const known = ENGINES[DRIZZLE_CORE[i.source] ?? ""];
|
|
2847
|
+
return known ? [fact(known.subject, known.engine, `The app stores data in ${known.subject} through Drizzle ORM: it imports Drizzle's ${known.subject} schema module.`, i.line)] : [];
|
|
2848
|
+
});
|
|
2849
|
+
return specific.length > 0 ? specific : [fact("SQL database (Drizzle)", "sql", "The app uses Drizzle ORM, but its imports don't show which database engine it connects to.", uses[0].line)];
|
|
2850
|
+
})
|
|
2851
|
+
};
|
|
2628
2852
|
var CONNECTION_FILE = /\.(?:py|ya?ml|toml|ini|cfg|json)$|(?:^|\/)\.env(?:\.[\w.-]+)?$/;
|
|
2629
2853
|
var CONNECTION_STRING = /\b(postgres(?:ql)?(?:\+\w+)?|mysql(?:\+\w+)?|mongodb(?:\+srv)?|rediss?):\/\//gi;
|
|
2630
2854
|
var CONNECTION_SUBJECT = (scheme) => {
|
|
@@ -2660,7 +2884,7 @@ var connectionString = {
|
|
|
2660
2884
|
return facts;
|
|
2661
2885
|
}
|
|
2662
2886
|
};
|
|
2663
|
-
var storeDetectors = [supabase, ...STORES.map(storeDetector), connectionString];
|
|
2887
|
+
var storeDetectors = [supabase, ...STORES.map(storeDetector), prisma, drizzle, connectionString];
|
|
2664
2888
|
|
|
2665
2889
|
// src/verify/entities.ts
|
|
2666
2890
|
var EXTRA = [
|
|
@@ -2689,12 +2913,13 @@ var EXTRA = [
|
|
|
2689
2913
|
"Zendesk",
|
|
2690
2914
|
"Intercom"
|
|
2691
2915
|
];
|
|
2692
|
-
var VENDOR_WORDS = ["Vercel", "Supabase", "Firebase", "Google", "Plausible", "Stripe", "OpenAI", "Anthropic", "Sentry", "PostHog", "Mixpanel", "Segment", "Resend", "SendGrid", "Postmark", "Twilio", "Clerk", "Auth0", "Hotjar"];
|
|
2916
|
+
var VENDOR_WORDS = ["Vercel", "Supabase", "Firebase", "Google", "Bedrock", "Plausible", "Stripe", "OpenAI", "Anthropic", "Sentry", "PostHog", "Mixpanel", "Segment", "Resend", "SendGrid", "Postmark", "Twilio", "Clerk", "Auth0", "Hotjar"];
|
|
2693
2917
|
function build() {
|
|
2694
2918
|
const names = /* @__PURE__ */ new Set();
|
|
2695
2919
|
for (const p of AI_PROVIDERS) names.add(p.subject);
|
|
2696
2920
|
for (const s of SERVICES) names.add(s.subject);
|
|
2697
2921
|
for (const s of STORES) names.add(s.subject);
|
|
2922
|
+
for (const e of Object.values(ENGINES)) names.add(e.subject);
|
|
2698
2923
|
for (const a of AUTH_PACKAGES) names.add(a.subject);
|
|
2699
2924
|
for (const e of EXTRA) names.add(e);
|
|
2700
2925
|
for (const w of VENDOR_WORDS) names.add(w);
|
|
@@ -3471,7 +3696,7 @@ function readGitignore(dir) {
|
|
|
3471
3696
|
}
|
|
3472
3697
|
|
|
3473
3698
|
// src/version.ts
|
|
3474
|
-
var VERSION = "0.1
|
|
3699
|
+
var VERSION = "0.2.1";
|
|
3475
3700
|
|
|
3476
3701
|
// src/scanner/detectors/exposure.ts
|
|
3477
3702
|
var PUBLIC_PREFIX = /^(?:NEXT_PUBLIC_|VITE_|REACT_APP_|EXPO_PUBLIC_|NUXT_PUBLIC_|GATSBY_|PUBLIC_)/;
|
|
@@ -3858,15 +4083,28 @@ function unanalysedQuestion(unsupported) {
|
|
|
3858
4083
|
why: "Soundings reads JavaScript and TypeScript only, so what the other code does is not in this scan."
|
|
3859
4084
|
};
|
|
3860
4085
|
}
|
|
3861
|
-
var SPECIFIC_SQL = /* @__PURE__ */ new Set(["PostgreSQL", "MySQL", "Supabase Postgres"]);
|
|
4086
|
+
var SPECIFIC_SQL = /* @__PURE__ */ new Set(["PostgreSQL", "MySQL", "Supabase Postgres", "SQLite", "SQL Server", "CockroachDB"]);
|
|
4087
|
+
var GENERIC_SQL = /* @__PURE__ */ new Set(["SQL database (SQLAlchemy)", "SQL database (Prisma)", "SQL database (Drizzle)"]);
|
|
4088
|
+
var ORMS = ["data-store/prisma", "data-store/drizzle"];
|
|
4089
|
+
var ormRank = (f) => ORMS.indexOf(f.detector);
|
|
3862
4090
|
function dropRedundant(facts) {
|
|
3863
|
-
const stores = facts.filter((f) => f.kind === "data_store");
|
|
3864
|
-
|
|
4091
|
+
const stores = facts.filter((f) => f.kind === "data_store" && f.claimType !== "not-found");
|
|
4092
|
+
const folded = /* @__PURE__ */ new Map();
|
|
4093
|
+
const kept = facts.filter((f) => {
|
|
3865
4094
|
if (f.kind !== "data_store") return true;
|
|
3866
4095
|
if (f.detector === "data-store/connection-string") return !stores.some((o) => o.subject === f.subject && o.detector !== f.detector);
|
|
3867
|
-
if (f.subject
|
|
4096
|
+
if (GENERIC_SQL.has(f.subject)) return !stores.some((o) => SPECIFIC_SQL.has(o.subject));
|
|
4097
|
+
if (ormRank(f) >= 0) {
|
|
4098
|
+
const same = stores.filter((o) => o.subject === f.subject && o.detector !== "data-store/connection-string" && ormRank(o) < ormRank(f));
|
|
4099
|
+
const into = same.sort((a, b) => ormRank(a) - ormRank(b))[0];
|
|
4100
|
+
if (into) {
|
|
4101
|
+
folded.set(into, [...folded.get(into) ?? [], ...f.locations ?? []]);
|
|
4102
|
+
return false;
|
|
4103
|
+
}
|
|
4104
|
+
}
|
|
3868
4105
|
return true;
|
|
3869
4106
|
});
|
|
4107
|
+
return kept.map((f) => folded.has(f) ? { ...f, locations: [...f.locations ?? [], ...folded.get(f)].slice(0, MAX_LOCATIONS) } : f);
|
|
3870
4108
|
}
|
|
3871
4109
|
function scan(opts) {
|
|
3872
4110
|
const started = Date.now();
|