xploitscan-shared-rules 2.4.31 → 2.4.33

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/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var SCANNER_VERSION = "2.4.31";
2
+ var SCANNER_VERSION = "2.4.33";
3
3
 
4
4
  // src/snippet.ts
5
5
  var cacheContent = null;
@@ -1271,6 +1271,121 @@ function calleeIsGuarded(fn, route, files) {
1271
1271
  const open = defs[0].index + defs[0][0].length - 1;
1272
1272
  return opensWithGuard(targets[0].content.slice(open, open + 4e3));
1273
1273
  }
1274
+ var DEF_HEAD_RE = /\b(?:function|const|let)\s+([A-Za-z_$][\w$]*)/g;
1275
+ var GENERIC_DEF_RE = new RegExp(
1276
+ `\\bfunction\\s+([A-Za-z_$][\\w$]*)\\s*\\([^()]{0,200}\\)[^{;]{0,80}\\{|\\b(?:const|let)\\s+([A-Za-z_$][\\w$]*)\\s*(?::[^=;\\n]{0,80})?=\\s*(?:async\\s*)?\\([^()]{0,200}\\)[^{;=]{0,80}=>\\s*\\{`,
1277
+ "y"
1278
+ );
1279
+ var ENV_READ = "process.env";
1280
+ var MAX_GUARDED_CANDIDATES = 50;
1281
+ function importSpec(fn, route) {
1282
+ for (const m of route.matchAll(/\bimport\s*\{([^{}]{0,1000})\}\s*from\s*["']([^"'\n]{1,200})["']/g)) {
1283
+ if (m[1].split(",").some((n) => n.trim() === fn)) return m[2];
1284
+ }
1285
+ return null;
1286
+ }
1287
+ function definesGuarded(fn, content) {
1288
+ const F = esc(fn);
1289
+ const defRe = new RegExp(
1290
+ `\\bfunction\\s+${F}\\s*\\([^()]{0,200}\\)[^{;]{0,80}\\{|\\b(?:const|let)\\s+${F}\\s*(?::[^=;\\n]{0,80})?=\\s*(?:async\\s*)?\\([^()]{0,200}\\)[^{;=]{0,80}=>\\s*\\{`,
1291
+ "g"
1292
+ );
1293
+ const defs = [...content.matchAll(defRe)];
1294
+ if (defs.length !== 1) return false;
1295
+ const open = defs[0].index + defs[0][0].length - 1;
1296
+ return opensWithGuard(content.slice(open, open + 4e3));
1297
+ }
1298
+ function envReads(content) {
1299
+ const out = [];
1300
+ for (let i = content.indexOf(ENV_READ); i !== -1; i = content.indexOf(ENV_READ, i + 1)) out.push(i);
1301
+ return out;
1302
+ }
1303
+ function anyIn(sorted, from, to) {
1304
+ let lo = 0;
1305
+ let hi = sorted.length;
1306
+ while (lo < hi) {
1307
+ const mid = lo + hi >>> 1;
1308
+ if (sorted[mid] < from) lo = mid + 1;
1309
+ else hi = mid;
1310
+ }
1311
+ return lo < sorted.length && sorted[lo] < to;
1312
+ }
1313
+ function guardedHelperNames(content) {
1314
+ const reads = envReads(content);
1315
+ if (reads.length === 0) return [];
1316
+ const candidates = [];
1317
+ const seen = /* @__PURE__ */ new Set();
1318
+ DEF_HEAD_RE.lastIndex = 0;
1319
+ for (let m = DEF_HEAD_RE.exec(content); m !== null; m = DEF_HEAD_RE.exec(content)) {
1320
+ if (seen.has(m[1])) continue;
1321
+ GENERIC_DEF_RE.lastIndex = m.index;
1322
+ const def = GENERIC_DEF_RE.exec(content);
1323
+ if (def === null || (def[1] ?? def[2]) !== m[1]) continue;
1324
+ const open = m.index + def[0].length - 1;
1325
+ if (!anyIn(reads, open, open + 4e3)) continue;
1326
+ if (!opensWithGuard(content.slice(open, open + 4e3))) continue;
1327
+ seen.add(m[1]);
1328
+ candidates.push(m[1]);
1329
+ if (candidates.length >= MAX_GUARDED_CANDIDATES) break;
1330
+ }
1331
+ DEF_HEAD_RE.lastIndex = 0;
1332
+ return candidates.filter((name) => definesGuarded(name, content));
1333
+ }
1334
+ function routeDelegationFacts(files) {
1335
+ const routes = [];
1336
+ const helpers = [];
1337
+ for (const f of files) {
1338
+ if (/\.[jt]sx?$/.test(f.path)) {
1339
+ const names = guardedHelperNames(f.content);
1340
+ if (names.length > 0) helpers.push({ path: f.path, names });
1341
+ }
1342
+ if (!ROUTE_FILE_RE.test(f.path) || OTHER_EXPORT_RE.test(f.content)) continue;
1343
+ const exported = firstMatches(f.content, HANDLER_EXPORT_RE, 8);
1344
+ if (exported.length === 0 || exported.length > 7) continue;
1345
+ const callees = /* @__PURE__ */ new Set();
1346
+ let readable = true;
1347
+ for (const e of exported) {
1348
+ DELEGATING_HANDLER_RE.lastIndex = e.index;
1349
+ const h = DELEGATING_HANDLER_RE.exec(f.content);
1350
+ if (h !== null) {
1351
+ callees.add(h[2]);
1352
+ continue;
1353
+ }
1354
+ HANDLER_HEAD_RE.lastIndex = e.index;
1355
+ const head = HANDLER_HEAD_RE.exec(f.content);
1356
+ const open = head === null ? -1 : e.index + head[0].length - 1;
1357
+ if (open === -1 || !opensWithGuard(f.content.slice(open, open + 4e3))) {
1358
+ readable = false;
1359
+ break;
1360
+ }
1361
+ }
1362
+ if (!readable) continue;
1363
+ routes.push({ path: f.path, callees: [...callees].map((fn) => ({ fn, spec: importSpec(fn, f.content) })) });
1364
+ }
1365
+ return { routes, helpers };
1366
+ }
1367
+ function resolveSecretGuardedRoutes(routes, helpers, paths) {
1368
+ const all = [...new Set(paths)];
1369
+ const guardedBy = /* @__PURE__ */ new Map();
1370
+ for (const h of helpers) {
1371
+ const set = guardedBy.get(h.path) ?? /* @__PURE__ */ new Set();
1372
+ for (const name of h.names) set.add(name);
1373
+ guardedBy.set(h.path, set);
1374
+ }
1375
+ const out = /* @__PURE__ */ new Set();
1376
+ for (const route of routes) {
1377
+ const ok = route.callees.every(({ fn, spec }) => {
1378
+ if (spec === null) return false;
1379
+ const tail = spec.replace(/^(?:@|~)\//, "").replace(/^(?:\.\.?\/)+/, "");
1380
+ const tailRe = new RegExp(`(?:^|/)${esc(tail)}(?:\\.[jt]sx?|/index\\.[jt]sx?)$`);
1381
+ const targets = all.filter((p) => tailRe.test(p));
1382
+ if (targets.length !== 1) return false;
1383
+ return guardedBy.get(targets[0])?.has(fn) === true;
1384
+ });
1385
+ if (ok) out.add(route.path);
1386
+ }
1387
+ return out;
1388
+ }
1274
1389
 
1275
1390
  // src/project-context.ts
1276
1391
  var TOML_FN_SECTION_RE = /^\s*\[functions\.(?:"([^"]+)"|([A-Za-z0-9._-]+))\]\s*$/;
@@ -1538,12 +1653,34 @@ function normalize2(p) {
1538
1653
  return p;
1539
1654
  }
1540
1655
  function extractRoutes(files) {
1656
+ const claims = collectRouteClaims(files);
1657
+ return assembleRoutes([...claims.manifest?.routes ?? [], ...claims.declared]);
1658
+ }
1659
+ function mergeRouteClaims(parts) {
1660
+ const manifest = parts.find((part) => part.manifest !== null)?.manifest ?? null;
1661
+ return assembleRoutes([...manifest?.routes ?? [], ...parts.flatMap((part) => part.declared)]);
1662
+ }
1663
+ function assembleRoutes(claims) {
1541
1664
  const routes = /* @__PURE__ */ new Map();
1542
1665
  const frameworks = /* @__PURE__ */ new Set();
1543
- const add = (raw, framework, source, kindOverride) => {
1666
+ for (const claim of claims) {
1667
+ if (routes.has(claim.path)) continue;
1668
+ routes.set(claim.path, claim);
1669
+ frameworks.add(claim.framework);
1670
+ }
1671
+ return {
1672
+ frameworks: [...frameworks],
1673
+ routes: [...routes.values()].sort((a, b) => a.path.localeCompare(b.path))
1674
+ };
1675
+ }
1676
+ function collectRouteClaims(files) {
1677
+ const declaredPaths = /* @__PURE__ */ new Set();
1678
+ const declared = [];
1679
+ let manifest = null;
1680
+ const claim = (raw, framework, source, kindOverride) => {
1544
1681
  const path = normalize2(raw);
1545
- if (!path || routes.has(path)) return;
1546
- routes.set(path, {
1682
+ if (!path) return null;
1683
+ return {
1547
1684
  path,
1548
1685
  // The URL prefix is a fallback, not the authority. A Next `route.ts` is a
1549
1686
  // handler wherever it lives: /free-trust-page/claim/start/route.ts is an
@@ -1553,8 +1690,13 @@ function extractRoutes(files) {
1553
1690
  dynamic: DYNAMIC_RE.test(path),
1554
1691
  framework,
1555
1692
  source
1556
- });
1557
- frameworks.add(framework);
1693
+ };
1694
+ };
1695
+ const add = (raw, framework, source, kindOverride) => {
1696
+ const route = claim(raw, framework, source, kindOverride);
1697
+ if (!route || declaredPaths.has(route.path)) return;
1698
+ declaredPaths.add(route.path);
1699
+ declared.push(route);
1558
1700
  };
1559
1701
  const isNext = hasDep(files, "next");
1560
1702
  const isExpress = hasDep(files, "express") || hasDep(files, "hono") || hasDep(files, "koa");
@@ -1562,10 +1704,16 @@ function extractRoutes(files) {
1562
1704
  if (isTanstack) {
1563
1705
  const gen = files.find((f) => f.path.endsWith("routeTree.gen.ts"));
1564
1706
  if (gen) {
1707
+ const listed = [];
1708
+ const seen = /* @__PURE__ */ new Set();
1565
1709
  for (const m of gen.content.matchAll(/'(\/[A-Za-z0-9_\-/$.]*)'/g)) {
1566
1710
  if (m[1].split("/").some((seg) => seg.startsWith("_"))) continue;
1567
- add(m[1], "tanstack-router", gen.path);
1711
+ const route = claim(m[1], "tanstack-router", gen.path);
1712
+ if (!route || seen.has(route.path)) continue;
1713
+ seen.add(route.path);
1714
+ listed.push(route);
1568
1715
  }
1716
+ manifest = { source: gen.path, routes: listed };
1569
1717
  }
1570
1718
  }
1571
1719
  for (const file of files) {
@@ -1613,10 +1761,7 @@ function extractRoutes(files) {
1613
1761
  }
1614
1762
  }
1615
1763
  }
1616
- return {
1617
- frameworks: [...frameworks],
1618
- routes: [...routes.values()].sort((a, b) => a.path.localeCompare(b.path))
1619
- };
1764
+ return { manifest, declared };
1620
1765
  }
1621
1766
  function routeForFile(table, filePath) {
1622
1767
  const norm = filePath.replace(/^\.\//, "");
@@ -1870,10 +2015,24 @@ var CHECKABLE_CLAIMS = [
1870
2015
  { id: "verified-webhooks", label: "which webhooks are verified", example: "Stripe webhooks are signature verified." },
1871
2016
  { id: "rate-limited", label: "what is rate limited", example: "The public API is rate limited." }
1872
2017
  ];
1873
- function checkIntent(files, findings) {
1874
- const statements = harvestIntent(files);
2018
+ function mergeIntentStatements(parts) {
2019
+ const claimed = /* @__PURE__ */ new Set();
2020
+ const out = [];
2021
+ for (const part of parts) {
2022
+ const own = /* @__PURE__ */ new Set();
2023
+ for (const statement of part) {
2024
+ if (claimed.has(statement.source)) continue;
2025
+ own.add(statement.source);
2026
+ out.push(statement);
2027
+ }
2028
+ for (const source of own) claimed.add(source);
2029
+ }
2030
+ return out;
2031
+ }
2032
+ function checkIntent(files, findings, inputs = {}) {
2033
+ const statements = inputs.statements ?? harvestIntent(files);
1875
2034
  const sources = [...new Set(statements.map((s) => s.source))];
1876
- const routes = extractRoutes(files).routes;
2035
+ const routes = inputs.routes ?? extractRoutes(files).routes;
1877
2036
  const mismatches = [];
1878
2037
  const unchallenged = [];
1879
2038
  const uncheckable = [];
@@ -10078,6 +10237,70 @@ function callWasAborted(err) {
10078
10237
  const name = "name" in err ? String(err.name) : "";
10079
10238
  return name === "AbortError" || name === "APIUserAbortError";
10080
10239
  }
10240
+ var SAFE_ERROR_IDENT = /^[A-Za-z][A-Za-z0-9_]{0,63}$/;
10241
+ var SAFE_ERROR_CODE = /^[A-Z][A-Z0-9_]{1,47}$/;
10242
+ function safeIdent(value) {
10243
+ return typeof value === "string" && SAFE_ERROR_IDENT.test(value) ? value : null;
10244
+ }
10245
+ function errorClassChain(err) {
10246
+ const names = [];
10247
+ let proto = Object.getPrototypeOf(err);
10248
+ for (let depth = 0; proto && depth < 8; depth++) {
10249
+ const ctor = proto.constructor;
10250
+ const name = safeIdent(ctor?.name);
10251
+ if (name && name !== "Object") names.push(name);
10252
+ proto = Object.getPrototypeOf(proto);
10253
+ }
10254
+ return names;
10255
+ }
10256
+ function causeLabel(err) {
10257
+ const cause = err.cause;
10258
+ if (!cause || typeof cause !== "object") return null;
10259
+ const chain = errorClassChain(cause);
10260
+ const name = chain[0] ?? safeIdent(cause.name);
10261
+ let code = null;
10262
+ let node = cause;
10263
+ for (let depth = 0; node && typeof node === "object" && depth < 3 && !code; depth++) {
10264
+ const raw = node.code;
10265
+ if (typeof raw === "string" && SAFE_ERROR_CODE.test(raw)) code = raw;
10266
+ node = node.cause;
10267
+ }
10268
+ if (!name && !code) return null;
10269
+ return code ? `${name ?? "unknown"}/${code}` : name;
10270
+ }
10271
+ function classifyModelError(err) {
10272
+ if (!err || typeof err !== "object") {
10273
+ return { name: "unknown", category: "unknown", status: null, cause: null };
10274
+ }
10275
+ const chain = errorClassChain(err);
10276
+ const ownName = safeIdent(err.name);
10277
+ const specific = chain.find((name2) => name2 !== "Error");
10278
+ const name = specific ?? (ownName && ownName !== "Error" ? ownName : chain[0] ?? ownName ?? "unknown");
10279
+ const status = errorHttpStatus(err);
10280
+ const names = new Set(chain);
10281
+ if (ownName) names.add(ownName);
10282
+ let category = "unknown";
10283
+ if (status === 401 || status === 403) category = "auth";
10284
+ else if (status === 400) category = "bad_request";
10285
+ else if (status === 429) category = "rate_limit";
10286
+ else if (status != null && status >= 500) category = "server";
10287
+ else if (status != null && status >= 400) category = "client";
10288
+ else if (names.has("APIConnectionTimeoutError") || names.has("TimeoutError")) category = "timeout";
10289
+ else if (names.has("APIUserAbortError") || names.has("AbortError")) category = "abort";
10290
+ else if (names.has("APIConnectionError")) category = "connection";
10291
+ const cause = causeLabel(err);
10292
+ if (category === "unknown" && cause && cause.includes("/")) category = "connection";
10293
+ return { name, category, status, cause };
10294
+ }
10295
+ function isRetryableModelError(info) {
10296
+ if (info.category === "timeout" || info.category === "abort") return false;
10297
+ if (info.status == null) return true;
10298
+ if (info.status === 408 || info.status === 409 || info.status === 429) return true;
10299
+ return info.status >= 500;
10300
+ }
10301
+ var MODEL_RETRY_DELAY_MS = 300;
10302
+ var HOSTED_RETRY_SURFACES = /* @__PURE__ */ new Set(["api", "web", "app"]);
10303
+ var MAX_MODEL_THROW_LOGS = 3;
10081
10304
  var SEVERITY_PRIORITY = {
10082
10305
  critical: 0,
10083
10306
  high: 1,
@@ -10369,6 +10592,7 @@ function parseReviewResponse(text) {
10369
10592
  }
10370
10593
  async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER_BUDGET_MS, options) {
10371
10594
  const surface = options?.surface ?? "cli";
10595
+ const retryTransient = options?.retryTransient === true && HOSTED_RETRY_SURFACES.has(surface);
10372
10596
  const emptyMask = { prompt_batches: 0, prompt_chars: 0, masked_count: 0, had_secret_pattern: false, raw_after_mask: 0 };
10373
10597
  const early = (status2, reason2, extra) => ({
10374
10598
  findings,
@@ -10444,6 +10668,14 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
10444
10668
  let fenceDropCount = 0;
10445
10669
  let timedOutCount = 0;
10446
10670
  let missingContentCount = 0;
10671
+ let modelThrowLogs = 0;
10672
+ const logModelThrow = (info, action) => {
10673
+ if (modelThrowLogs >= MAX_MODEL_THROW_LOGS) return;
10674
+ modelThrowLogs += 1;
10675
+ console.error(
10676
+ `[ai-fp-filter] model call threw: class ${info.name}, category ${info.category}, status ${info.status ?? "none"}, cause ${info.cause ?? "none"}, model ${MODEL_TRIAGE}; ${action}`
10677
+ );
10678
+ };
10447
10679
  const detectionCaches = /* @__PURE__ */ new Map();
10448
10680
  const cacheFor = (file) => {
10449
10681
  let cache2 = detectionCaches.get(file);
@@ -10576,34 +10808,53 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
10576
10808
  );
10577
10809
  }
10578
10810
  const perCall = perCallTimeoutMs(budgetMs);
10579
- const callTimeout = Math.min(perCall, remaining);
10580
- const callAbort = new AbortController();
10581
- const onParentAbort = () => callAbort.abort();
10582
- if (abortController.signal.aborted) callAbort.abort();
10583
- else abortController.signal.addEventListener("abort", onParentAbort, { once: true });
10584
- const callTimer = setTimeout(() => callAbort.abort(), callTimeout);
10811
+ let callAborted = false;
10812
+ const send = async (callTimeout) => {
10813
+ const callAbort = new AbortController();
10814
+ const onParentAbort = () => callAbort.abort();
10815
+ if (abortController.signal.aborted) callAbort.abort();
10816
+ else abortController.signal.addEventListener("abort", onParentAbort, { once: true });
10817
+ const callTimer = setTimeout(() => callAbort.abort(), callTimeout);
10818
+ try {
10819
+ return await client.messages.create(
10820
+ {
10821
+ model: MODEL_TRIAGE,
10822
+ max_tokens: 2048,
10823
+ // Haiku 5.5 rejects non-default sampling params with HTTP 400
10824
+ // ("temperature is deprecated for this model"). Omit temperature /
10825
+ // top_p / top_k entirely — do NOT send MODEL_TEMPERATURE (0).
10826
+ // Adaptive thinking is on by default for 5.5; disable it here: this
10827
+ // is binary FP classification, not open-ended analysis, and thinking
10828
+ // burns the shared AI budget (Isobar rescan: every call 400'd on
10829
+ // temperature, then timed_out with aiReviewed:false → grade D).
10830
+ thinking: { type: "disabled" },
10831
+ system: REVIEW_SYSTEM_PROMPT,
10832
+ messages: [{ role: "user", content: prompt }]
10833
+ },
10834
+ { timeout: callTimeout, signal: callAbort.signal }
10835
+ );
10836
+ } finally {
10837
+ callAborted = callAbort.signal.aborted;
10838
+ clearTimeout(callTimer);
10839
+ abortController.signal.removeEventListener("abort", onParentAbort);
10840
+ }
10841
+ };
10585
10842
  let response;
10586
10843
  try {
10587
- response = await client.messages.create(
10588
- {
10589
- model: MODEL_TRIAGE,
10590
- max_tokens: 2048,
10591
- // Haiku 5.5 rejects non-default sampling params with HTTP 400
10592
- // ("temperature is deprecated for this model"). Omit temperature /
10593
- // top_p / top_k entirely — do NOT send MODEL_TEMPERATURE (0).
10594
- // Adaptive thinking is on by default for 5.5; disable it here: this
10595
- // is binary FP classification, not open-ended analysis, and thinking
10596
- // burns the shared AI budget (Isobar rescan: every call 400'd on
10597
- // temperature, then timed_out with aiReviewed:false → grade D).
10598
- thinking: { type: "disabled" },
10599
- system: REVIEW_SYSTEM_PROMPT,
10600
- messages: [{ role: "user", content: prompt }]
10601
- },
10602
- { timeout: callTimeout, signal: callAbort.signal }
10603
- );
10604
- } finally {
10605
- clearTimeout(callTimer);
10606
- abortController.signal.removeEventListener("abort", onParentAbort);
10844
+ response = await send(Math.min(perCall, remaining));
10845
+ } catch (err) {
10846
+ const info = classifyModelError(err);
10847
+ const budgetAbort = abortController.signal.aborted;
10848
+ const retry = retryTransient && !callAborted && !budgetAbort && !authFailed && isRetryableModelError(info) && deadlineMs - Date.now() - MODEL_RETRY_DELAY_MS >= perCall;
10849
+ if (!budgetAbort) logModelThrow(info, retry ? "retrying once" : "not retried");
10850
+ if (!retry) throw err;
10851
+ await new Promise((resolve) => setTimeout(resolve, MODEL_RETRY_DELAY_MS));
10852
+ try {
10853
+ response = await send(Math.min(perCall, Math.max(1, deadlineMs - Date.now())));
10854
+ } catch (retryErr) {
10855
+ if (!abortController.signal.aborted) logModelThrow(classifyModelError(retryErr), "retry failed");
10856
+ throw retryErr;
10857
+ }
10607
10858
  }
10608
10859
  const text = response.content.filter((b) => b.type === "text").map((b) => b.text).join("");
10609
10860
  const results = parseReviewResponse(text);
@@ -11574,9 +11825,24 @@ function getSnippet5(content, line) {
11574
11825
  return `${prefix} ${String(lineNum).padStart(5)} | ${l}`;
11575
11826
  }).join("\n");
11576
11827
  }
11577
- function scanMultiFile(files) {
11828
+ function collectEnvNames(files, into) {
11829
+ for (const f of files) {
11830
+ if (/\.(ts|js|tsx|jsx)$/i.test(f.path)) {
11831
+ const matches = f.content.matchAll(/process\.env\.([A-Z_][A-Z0-9_]*)/g);
11832
+ for (const m of matches) {
11833
+ into.add(m[1]);
11834
+ }
11835
+ }
11836
+ }
11837
+ }
11838
+ function envVarNamesUsed(files) {
11839
+ const names = /* @__PURE__ */ new Set();
11840
+ collectEnvNames(files.filter((f) => !isSbomPath(f.path)), names);
11841
+ return [...names];
11842
+ }
11843
+ function scanMultiFile(files, opts = {}) {
11578
11844
  files = files.filter((f) => !isSbomPath(f.path));
11579
- const guarded = secretGuardedRoutes(files);
11845
+ const guarded = opts.guardedRoutes ?? secretGuardedRoutes(files);
11580
11846
  const findings = [];
11581
11847
  const fileMap = /* @__PURE__ */ new Map();
11582
11848
  for (const f of files) {
@@ -11694,15 +11960,8 @@ function scanMultiFile(files) {
11694
11960
  }
11695
11961
  const envExample = files.find((f) => /\.env\.example$|\.env\.sample$|\.env\.template$/.test(f.path));
11696
11962
  if (envExample) {
11697
- const envVarsUsed = /* @__PURE__ */ new Set();
11698
- for (const f of files) {
11699
- if (/\.(ts|js|tsx|jsx)$/i.test(f.path)) {
11700
- const matches = f.content.matchAll(/process\.env\.([A-Z_][A-Z0-9_]*)/g);
11701
- for (const m of matches) {
11702
- envVarsUsed.add(m[1]);
11703
- }
11704
- }
11705
- }
11963
+ const envVarsUsed = new Set(opts.priorEnvNames ?? []);
11964
+ collectEnvNames(files, envVarsUsed);
11706
11965
  const envVarsDocumented = /* @__PURE__ */ new Set();
11707
11966
  const exampleMatches = envExample.content.matchAll(/^([A-Z_][A-Z0-9_]*)=/gm);
11708
11967
  for (const m of exampleMatches) {
@@ -15505,6 +15764,7 @@ export {
15505
15764
  classifyPublicEnvVar,
15506
15765
  classifyStatement,
15507
15766
  clientSideAuth,
15767
+ collectRouteClaims,
15508
15768
  complianceMap,
15509
15769
  consoleLogProduction,
15510
15770
  corsWildcard,
@@ -15520,6 +15780,7 @@ export {
15520
15780
  emptyCatchBlock,
15521
15781
  enclosingHandler,
15522
15782
  envNotGitignored,
15783
+ envVarNamesUsed,
15523
15784
  evalUsage,
15524
15785
  exposedAuthSecret,
15525
15786
  exposedDebugMode,
@@ -15576,6 +15837,8 @@ export {
15576
15837
  maskSecretValue,
15577
15838
  maskStringLiterals,
15578
15839
  matchIgnore,
15840
+ mergeIntentStatements,
15841
+ mergeRouteClaims,
15579
15842
  missingAuthMiddleware,
15580
15843
  missingCSP,
15581
15844
  missingErrorBoundary,
@@ -15604,6 +15867,8 @@ export {
15604
15867
  refineDirectObjectFindings,
15605
15868
  replaceBlockComments,
15606
15869
  resetStructuralState,
15870
+ resolveSecretGuardedRoutes,
15871
+ routeDelegationFacts,
15607
15872
  routeForFile,
15608
15873
  routePathFromFile,
15609
15874
  runCustomRules,