soundings-cli 0.2.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/README.md +4 -4
- package/dist/cli.js +98 -3
- package/package.json +1 -1
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.2.
|
|
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
|
@@ -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 [];
|
|
@@ -2263,16 +2348,25 @@ var AI_CALL_TAILS2 = [
|
|
|
2263
2348
|
["chat", "stream"]
|
|
2264
2349
|
];
|
|
2265
2350
|
var AI_CALL_FUNCTIONS = /* @__PURE__ */ new Set(["generateText", "streamText", "generateObject", "streamObject", "embed", "embedMany"]);
|
|
2351
|
+
var AI_CALL_MODULES = /* @__PURE__ */ new Set(["ai"]);
|
|
2266
2352
|
var CONTENT_KEYS2 = /* @__PURE__ */ new Set(["content", "prompt", "input", "contents", "text", "system", "messages"]);
|
|
2267
2353
|
function payloadIn(f, providers) {
|
|
2268
2354
|
const requestVars = requestVariables(f.ast);
|
|
2269
2355
|
const params = paramNames(f.ast);
|
|
2270
2356
|
const ownTails = providers.flatMap((p) => p.calls?.js ?? []);
|
|
2271
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
|
+
};
|
|
2272
2366
|
let best = null;
|
|
2273
2367
|
const sends = [];
|
|
2274
2368
|
for (const call of calls(f.ast)) {
|
|
2275
|
-
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]) || call.chain !== null && ownTails.some((t) => call.chain.length > t.length && endsWith(call.chain, t));
|
|
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));
|
|
2276
2370
|
if (isAiCall && call.node.type === "CallExpression") sends.push({ args: call.node.arguments, ...call.line ? { line: call.line } : {} });
|
|
2277
2371
|
}
|
|
2278
2372
|
if (commands.size > 0) {
|
|
@@ -2280,7 +2374,8 @@ function payloadIn(f, providers) {
|
|
|
2280
2374
|
if (n.type !== "NewExpression") return void 0;
|
|
2281
2375
|
const chain = chainOf(n.callee);
|
|
2282
2376
|
const line = lineOf(n);
|
|
2283
|
-
|
|
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 } : {} });
|
|
2284
2379
|
return void 0;
|
|
2285
2380
|
});
|
|
2286
2381
|
}
|
|
@@ -3601,7 +3696,7 @@ function readGitignore(dir) {
|
|
|
3601
3696
|
}
|
|
3602
3697
|
|
|
3603
3698
|
// src/version.ts
|
|
3604
|
-
var VERSION = "0.2.
|
|
3699
|
+
var VERSION = "0.2.1";
|
|
3605
3700
|
|
|
3606
3701
|
// src/scanner/detectors/exposure.ts
|
|
3607
3702
|
var PUBLIC_PREFIX = /^(?:NEXT_PUBLIC_|VITE_|REACT_APP_|EXPO_PUBLIC_|NUXT_PUBLIC_|GATSBY_|PUBLIC_)/;
|