soundings-cli 0.2.0 → 0.3.0

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 (3) hide show
  1. package/README.md +5 -5
  2. package/dist/cli.js +296 -16
  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.0. Scanning, questions, answers, questionnaire import, verification, licensing, the five documents and the exports work. Available on npm as `soundings-cli`.
7
+ Status: 0.3.0. 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.0.1 · notes-saas · nextjs, react, stripe, supabase-js
20
- 10 files, 14 detectors, 64 ms. Your code never left this machine.
19
+ Soundings 0.3.0 · 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 TypeScript projects (Next.js, Node/Express, Supabase, Firebase, Stripe and the main AI SDKs) and reports anything else as "couldn't determine".
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.
@@ -39,7 +39,7 @@ soundings verify draft.md # check any text against the evidence
39
39
  - **Answers a standard question bank.** 43 questions on AI use, data, access, keys, logging, suppliers and incident response. Each sentence cites a scan fact or something you said, and the document ends with numbered sources. If your answer and the scan disagree, yours wins and the document notes the difference.
40
40
 
41
41
  - **Fills in a client's questionnaire.** Rows that clearly match a bank question are answered; everything else is marked and listed, never guessed.
42
- - **Checks any text.** `soundings verify` fails any statement without a real source that mentions what it claims, so an AI assistant's draft can be trusted only as far as it can be checked.
42
+ - **Checks any text.** `soundings verify` fails a statement whose source is missing or doesn't mention what it claims, and warns on other uncited claims it can spot (with `--strict`, warnings fail too), so an AI assistant's draft can be trusted only as far as it can be checked.
43
43
 
44
44
  Scanning, questions and verification are free and make no network calls. The answers documents and questionnaire import are Soundings Pro; see [docs/plans.md](docs/plans.md) for exactly what the one licence check sends.
45
45
 
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 [];
@@ -2180,6 +2265,12 @@ var importsModule = (f, source) => f.imports.find((i) => i.source === source ||
2180
2265
  var importsPy = (f, ...modules) => f.imports.find((imp) => importCandidates(imp).some((c) => modules.some((m) => withinModule(c, m))));
2181
2266
 
2182
2267
  // src/scanner/detectors/ai.ts
2268
+ var routerQuestion = (subject) => ({
2269
+ key: `${subject.toLowerCase()}-routed-vendors`,
2270
+ topic: "AI routing",
2271
+ question: `Which model vendors does ${subject} route this app's requests to?`,
2272
+ why: `${subject} picks the vendor from model names and configuration, so the scan can't tell which vendors receive the data.`
2273
+ });
2183
2274
  var AI_PROVIDERS = [
2184
2275
  { id: "ai-provider/openai-sdk", subject: "OpenAI", packages: ["openai", "@ai-sdk/openai"], pyModules: ["openai", "langchain_openai"] },
2185
2276
  { id: "ai-provider/anthropic-sdk", subject: "Anthropic", packages: ["@anthropic-ai/sdk", "@ai-sdk/anthropic"], pyModules: ["anthropic", "langchain_anthropic"] },
@@ -2200,8 +2291,43 @@ var AI_PROVIDERS = [
2200
2291
  pyModules: ["langchain_aws"],
2201
2292
  commands: ["ConverseCommand", "ConverseStreamCommand"]
2202
2293
  },
2294
+ {
2295
+ id: "ai-provider/ollama-sdk",
2296
+ subject: "Ollama",
2297
+ packages: ["ollama"],
2298
+ pyModules: ["ollama", "langchain_ollama"],
2299
+ calls: { js: [["chat"], ["generate"]], py: [["chat"], ["generate"]] },
2300
+ library: "client library",
2301
+ // Ollama's server can run on this machine or anywhere else, so the claim never says the data stays local.
2302
+ caveat: "The scan doesn't read where the Ollama server it talks to runs: it can be this machine or another one.",
2303
+ question: {
2304
+ key: "ollama-server-location",
2305
+ topic: "AI model hosting",
2306
+ question: "Where does the Ollama server that this code calls run (on the same machine, on a server you run, or at a hosting provider), and who operates it?",
2307
+ why: "The scan doesn't read the server's address, and an address alone doesn't show who runs the server."
2308
+ }
2309
+ },
2310
+ {
2311
+ id: "ai-provider/litellm",
2312
+ subject: "LiteLLM",
2313
+ packages: [],
2314
+ pyModules: ["litellm"],
2315
+ calls: { py: [["completion"], ["acompletion"]] },
2316
+ caveat: "LiteLLM sends requests on to model vendors chosen by model name and configuration, which the scan doesn't identify.",
2317
+ question: routerQuestion("LiteLLM")
2318
+ },
2319
+ {
2320
+ id: "ai-provider/openrouter",
2321
+ subject: "OpenRouter",
2322
+ packages: ["@openrouter/sdk", "@openrouter/ai-sdk-provider"],
2323
+ pyModules: [],
2324
+ calls: { js: [["chat", "send"]] },
2325
+ caveat: "OpenRouter forwards requests to model vendors chosen by model name and its routing settings, which the scan doesn't identify.",
2326
+ question: routerQuestion("OpenRouter")
2327
+ },
2203
2328
  { id: "ai-provider/vercel-ai-sdk", subject: "Vercel AI SDK", packages: ["ai"], pyModules: [] }
2204
2329
  ];
2330
+ var withCaveat = (spec, claim) => spec.caveat ? `${claim} ${spec.caveat}` : claim;
2205
2331
  function providersIn(f) {
2206
2332
  const used = AI_PROVIDERS.filter((p) => p.packages.some((pkg) => importsModule(f, pkg)));
2207
2333
  const named = used.filter((p) => p.subject !== "Vercel AI SDK");
@@ -2213,6 +2339,7 @@ function runsOn(f) {
2213
2339
  return "unclear";
2214
2340
  }
2215
2341
  function aiProviderDetector(spec) {
2342
+ const library = spec.library ?? "SDK";
2216
2343
  return {
2217
2344
  id: spec.id,
2218
2345
  skipReason: (ctx) => ctx.hasDep(...spec.packages) || spec.pyModules.length > 0 && ctx.hasPyImport(...spec.pyModules) ? null : `no ${spec.subject} package in dependencies`,
@@ -2223,7 +2350,7 @@ function aiProviderDetector(spec) {
2223
2350
  return {
2224
2351
  kind: "ai_provider",
2225
2352
  subject: spec.subject,
2226
- claim: `The app uses the ${spec.subject} SDK from server code.`,
2353
+ claim: withCaveat(spec, `The app uses the ${spec.subject} ${library} from server code.`),
2227
2354
  attributes: { sdk: imp?.module ?? spec.pyModules[0], runsOn: "server", ...model ? { model } : {} },
2228
2355
  confidence: "high",
2229
2356
  detector: spec.id,
@@ -2238,7 +2365,10 @@ function aiProviderDetector(spec) {
2238
2365
  return {
2239
2366
  kind: "ai_provider",
2240
2367
  subject: spec.subject,
2241
- claim: where2 === "browser" ? `The browser code imports the ${spec.subject} SDK.` : `The app uses the ${spec.subject} SDK${where2 === "server" ? " from server code" : ""}.`,
2368
+ claim: withCaveat(
2369
+ spec,
2370
+ where2 === "browser" ? `The browser code imports the ${spec.subject} ${library}.` : `The app uses the ${spec.subject} ${library}${where2 === "server" ? " from server code" : ""}.`
2371
+ ),
2242
2372
  attributes: { sdk: imp?.source ?? spec.packages[0], runsOn: where2, ...model ? { model } : {} },
2243
2373
  confidence: "high",
2244
2374
  detector: spec.id,
@@ -2262,17 +2392,32 @@ var AI_CALL_TAILS2 = [
2262
2392
  ["chat", "complete"],
2263
2393
  ["chat", "stream"]
2264
2394
  ];
2395
+ var AI_CALL_TAILS_ON_CLIENT = [
2396
+ ["chat", "completions", "parse"],
2397
+ ["responses", "parse"],
2398
+ ["images", "generate"],
2399
+ ["images", "edit"]
2400
+ ];
2265
2401
  var AI_CALL_FUNCTIONS = /* @__PURE__ */ new Set(["generateText", "streamText", "generateObject", "streamObject", "embed", "embedMany"]);
2402
+ var AI_CALL_MODULES = /* @__PURE__ */ new Set(["ai"]);
2266
2403
  var CONTENT_KEYS2 = /* @__PURE__ */ new Set(["content", "prompt", "input", "contents", "text", "system", "messages"]);
2267
2404
  function payloadIn(f, providers) {
2268
2405
  const requestVars = requestVariables(f.ast);
2269
2406
  const params = paramNames(f.ast);
2270
2407
  const ownTails = providers.flatMap((p) => p.calls?.js ?? []);
2271
2408
  const commands = new Set(providers.flatMap((p) => p.commands ?? []));
2409
+ const fnNames = namedImports(f.ast, AI_CALL_MODULES);
2410
+ const commandNames = namedImports(f.ast, new Set(providers.flatMap((p) => p.commands ? p.packages : [])));
2411
+ let bound;
2412
+ const resolve2 = (aliases, name, at) => {
2413
+ const imported = aliases.get(name);
2414
+ if (imported === void 0 || imported === name) return name;
2415
+ return (bound ??= localBinding(f.ast))(at, name) ? name : imported;
2416
+ };
2272
2417
  let best = null;
2273
2418
  const sends = [];
2274
2419
  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));
2420
+ const isAiCall = call.chain !== null && AI_CALL_TAILS2.some((t) => endsWith(call.chain, t)) || call.chain !== null && AI_CALL_TAILS_ON_CLIENT.some((t) => call.chain.length > t.length && 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
2421
  if (isAiCall && call.node.type === "CallExpression") sends.push({ args: call.node.arguments, ...call.line ? { line: call.line } : {} });
2277
2422
  }
2278
2423
  if (commands.size > 0) {
@@ -2280,7 +2425,8 @@ function payloadIn(f, providers) {
2280
2425
  if (n.type !== "NewExpression") return void 0;
2281
2426
  const chain = chainOf(n.callee);
2282
2427
  const line = lineOf(n);
2283
- if (chain && commands.has(chain[chain.length - 1])) sends.push({ args: n.arguments, ...line ? { line } : {} });
2428
+ const name = chain?.length === 1 ? resolve2(commandNames, chain[0], n.callee) : chain?.[chain.length - 1];
2429
+ if (name && commands.has(name)) sends.push({ args: n.arguments, ...line ? { line } : {} });
2284
2430
  return void 0;
2285
2431
  });
2286
2432
  }
@@ -2754,6 +2900,112 @@ var drizzle = {
2754
2900
  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)];
2755
2901
  })
2756
2902
  };
2903
+ var DJANGO_ENGINES = {
2904
+ "django.db.backends.postgresql": ENGINES.postgresql,
2905
+ "django.db.backends.postgresql_psycopg2": ENGINES.postgresql,
2906
+ "django.contrib.gis.db.backends.postgis": ENGINES.postgresql,
2907
+ "django.db.backends.sqlite3": ENGINES.sqlite,
2908
+ "django.contrib.gis.db.backends.spatialite": ENGINES.sqlite,
2909
+ "django.db.backends.mysql": ENGINES.mysql,
2910
+ "django.contrib.gis.db.backends.mysql": ENGINES.mysql,
2911
+ "django.db.backends.oracle": { subject: "Oracle", engine: "oracle" },
2912
+ "django.contrib.gis.db.backends.oracle": { subject: "Oracle", engine: "oracle" }
2913
+ };
2914
+ var DJANGO_MIGRATION = /(?:^|\/)[^/]+\/migrations\/0001_[^/]*\.py$/;
2915
+ function djangoDatabases(f) {
2916
+ for (const l of f.lines) {
2917
+ const t = l.toks;
2918
+ if (l.indent !== 0 || t[0]?.t !== "name" || t[0].s !== "DATABASES" || t[1]?.t !== "op" || t[1].s !== "=" && t[1].s !== ":") continue;
2919
+ let depth = 0;
2920
+ for (let i = 1; i < t.length; i++) {
2921
+ const x = t[i];
2922
+ if (x.t !== "op") continue;
2923
+ if ("([{".includes(x.s)) depth++;
2924
+ else if (")]}".includes(x.s)) depth--;
2925
+ else if (depth === 0 && x.s === "=" && t[i + 1]?.s !== "=" && !"=!<>".includes(t[i - 1].t === "op" ? t[i - 1].s : "_")) return { line: l.line, toks: t.slice(i + 1) };
2926
+ }
2927
+ }
2928
+ return null;
2929
+ }
2930
+ function engineEntries(toks) {
2931
+ const out = [];
2932
+ for (let i = 0; i < toks.length - 1; i++) {
2933
+ if (toks[i].t !== "str" || isFString(toks[i].s) || stringBody(toks[i].s) !== "ENGINE" || toks[i + 1].s !== ":") continue;
2934
+ const value = [];
2935
+ let depth = 0;
2936
+ for (let k = i + 2; k < toks.length; k++) {
2937
+ const y = toks[k];
2938
+ if (y.t === "op" && "([{".includes(y.s)) depth++;
2939
+ else if (y.t === "op" && ")]}".includes(y.s) && depth-- === 0) break;
2940
+ else if (depth === 0 && y.t === "op" && y.s === ",") break;
2941
+ value.push(y);
2942
+ }
2943
+ const plain = value.length === 1 && value[0].t === "str" && !isFString(value[0].s);
2944
+ out.push({ value: plain ? stringBody(value[0].s) : null, line: toks[i].line });
2945
+ }
2946
+ return out;
2947
+ }
2948
+ var DJANGO_TEST_SETTINGS = /(?:^|\/)(?:test|tests|testing)\.py$/;
2949
+ function isDjangoTestSettings(file, pyFiles) {
2950
+ if (!DJANGO_TEST_SETTINGS.test(file)) return false;
2951
+ const dir = file.includes("/") ? file.slice(0, file.lastIndexOf("/")) : "";
2952
+ return /(?:^|\/)settings$/.test(dir) || pyFiles.has(dir ? `${dir}/settings.py` : "settings.py");
2953
+ }
2954
+ function djangoSettings(py) {
2955
+ const files = new Set(py.map((f) => f.file));
2956
+ return py.flatMap((f) => {
2957
+ if (isDjangoTestSettings(f.file, files)) return [];
2958
+ const db = djangoDatabases(f);
2959
+ return db ? [{ file: f.file, ...db }] : [];
2960
+ });
2961
+ }
2962
+ var DJANGO_UNREAD = "The project uses Django's database layer (models or migrations), but the scan could not tell which database engine its settings name.";
2963
+ var django = {
2964
+ id: "data-store/django",
2965
+ skipReason: (ctx) => djangoSettings(ctx.py).length > 0 || ctx.py.some((f) => importsPy(f, "django.db")) ? null : "no Django database settings, models or migrations found",
2966
+ run: (ctx) => {
2967
+ const settings = djangoSettings(ctx.py);
2968
+ const facts = [];
2969
+ for (const s of settings) {
2970
+ const seen = /* @__PURE__ */ new Set();
2971
+ for (const e of engineEntries(s.toks)) {
2972
+ const known = e.value === null ? void 0 : DJANGO_ENGINES[e.value];
2973
+ if (!known || seen.has(known.subject)) continue;
2974
+ seen.add(known.subject);
2975
+ facts.push({
2976
+ kind: "data_store",
2977
+ subject: known.subject,
2978
+ claim: `The project's Django settings name ${known.subject} as a database engine (DATABASES ENGINE).`,
2979
+ attributes: { engine: known.engine },
2980
+ confidence: "high",
2981
+ detector: "data-store/django",
2982
+ key: s.file,
2983
+ locations: [{ file: s.file, line: e.line }]
2984
+ });
2985
+ }
2986
+ }
2987
+ if (facts.length > 0) return facts;
2988
+ const at = (f) => {
2989
+ const imp = importsPy(f, "django.db");
2990
+ return { file: f.file, ...imp?.line ? { line: imp.line } : {} };
2991
+ };
2992
+ const models = ctx.py.filter((f) => importsPy(f, "django.db.models") && !/(?:^|\/)migrations\//.test(f.file));
2993
+ const migrations = ctx.py.filter((f) => DJANGO_MIGRATION.test(f.file) && importsPy(f, "django.db"));
2994
+ if (models.length === 0 && migrations.length === 0) return [];
2995
+ return [
2996
+ {
2997
+ kind: "data_store",
2998
+ subject: "SQL database (Django)",
2999
+ claim: DJANGO_UNREAD,
3000
+ attributes: { engine: "sql" },
3001
+ confidence: "medium",
3002
+ detector: "data-store/django",
3003
+ key: (settings[0] ?? models[0] ?? migrations[0]).file,
3004
+ locations: [...settings.map((s) => ({ file: s.file, line: s.line })), ...models.slice(0, 3).map(at), ...migrations.slice(0, 1).map(at)]
3005
+ }
3006
+ ];
3007
+ }
3008
+ };
2757
3009
  var CONNECTION_FILE = /\.(?:py|ya?ml|toml|ini|cfg|json)$|(?:^|\/)\.env(?:\.[\w.-]+)?$/;
2758
3010
  var CONNECTION_STRING = /\b(postgres(?:ql)?(?:\+\w+)?|mysql(?:\+\w+)?|mongodb(?:\+srv)?|rediss?):\/\//gi;
2759
3011
  var CONNECTION_SUBJECT = (scheme) => {
@@ -2789,7 +3041,7 @@ var connectionString = {
2789
3041
  return facts;
2790
3042
  }
2791
3043
  };
2792
- var storeDetectors = [supabase, ...STORES.map(storeDetector), prisma, drizzle, connectionString];
3044
+ var storeDetectors = [supabase, ...STORES.map(storeDetector), prisma, drizzle, django, connectionString];
2793
3045
 
2794
3046
  // src/verify/entities.ts
2795
3047
  var EXTRA = [
@@ -2852,6 +3104,12 @@ var NUMBERS = /(?<![\w.-])\d+(?:[.,]\d+)?(?![\w-])/g;
2852
3104
  var ABSENCE = /\b(no|not|never|without|none|neither|nor|doesn't|does not|do not|don't|isn't|aren't|cannot|can't|nothing)\b/i;
2853
3105
  var QUALIFIER = /\b(inferred|appears?|appeared|suggests?|may|might|likely|probably|not confirmed|possibly)\b/i;
2854
3106
  var OVERCLAIM = /\b(compliant|certified|guarantee[sd]?|guaranteeing|fully secure|100% secure|bank-grade|military-grade|complies with|meets the requirements of)\b/i;
3107
+ var NEGATION = /\b(never|no|none|not|without|nothing|cannot)\b|\b\w+n['’]t\b/i;
3108
+ var DATA_VERB = /\b(send|sends|sent|sending|share|shares|shared|sharing|store|stores|stored|storing|log|logs|logged|logging|transmit|transmits|transmitted|transmitting|collect|collects|collected|collecting|upload|uploads|uploaded|uploading|retain|retains|retained|retaining|sell|sells|sold|selling|leave|leaves|left|leaving)\b/i;
3109
+ var VENDOR_POSITION = /\b(?:by|in|to|with)\s+["'“‘(]?([A-Z][\w.&-]*(?:\s+[A-Z][\w.&-]*)*)/g;
3110
+ var NOT_VENDORS = new Set(
3111
+ "soundings seaworthy dynamo markdown html json csv pdf word docx xlsx yaml section table appendix part figure article chapter page step the this that these those a an our your their its it january february march april may june july august september october november december monday tuesday wednesday thursday friday saturday sunday english".split(" ")
3112
+ );
2855
3113
  var PROJECT_LANGUAGE = /\b(we|our|ours|the (?:app|application|system|service|platform|product|project|code|codebase)|this (?:app|application|system|service|platform|product))\b/i;
2856
3114
  function sentencesOf(source) {
2857
3115
  const noticePresent = /not legal advice/i.test(source);
@@ -2909,6 +3167,7 @@ function verifyText(source, evidence, answers) {
2909
3167
  const texts = sourceTexts(evidence, answers);
2910
3168
  const facts = new Map(evidence.facts.map((f) => [f.id, f]));
2911
3169
  const subjectNames = evidence.facts.filter((f) => f.claimType === "observed").map((f) => f.subject);
3170
+ const evidenceText = lower(evidence.facts.map((f) => texts.get(f.id) ?? "").join(" "));
2912
3171
  const { sentences: sentences2, noticePresent } = sentencesOf(source);
2913
3172
  let withRefs = 0;
2914
3173
  const add = (severity, code, b, message) => issues.push({ severity, code, line: b.line, sentence: b.text, message });
@@ -2923,9 +3182,14 @@ function verifyText(source, evidence, answers) {
2923
3182
  add("error", "overclaim", b, `Wording that implies legal assurance ("${body.match(OVERCLAIM)[0]}"). Soundings documents describe what the code shows and never claim compliance, certification or guarantees.`);
2924
3183
  }
2925
3184
  if (refs.length === 0) {
3185
+ const vendor = unlistedVendor(body, evidenceText);
2926
3186
  if (mentioned.length > 0 || numbers.length > 0 || places.length > 0) {
2927
3187
  const what = [...mentioned, ...numbers, ...places].slice(0, 3).join(", ");
2928
3188
  add("error", "missing-reference", b, `States something specific (${what}) with no evidence or answer reference.`);
3189
+ } else if (vendor) {
3190
+ add("warning", "unreferenced-statement", b, `Names "${vendor}" as part of how the project works, but cites no source and the evidence doesn't mention "${vendor}".`);
3191
+ } else if (NEGATION.test(body) && DATA_VERB.test(body)) {
3192
+ add("warning", "unreferenced-statement", b, "Says something is not done with data (sent, shared, stored, logged, collected, sold and the like) but cites no source. A claim that something does not happen needs a source too.");
2929
3193
  } else if (PROJECT_LANGUAGE.test(body)) {
2930
3194
  add("warning", "unreferenced-statement", b, "Reads as a statement about the project but cites no source.");
2931
3195
  }
@@ -2976,10 +3240,21 @@ function verifyText(source, evidence, answers) {
2976
3240
  ok: !issues.some((i) => i.severity === "error")
2977
3241
  };
2978
3242
  }
3243
+ function verifyFailed(report, strict) {
3244
+ return !report.ok || strict && report.issues.length > 0;
3245
+ }
3246
+ function unlistedVendor(body, evidenceText) {
3247
+ for (const m of body.matchAll(VENDOR_POSITION)) {
3248
+ const name = m[1].replace(/["'”’)]?[.,;:]*$/, "");
3249
+ if (NOT_VENDORS.has(name.split(/\s+/)[0].toLowerCase())) continue;
3250
+ if (!evidenceText.includes(name.toLowerCase())) return name;
3251
+ }
3252
+ return void 0;
3253
+ }
2979
3254
 
2980
3255
  // src/reporters/verify.ts
2981
3256
  import pc from "picocolors";
2982
- function renderVerify(report, file) {
3257
+ function renderVerify(report, file, opts = {}) {
2983
3258
  const out = [""];
2984
3259
  const errors = report.issues.filter((i) => i.severity === "error");
2985
3260
  const warnings = report.issues.filter((i) => i.severity === "warning");
@@ -2991,11 +3266,14 @@ function renderVerify(report, file) {
2991
3266
  out.push("");
2992
3267
  }
2993
3268
  const summary = `${report.sentencesChecked} sentences checked, ${report.sentencesWithReferences} with references.`;
2994
- if (report.ok) {
2995
- out.push(` ${pc.green("Passed.")} ${summary}${warnings.length ? ` ${warnings.length} warning${warnings.length === 1 ? "" : "s"}.` : ""}`);
3269
+ const plural = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
3270
+ if (!verifyFailed(report, Boolean(opts.strict))) {
3271
+ out.push(` ${pc.green("Passed.")} ${summary}${warnings.length ? ` ${plural(warnings.length, "warning")}.` : ""}`);
2996
3272
  out.push(` ${pc.dim("Every statement points to a source that exists and mentions what the sentence mentions. That is not proof the source is right.")}`);
3273
+ } else if (errors.length > 0) {
3274
+ out.push(` ${pc.red(`Failed: ${plural(errors.length, "problem")}.`)} ${summary}${opts.strict && warnings.length ? ` ${plural(warnings.length, "warning")}, counted as failures with --strict.` : ""}`);
2997
3275
  } else {
2998
- out.push(` ${pc.red(`Failed: ${errors.length} problem${errors.length === 1 ? "" : "s"}.`)} ${summary}`);
3276
+ out.push(` ${pc.red(`Failed: ${plural(warnings.length, "warning")}, counted as a failure with --strict.`)} ${summary}`);
2999
3277
  }
3000
3278
  out.push("");
3001
3279
  return out.join("\n");
@@ -3601,7 +3879,7 @@ function readGitignore(dir) {
3601
3879
  }
3602
3880
 
3603
3881
  // src/version.ts
3604
- var VERSION = "0.2.0";
3882
+ var VERSION = "0.3.0";
3605
3883
 
3606
3884
  // src/scanner/detectors/exposure.ts
3607
3885
  var PUBLIC_PREFIX = /^(?:NEXT_PUBLIC_|VITE_|REACT_APP_|EXPO_PUBLIC_|NUXT_PUBLIC_|GATSBY_|PUBLIC_)/;
@@ -3881,6 +4159,8 @@ function unknownsFor(all, unanalysed2 = false) {
3881
4159
  { kind: "data_flow", subject }
3882
4160
  ]
3883
4161
  });
4162
+ const extra = AI_PROVIDERS.find((p) => p.subject === subject)?.question;
4163
+ if (extra) add({ ...extra, related: [{ kind: "ai_provider", subject }, { kind: "data_flow", subject }] });
3884
4164
  }
3885
4165
  const stores = [...new Set(facts.filter((f) => f.kind === "data_store").map((f) => f.subject))];
3886
4166
  for (const subject of stores) {
@@ -3988,9 +4268,9 @@ function unanalysedQuestion(unsupported) {
3988
4268
  why: "Soundings reads JavaScript and TypeScript only, so what the other code does is not in this scan."
3989
4269
  };
3990
4270
  }
3991
- var SPECIFIC_SQL = /* @__PURE__ */ new Set(["PostgreSQL", "MySQL", "Supabase Postgres", "SQLite", "SQL Server", "CockroachDB"]);
3992
- var GENERIC_SQL = /* @__PURE__ */ new Set(["SQL database (SQLAlchemy)", "SQL database (Prisma)", "SQL database (Drizzle)"]);
3993
- var ORMS = ["data-store/prisma", "data-store/drizzle"];
4271
+ var SPECIFIC_SQL = /* @__PURE__ */ new Set(["PostgreSQL", "MySQL", "Supabase Postgres", "SQLite", "SQL Server", "CockroachDB", "Oracle"]);
4272
+ var GENERIC_SQL = /* @__PURE__ */ new Set(["SQL database (SQLAlchemy)", "SQL database (Prisma)", "SQL database (Drizzle)", "SQL database (Django)"]);
4273
+ var ORMS = ["data-store/prisma", "data-store/drizzle", "data-store/django"];
3994
4274
  var ormRank = (f) => ORMS.indexOf(f.detector);
3995
4275
  function dropRedundant(facts) {
3996
4276
  const stores = facts.filter((f) => f.kind === "data_store" && f.claimType !== "not-found");
@@ -4882,9 +5162,9 @@ function runVerifyCommand(values, file, deps) {
4882
5162
  const evidence = loadEvidence(evidencePath(values, deps));
4883
5163
  const answers = loadAnswers(answersPath(values, deps));
4884
5164
  const report = verifyText(readFileSync8(path, "utf8"), evidence, answers);
4885
- deps.out(format === "json" ? JSON.stringify(report, null, 2) : renderVerify(report, relative2(deps.cwd, path) || file));
4886
- const failed = !report.ok || Boolean(values.strict) && report.issues.length > 0;
4887
- return failed ? 1 : 0;
5165
+ const strict = Boolean(values.strict);
5166
+ deps.out(format === "json" ? JSON.stringify(report, null, 2) : renderVerify(report, relative2(deps.cwd, path) || file, { strict }));
5167
+ return verifyFailed(report, strict) ? 1 : 0;
4888
5168
  }
4889
5169
  function runAnswerCommand(values, file, deps) {
4890
5170
  if (!file) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soundings-cli",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Evidence-backed answers to security questionnaires, run locally.",
5
5
  "homepage": "https://dynamomaritime.com/soundings",
6
6
  "bugs": {