soundings-cli 0.2.1 → 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.
- package/README.md +3 -3
- package/dist/cli.js +200 -15
- 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.
|
|
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,7 +16,7 @@ soundings verify draft.md # check any text against the evidence
|
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
```
|
|
19
|
-
Soundings 0.
|
|
19
|
+
Soundings 0.3.0 · notes-saas · nextjs, react, stripe, supabase-js
|
|
20
20
|
11 files, 15 detectors, 62 ms. Your code never left this machine.
|
|
21
21
|
|
|
22
22
|
AI providers
|
|
@@ -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
|
|
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
|
@@ -2265,6 +2265,12 @@ var importsModule = (f, source) => f.imports.find((i) => i.source === source ||
|
|
|
2265
2265
|
var importsPy = (f, ...modules) => f.imports.find((imp) => importCandidates(imp).some((c) => modules.some((m) => withinModule(c, m))));
|
|
2266
2266
|
|
|
2267
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
|
+
});
|
|
2268
2274
|
var AI_PROVIDERS = [
|
|
2269
2275
|
{ id: "ai-provider/openai-sdk", subject: "OpenAI", packages: ["openai", "@ai-sdk/openai"], pyModules: ["openai", "langchain_openai"] },
|
|
2270
2276
|
{ id: "ai-provider/anthropic-sdk", subject: "Anthropic", packages: ["@anthropic-ai/sdk", "@ai-sdk/anthropic"], pyModules: ["anthropic", "langchain_anthropic"] },
|
|
@@ -2285,8 +2291,43 @@ var AI_PROVIDERS = [
|
|
|
2285
2291
|
pyModules: ["langchain_aws"],
|
|
2286
2292
|
commands: ["ConverseCommand", "ConverseStreamCommand"]
|
|
2287
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
|
+
},
|
|
2288
2328
|
{ id: "ai-provider/vercel-ai-sdk", subject: "Vercel AI SDK", packages: ["ai"], pyModules: [] }
|
|
2289
2329
|
];
|
|
2330
|
+
var withCaveat = (spec, claim) => spec.caveat ? `${claim} ${spec.caveat}` : claim;
|
|
2290
2331
|
function providersIn(f) {
|
|
2291
2332
|
const used = AI_PROVIDERS.filter((p) => p.packages.some((pkg) => importsModule(f, pkg)));
|
|
2292
2333
|
const named = used.filter((p) => p.subject !== "Vercel AI SDK");
|
|
@@ -2298,6 +2339,7 @@ function runsOn(f) {
|
|
|
2298
2339
|
return "unclear";
|
|
2299
2340
|
}
|
|
2300
2341
|
function aiProviderDetector(spec) {
|
|
2342
|
+
const library = spec.library ?? "SDK";
|
|
2301
2343
|
return {
|
|
2302
2344
|
id: spec.id,
|
|
2303
2345
|
skipReason: (ctx) => ctx.hasDep(...spec.packages) || spec.pyModules.length > 0 && ctx.hasPyImport(...spec.pyModules) ? null : `no ${spec.subject} package in dependencies`,
|
|
@@ -2308,7 +2350,7 @@ function aiProviderDetector(spec) {
|
|
|
2308
2350
|
return {
|
|
2309
2351
|
kind: "ai_provider",
|
|
2310
2352
|
subject: spec.subject,
|
|
2311
|
-
claim: `The app uses the ${spec.subject}
|
|
2353
|
+
claim: withCaveat(spec, `The app uses the ${spec.subject} ${library} from server code.`),
|
|
2312
2354
|
attributes: { sdk: imp?.module ?? spec.pyModules[0], runsOn: "server", ...model ? { model } : {} },
|
|
2313
2355
|
confidence: "high",
|
|
2314
2356
|
detector: spec.id,
|
|
@@ -2323,7 +2365,10 @@ function aiProviderDetector(spec) {
|
|
|
2323
2365
|
return {
|
|
2324
2366
|
kind: "ai_provider",
|
|
2325
2367
|
subject: spec.subject,
|
|
2326
|
-
claim:
|
|
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
|
+
),
|
|
2327
2372
|
attributes: { sdk: imp?.source ?? spec.packages[0], runsOn: where2, ...model ? { model } : {} },
|
|
2328
2373
|
confidence: "high",
|
|
2329
2374
|
detector: spec.id,
|
|
@@ -2347,6 +2392,12 @@ var AI_CALL_TAILS2 = [
|
|
|
2347
2392
|
["chat", "complete"],
|
|
2348
2393
|
["chat", "stream"]
|
|
2349
2394
|
];
|
|
2395
|
+
var AI_CALL_TAILS_ON_CLIENT = [
|
|
2396
|
+
["chat", "completions", "parse"],
|
|
2397
|
+
["responses", "parse"],
|
|
2398
|
+
["images", "generate"],
|
|
2399
|
+
["images", "edit"]
|
|
2400
|
+
];
|
|
2350
2401
|
var AI_CALL_FUNCTIONS = /* @__PURE__ */ new Set(["generateText", "streamText", "generateObject", "streamObject", "embed", "embedMany"]);
|
|
2351
2402
|
var AI_CALL_MODULES = /* @__PURE__ */ new Set(["ai"]);
|
|
2352
2403
|
var CONTENT_KEYS2 = /* @__PURE__ */ new Set(["content", "prompt", "input", "contents", "text", "system", "messages"]);
|
|
@@ -2366,7 +2417,7 @@ function payloadIn(f, providers) {
|
|
|
2366
2417
|
let best = null;
|
|
2367
2418
|
const sends = [];
|
|
2368
2419
|
for (const call of calls(f.ast)) {
|
|
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));
|
|
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));
|
|
2370
2421
|
if (isAiCall && call.node.type === "CallExpression") sends.push({ args: call.node.arguments, ...call.line ? { line: call.line } : {} });
|
|
2371
2422
|
}
|
|
2372
2423
|
if (commands.size > 0) {
|
|
@@ -2849,6 +2900,112 @@ var drizzle = {
|
|
|
2849
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)];
|
|
2850
2901
|
})
|
|
2851
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
|
+
};
|
|
2852
3009
|
var CONNECTION_FILE = /\.(?:py|ya?ml|toml|ini|cfg|json)$|(?:^|\/)\.env(?:\.[\w.-]+)?$/;
|
|
2853
3010
|
var CONNECTION_STRING = /\b(postgres(?:ql)?(?:\+\w+)?|mysql(?:\+\w+)?|mongodb(?:\+srv)?|rediss?):\/\//gi;
|
|
2854
3011
|
var CONNECTION_SUBJECT = (scheme) => {
|
|
@@ -2884,7 +3041,7 @@ var connectionString = {
|
|
|
2884
3041
|
return facts;
|
|
2885
3042
|
}
|
|
2886
3043
|
};
|
|
2887
|
-
var storeDetectors = [supabase, ...STORES.map(storeDetector), prisma, drizzle, connectionString];
|
|
3044
|
+
var storeDetectors = [supabase, ...STORES.map(storeDetector), prisma, drizzle, django, connectionString];
|
|
2888
3045
|
|
|
2889
3046
|
// src/verify/entities.ts
|
|
2890
3047
|
var EXTRA = [
|
|
@@ -2947,6 +3104,12 @@ var NUMBERS = /(?<![\w.-])\d+(?:[.,]\d+)?(?![\w-])/g;
|
|
|
2947
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;
|
|
2948
3105
|
var QUALIFIER = /\b(inferred|appears?|appeared|suggests?|may|might|likely|probably|not confirmed|possibly)\b/i;
|
|
2949
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
|
+
);
|
|
2950
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;
|
|
2951
3114
|
function sentencesOf(source) {
|
|
2952
3115
|
const noticePresent = /not legal advice/i.test(source);
|
|
@@ -3004,6 +3167,7 @@ function verifyText(source, evidence, answers) {
|
|
|
3004
3167
|
const texts = sourceTexts(evidence, answers);
|
|
3005
3168
|
const facts = new Map(evidence.facts.map((f) => [f.id, f]));
|
|
3006
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(" "));
|
|
3007
3171
|
const { sentences: sentences2, noticePresent } = sentencesOf(source);
|
|
3008
3172
|
let withRefs = 0;
|
|
3009
3173
|
const add = (severity, code, b, message) => issues.push({ severity, code, line: b.line, sentence: b.text, message });
|
|
@@ -3018,9 +3182,14 @@ function verifyText(source, evidence, answers) {
|
|
|
3018
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.`);
|
|
3019
3183
|
}
|
|
3020
3184
|
if (refs.length === 0) {
|
|
3185
|
+
const vendor = unlistedVendor(body, evidenceText);
|
|
3021
3186
|
if (mentioned.length > 0 || numbers.length > 0 || places.length > 0) {
|
|
3022
3187
|
const what = [...mentioned, ...numbers, ...places].slice(0, 3).join(", ");
|
|
3023
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.");
|
|
3024
3193
|
} else if (PROJECT_LANGUAGE.test(body)) {
|
|
3025
3194
|
add("warning", "unreferenced-statement", b, "Reads as a statement about the project but cites no source.");
|
|
3026
3195
|
}
|
|
@@ -3071,10 +3240,21 @@ function verifyText(source, evidence, answers) {
|
|
|
3071
3240
|
ok: !issues.some((i) => i.severity === "error")
|
|
3072
3241
|
};
|
|
3073
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
|
+
}
|
|
3074
3254
|
|
|
3075
3255
|
// src/reporters/verify.ts
|
|
3076
3256
|
import pc from "picocolors";
|
|
3077
|
-
function renderVerify(report, file) {
|
|
3257
|
+
function renderVerify(report, file, opts = {}) {
|
|
3078
3258
|
const out = [""];
|
|
3079
3259
|
const errors = report.issues.filter((i) => i.severity === "error");
|
|
3080
3260
|
const warnings = report.issues.filter((i) => i.severity === "warning");
|
|
@@ -3086,11 +3266,14 @@ function renderVerify(report, file) {
|
|
|
3086
3266
|
out.push("");
|
|
3087
3267
|
}
|
|
3088
3268
|
const summary = `${report.sentencesChecked} sentences checked, ${report.sentencesWithReferences} with references.`;
|
|
3089
|
-
|
|
3090
|
-
|
|
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")}.` : ""}`);
|
|
3091
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.` : ""}`);
|
|
3092
3275
|
} else {
|
|
3093
|
-
out.push(` ${pc.red(`Failed: ${
|
|
3276
|
+
out.push(` ${pc.red(`Failed: ${plural(warnings.length, "warning")}, counted as a failure with --strict.`)} ${summary}`);
|
|
3094
3277
|
}
|
|
3095
3278
|
out.push("");
|
|
3096
3279
|
return out.join("\n");
|
|
@@ -3696,7 +3879,7 @@ function readGitignore(dir) {
|
|
|
3696
3879
|
}
|
|
3697
3880
|
|
|
3698
3881
|
// src/version.ts
|
|
3699
|
-
var VERSION = "0.
|
|
3882
|
+
var VERSION = "0.3.0";
|
|
3700
3883
|
|
|
3701
3884
|
// src/scanner/detectors/exposure.ts
|
|
3702
3885
|
var PUBLIC_PREFIX = /^(?:NEXT_PUBLIC_|VITE_|REACT_APP_|EXPO_PUBLIC_|NUXT_PUBLIC_|GATSBY_|PUBLIC_)/;
|
|
@@ -3976,6 +4159,8 @@ function unknownsFor(all, unanalysed2 = false) {
|
|
|
3976
4159
|
{ kind: "data_flow", subject }
|
|
3977
4160
|
]
|
|
3978
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 }] });
|
|
3979
4164
|
}
|
|
3980
4165
|
const stores = [...new Set(facts.filter((f) => f.kind === "data_store").map((f) => f.subject))];
|
|
3981
4166
|
for (const subject of stores) {
|
|
@@ -4083,9 +4268,9 @@ function unanalysedQuestion(unsupported) {
|
|
|
4083
4268
|
why: "Soundings reads JavaScript and TypeScript only, so what the other code does is not in this scan."
|
|
4084
4269
|
};
|
|
4085
4270
|
}
|
|
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"];
|
|
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"];
|
|
4089
4274
|
var ormRank = (f) => ORMS.indexOf(f.detector);
|
|
4090
4275
|
function dropRedundant(facts) {
|
|
4091
4276
|
const stores = facts.filter((f) => f.kind === "data_store" && f.claimType !== "not-found");
|
|
@@ -4977,9 +5162,9 @@ function runVerifyCommand(values, file, deps) {
|
|
|
4977
5162
|
const evidence = loadEvidence(evidencePath(values, deps));
|
|
4978
5163
|
const answers = loadAnswers(answersPath(values, deps));
|
|
4979
5164
|
const report = verifyText(readFileSync8(path, "utf8"), evidence, answers);
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
return
|
|
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;
|
|
4983
5168
|
}
|
|
4984
5169
|
function runAnswerCommand(values, file, deps) {
|
|
4985
5170
|
if (!file) {
|