@dataparade/cli 0.0.31 → 0.0.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.
Files changed (141) hide show
  1. package/README.md +56 -1
  2. package/dist/package.json +4 -3
  3. package/dist/src/ai-enrichment/fallbacks.js +12 -1
  4. package/dist/src/cli.js +50 -4
  5. package/dist/src/core/pipeline/omit-internal-implementation.js +13 -6
  6. package/dist/src/diff/register-diff-command.d.ts +4 -0
  7. package/dist/src/diff/register-diff-command.js +79 -0
  8. package/dist/src/diff/run-diff.d.ts +80 -0
  9. package/dist/src/diff/run-diff.js +206 -0
  10. package/dist/src/diff/upload-diff.d.ts +26 -0
  11. package/dist/src/diff/upload-diff.js +69 -0
  12. package/dist/src/facts/apply-answers.js +1 -1
  13. package/dist/src/facts/build-facts.d.ts +3 -1
  14. package/dist/src/facts/build-facts.js +10 -1
  15. package/dist/src/facts/identity.d.ts +27 -0
  16. package/dist/src/facts/identity.js +203 -0
  17. package/dist/src/facts/io.d.ts +2 -0
  18. package/dist/src/facts/io.js +7 -0
  19. package/dist/src/facts/scan-stamps.d.ts +55 -0
  20. package/dist/src/facts/scan-stamps.js +165 -0
  21. package/dist/src/facts/schema.d.ts +243 -7
  22. package/dist/src/facts/schema.js +71 -1
  23. package/dist/src/kb/answer-fingerprint.d.ts +44 -0
  24. package/dist/src/kb/answer-fingerprint.js +173 -0
  25. package/dist/src/kb/brief.d.ts +8 -1
  26. package/dist/src/kb/brief.js +18 -2
  27. package/dist/src/kb/land.js +3 -0
  28. package/dist/src/kb/register-kb-commands.js +7 -1
  29. package/dist/src/output/git-context.d.ts +25 -0
  30. package/dist/src/output/git-context.js +122 -0
  31. package/dist/src/output/scan-output-excludes.js +5 -1
  32. package/dist/src/output/write-scan-knowledge.d.ts +2 -0
  33. package/dist/src/output/write-scan-knowledge.js +1 -0
  34. package/dist/src/platform-api/dataparade-app-base-url.d.ts +8 -4
  35. package/dist/src/platform-api/dataparade-app-base-url.js +10 -5
  36. package/dist/src/platform-api/upload-client.d.ts +1 -1
  37. package/dist/src/platform-api/upload-client.js +32 -1
  38. package/dist/src/platform-api/upload.types.d.ts +55 -0
  39. package/dist/src/sensitive-scan/process.d.ts +5 -0
  40. package/dist/src/sensitive-scan/process.js +48 -0
  41. package/dist/src/sensitive-scan/project.d.ts +12 -0
  42. package/dist/src/sensitive-scan/project.js +177 -0
  43. package/dist/src/sensitive-scan/report.d.ts +50 -0
  44. package/dist/src/sensitive-scan/report.js +32 -0
  45. package/dist/src/sensitive-scan/sessions.d.ts +2 -0
  46. package/dist/src/sensitive-scan/sessions.js +120 -0
  47. package/dist/src/ui/scan-progress-renderer.d.ts +1 -0
  48. package/dist/src/ui/scan-progress-renderer.js +8 -0
  49. package/dist/src/upload/build-preview-url.d.ts +2 -2
  50. package/dist/src/upload/build-preview-url.js +4 -4
  51. package/dist/src/upload/run-upload.js +6 -2
  52. package/dist/src/upload/types.d.ts +2 -0
  53. package/dist/tests/unit/ai-enrichment/fallbacks.spec.js +30 -0
  54. package/dist/tests/unit/core/omit-internal-implementation.spec.js +21 -0
  55. package/dist/tests/unit/diff/run-diff.spec.d.ts +1 -0
  56. package/dist/tests/unit/diff/run-diff.spec.js +189 -0
  57. package/dist/tests/unit/diff/upload-diff.spec.d.ts +1 -0
  58. package/dist/tests/unit/diff/upload-diff.spec.js +81 -0
  59. package/dist/tests/unit/facts/apply-answers.spec.js +1 -1
  60. package/dist/tests/unit/facts/build-facts.spec.js +67 -1
  61. package/dist/tests/unit/facts/identity.spec.d.ts +1 -0
  62. package/dist/tests/unit/facts/identity.spec.js +148 -0
  63. package/dist/tests/unit/facts/scan-stamps.spec.d.ts +1 -0
  64. package/dist/tests/unit/facts/scan-stamps.spec.js +95 -0
  65. package/dist/tests/unit/kb/answer-fingerprint.spec.d.ts +1 -0
  66. package/dist/tests/unit/kb/answer-fingerprint.spec.js +157 -0
  67. package/dist/tests/unit/kb/kb-interview-loop.spec.js +16 -0
  68. package/dist/tests/unit/output/git-context.spec.d.ts +1 -0
  69. package/dist/tests/unit/output/git-context.spec.js +98 -0
  70. package/dist/tests/unit/platform-api/dataparade-app-base-url.spec.js +9 -0
  71. package/dist/tests/unit/platform-api/upload-client.spec.js +101 -1
  72. package/dist/tests/unit/sensitive-scan/project.spec.d.ts +1 -0
  73. package/dist/tests/unit/sensitive-scan/project.spec.js +98 -0
  74. package/dist/tests/unit/upload/build-preview-url.spec.js +4 -0
  75. package/dist/tests/unit/upload/collect-scan-sidecars.spec.js +1 -0
  76. package/dist/tests/unit/upload/run-upload.spec.js +32 -0
  77. package/dist/vendor/kb-compare/dist/src/canonical.d.ts +80 -0
  78. package/dist/vendor/kb-compare/dist/src/canonical.js +119 -0
  79. package/dist/vendor/kb-compare/dist/src/change-set.d.ts +144 -0
  80. package/dist/vendor/kb-compare/dist/src/change-set.js +80 -0
  81. package/dist/vendor/kb-compare/dist/src/comparable.d.ts +23 -0
  82. package/dist/vendor/kb-compare/dist/src/comparable.js +48 -0
  83. package/dist/vendor/kb-compare/dist/src/compare.d.ts +52 -0
  84. package/dist/vendor/kb-compare/dist/src/compare.js +370 -0
  85. package/dist/vendor/kb-compare/dist/src/fingerprint.d.ts +40 -0
  86. package/dist/vendor/kb-compare/dist/src/fingerprint.js +88 -0
  87. package/dist/vendor/kb-compare/dist/src/index.d.ts +15 -0
  88. package/dist/vendor/kb-compare/dist/src/index.js +34 -0
  89. package/dist/vendor/kb-compare/dist/src/input.d.ts +128 -0
  90. package/dist/vendor/kb-compare/dist/src/input.js +75 -0
  91. package/dist/vendor/kb-compare/dist/src/slot-rules.d.ts +69 -0
  92. package/dist/vendor/kb-compare/dist/src/slot-rules.js +203 -0
  93. package/dist/vendor/kb-compare/dist/src/summary.d.ts +3 -0
  94. package/dist/vendor/kb-compare/dist/src/summary.js +47 -0
  95. package/dist/vendor/kb-compare/package.json +6 -0
  96. package/dist/vendor/scanner/dist/src/analyzers/python/python-detection-config.d.ts +11 -0
  97. package/dist/vendor/scanner/dist/src/analyzers/python/python-detection-config.js +2 -0
  98. package/dist/vendor/scanner/dist/src/analyzers/registry.d.ts +2 -0
  99. package/dist/vendor/scanner/dist/src/analyzers/registry.js +3 -2
  100. package/dist/vendor/scanner/dist/src/analyzers/typescript/typescript-detection-config.d.ts +17 -0
  101. package/dist/vendor/scanner/dist/src/analyzers/typescript/typescript-detection-config.js +11 -0
  102. package/dist/vendor/scanner/dist/src/classifier/application-injection.js +5 -0
  103. package/dist/vendor/scanner/dist/src/classifier/component-factory.js +33 -3
  104. package/dist/vendor/scanner/dist/src/classifier/enhance.js +14 -0
  105. package/dist/vendor/scanner/dist/src/classifier/external-url-third-party.d.ts +8 -0
  106. package/dist/vendor/scanner/dist/src/classifier/external-url-third-party.js +43 -2
  107. package/dist/vendor/scanner/dist/src/classifier/postprocessing.js +4 -1
  108. package/dist/vendor/scanner/dist/src/config/third-party-detection-config.d.ts +41 -0
  109. package/dist/vendor/scanner/dist/src/config/third-party-detection-config.js +65 -1
  110. package/dist/vendor/scanner/dist/src/core/pipeline/stable-component-ids.d.ts +8 -0
  111. package/dist/vendor/scanner/dist/src/core/pipeline/stable-component-ids.js +11 -1
  112. package/dist/vendor/scanner/dist/src/core/pipeline/structural-scan.js +2 -0
  113. package/dist/vendor/scanner/dist/src/eval/canonical/scanner/components.d.ts +5 -0
  114. package/dist/vendor/scanner/dist/src/eval/canonical/scanner/components.js +10 -2
  115. package/dist/vendor/scanner/dist/src/eval/canonical/scanner/data-flows.js +4 -4
  116. package/dist/vendor/scanner/dist/src/index.d.ts +1 -1
  117. package/dist/vendor/scanner/dist/src/index.js +4 -2
  118. package/dist/vendor/scanner/dist/src/patterns/config.js +7 -1
  119. package/dist/vendor/scanner/dist/src/patterns/detectors/git-remote-owner.d.ts +14 -0
  120. package/dist/vendor/scanner/dist/src/patterns/detectors/git-remote-owner.js +108 -0
  121. package/dist/vendor/scanner/dist/src/patterns/detectors/python-outbound-http.d.ts +93 -0
  122. package/dist/vendor/scanner/dist/src/patterns/detectors/python-outbound-http.js +1206 -0
  123. package/dist/vendor/scanner/dist/src/patterns/detectors/python-source.d.ts +180 -0
  124. package/dist/vendor/scanner/dist/src/patterns/detectors/python-source.js +1022 -0
  125. package/dist/vendor/scanner/dist/src/patterns/detectors/python.d.ts +6 -0
  126. package/dist/vendor/scanner/dist/src/patterns/detectors/python.js +49 -1
  127. package/dist/vendor/scanner/dist/src/patterns/detectors/repo-declared-domains.d.ts +2 -0
  128. package/dist/vendor/scanner/dist/src/patterns/detectors/repo-declared-domains.js +80 -0
  129. package/dist/vendor/scanner/dist/src/patterns/detectors/source-module-index.d.ts +23 -0
  130. package/dist/vendor/scanner/dist/src/patterns/detectors/source-module-index.js +145 -0
  131. package/dist/vendor/scanner/dist/src/patterns/detectors/typescript-outbound-http.d.ts +30 -0
  132. package/dist/vendor/scanner/dist/src/patterns/detectors/typescript-outbound-http.js +575 -0
  133. package/dist/vendor/scanner/dist/src/patterns/detectors/typescript.js +12 -0
  134. package/dist/vendor/scanner/dist/src/patterns/engine.js +6 -1
  135. package/dist/vendor/scanner/package.json +3 -1
  136. package/dist/vendor/scanner/patterns/classifier/third-party.classifier.yaml +198 -0
  137. package/dist/vendor/scanner/patterns/component-taxonomy.yaml +1 -1
  138. package/dist/vendor/scanner/patterns/python.patterns.yaml +10 -0
  139. package/dist/vendor/scanner/patterns/third-party.patterns.yaml +271 -0
  140. package/dist/vendor/scanner/patterns/typescript.patterns.yaml +21 -0
  141. package/package.json +4 -3
@@ -11,6 +11,7 @@ const main_application_selection_1 = require("./main-application-selection");
11
11
  const section_runtime_1 = require("../core/sectioning/section-runtime");
12
12
  const sectioning_1 = require("./sectioning");
13
13
  const postprocessing_1 = require("./postprocessing");
14
+ const stable_component_ids_1 = require("../core/pipeline/stable-component-ids");
14
15
  /** Synthetic main app created when no code hub exists (e.g. IaC-only scan). */
15
16
  exports.INJECTED_PROJECT_PLACEHOLDER_SOURCE_CONTEXT = "injected_project_placeholder";
16
17
  function isLikelyUserEntrypoint(mainApp) {
@@ -280,6 +281,8 @@ function injectApplicationAssetIfMissing(components, opts) {
280
281
  cloned[appIndex] = {
281
282
  ...app,
282
283
  name: projectName,
284
+ // The name comes from the project or the scan folder; keep it out of the stable id (KDATAP-296090).
285
+ properties: { ...app.properties, [stable_component_ids_1.NAME_FROM_PROJECT_PROPERTY]: true },
283
286
  };
284
287
  }
285
288
  return cloned;
@@ -314,6 +317,8 @@ function injectApplicationAssetIfMissing(components, opts) {
314
317
  section_id: defaultSectionId,
315
318
  section_role: defaultSectionRole,
316
319
  sourceContext: exports.INJECTED_PROJECT_PLACEHOLDER_SOURCE_CONTEXT,
320
+ // The name comes from the project or the scan folder; keep it out of the stable id (KDATAP-296090).
321
+ [stable_component_ids_1.NAME_FROM_PROJECT_PROPERTY]: true,
317
322
  },
318
323
  };
319
324
  return [...components, synthetic];
@@ -231,6 +231,9 @@ function findThirdPartyMatch(finding, config, urlOptions, organizationDomains) {
231
231
  if ((0, external_url_third_party_1.isOrganizationOwnedExternalApiFinding)(finding, organizationDomains)) {
232
232
  return undefined;
233
233
  }
234
+ if (finding.properties?.remoteService === true || finding.properties?.firstParty === true) {
235
+ return undefined;
236
+ }
234
237
  const props = finding.properties ?? {};
235
238
  const candidates = [];
236
239
  const serviceName = props.serviceName;
@@ -247,6 +250,14 @@ function findThirdPartyMatch(finding, config, urlOptions, organizationDomains) {
247
250
  /^https?:\/\//i.test(finding.name.trim())) {
248
251
  candidates.push(finding.name.toLowerCase());
249
252
  }
253
+ // A detector that already named the service (e.g. from a resolved URL host) wins over
254
+ // substring keys of earlier catalog entries matching the URL (DATAP-818).
255
+ if (typeof serviceName === "string" && serviceName.trim()) {
256
+ const exact = serviceName.trim().toLowerCase();
257
+ const named = config.thirdParties.find((tp) => tp.serviceName.toLowerCase() === exact);
258
+ if (named)
259
+ return named;
260
+ }
250
261
  for (const tp of config.thirdParties) {
251
262
  for (const key of tp.matchKeys) {
252
263
  if (candidates.some((c) => c.includes(key)))
@@ -378,9 +389,13 @@ function decideComponentTypeAndSubType(group, config, patternDefaultsById, urlOp
378
389
  matchedThirdParty = tp;
379
390
  }
380
391
  if (matchedThirdParty && config.resolution.preferThirdPartyOverAsset) {
392
+ // A route can give one service a different subtype per endpoint (DATAP-818).
393
+ const routed = group.findings
394
+ .map((f) => f.properties?.thirdPartySubType)
395
+ .find((v) => typeof v === "string" && v.trim().length > 0);
381
396
  return {
382
397
  type: "third_party",
383
- subType: matchedThirdParty.subType,
398
+ subType: routed?.trim() ?? matchedThirdParty.subType,
384
399
  thirdParty: matchedThirdParty,
385
400
  };
386
401
  }
@@ -454,7 +469,10 @@ function classifyRawFindings(rawFindings, options) {
454
469
  }
455
470
  const { type, subType, thirdParty } = decideComponentTypeAndSubType(group, config, patternDefaultsById, urlOptions, organizationDomains);
456
471
  if (group.findings.length > 0 &&
457
- group.findings.every((f) => (0, external_url_third_party_1.isOrganizationOwnedExternalApiFinding)(f, organizationDomains))) {
472
+ group.findings.every((f) => (0, external_url_third_party_1.isOrganizationOwnedExternalApiFinding)(f, organizationDomains)) &&
473
+ // Detectors that keep a call to the organization's own host mark it first-party:
474
+ // it stays as an API asset for the remote service (DATAP-818).
475
+ !group.findings.some((f) => f.properties?.firstParty === true)) {
458
476
  continue;
459
477
  }
460
478
  if (type === "third_party" &&
@@ -518,12 +536,24 @@ function classifyRawFindings(rawFindings, options) {
518
536
  if (component.type === "third_party") {
519
537
  const svc = mergedProperties.serviceName;
520
538
  if (typeof svc === "string" && svc.trim()) {
521
- const normalizedService = normalizeComponentName(svc, config.nameNormalization);
539
+ // A catalog service name is already canonical: keep suffixes such as `_api`
540
+ // (meta_conversions_api) that name normalization would strip.
541
+ const catalogName = thirdParty?.serviceName.toLowerCase() === svc.trim().toLowerCase();
542
+ const normalizedService = catalogName
543
+ ? svc.trim().toLowerCase()
544
+ : normalizeComponentName(svc, config.nameNormalization);
522
545
  component.name = (0, naming_1.toDisplayName)(normalizedService, svc);
523
546
  }
524
547
  }
525
548
  if (component.type === "asset" && component.subType === "api") {
526
549
  component.name = normalizeApiDisplayName(component.name, mergedProperties);
550
+ // A remote service on a hosting platform carries its own display name
551
+ // ("mom-skipify (Cloud Run)"); keep it as written (DATAP-818).
552
+ const displayName = group.findings
553
+ .map((f) => f.properties?.displayName)
554
+ .find((v) => typeof v === "string" && v.trim().length > 0);
555
+ if (displayName)
556
+ component.name = displayName;
527
557
  }
528
558
  components.push(component);
529
559
  }
@@ -236,6 +236,11 @@ function enhanceComponents(components) {
236
236
  if ((0, main_application_selection_1.isTerraformModuleCallShellAsset)(c)) {
237
237
  continue;
238
238
  }
239
+ // Outbound calls to another service (DATAP-818) describe that remote service, never
240
+ // this section's application: do not pick or rename them as the main application.
241
+ if (isRemoteOutboundApiAsset(c)) {
242
+ continue;
243
+ }
239
244
  const sid = sectionIdFor(c);
240
245
  const priority = getFrameworkPriority(c);
241
246
  if (isSingleRouteApiAsset(c)) {
@@ -309,3 +314,12 @@ function enhanceComponents(components) {
309
314
  return component;
310
315
  });
311
316
  }
317
+ function propertyIs(value, expected) {
318
+ return Array.isArray(value) ? value.includes(expected) : value === expected;
319
+ }
320
+ /** API asset made from outbound calls (remote service or unknown destination), not an own API. */
321
+ function isRemoteOutboundApiAsset(component) {
322
+ return (component.subType === "api" &&
323
+ (propertyIs(component.properties?.remoteService, true) ||
324
+ propertyIs(component.properties?.destination, "unknown")));
325
+ }
@@ -15,6 +15,14 @@ export declare function shouldIgnoreExternalHttpUrl(url: string | undefined, opt
15
15
  * api.openai.com → openai.com, clipdrop-api.co → clipdrop-api.co.
16
16
  */
17
17
  export declare function deriveServiceKeyFromHostname(host: string): string;
18
+ /** Registrable domain of a host (`www.shop.example.co.uk` -> `example.co.uk`). */
19
+ export declare function registrableDomainOf(host: string): string;
20
+ /**
21
+ * Vendor key for a host the catalog does not know: the registrable domain without its
22
+ * public suffix (`api.dramaboxdb.com` -> `dramaboxdb`, `shop.example.co.uk` -> `example`),
23
+ * so components are named after a vendor, not a domain (DATAP-818).
24
+ */
25
+ export declare function vendorNameFromHostname(host: string): string;
18
26
  /**
19
27
  * Hostname + registrable domain keys from an absolute http(s) URL (for matching
20
28
  * external_api_call findings to third_party nodes by endpoint.
@@ -8,11 +8,14 @@ exports.isOrganizationOwnedExternalApiFinding = isOrganizationOwnedExternalApiFi
8
8
  exports.isReservedPlaceholderHost = isReservedPlaceholderHost;
9
9
  exports.shouldIgnoreExternalHttpUrl = shouldIgnoreExternalHttpUrl;
10
10
  exports.deriveServiceKeyFromHostname = deriveServiceKeyFromHostname;
11
+ exports.registrableDomainOf = registrableDomainOf;
12
+ exports.vendorNameFromHostname = vendorNameFromHostname;
11
13
  exports.urlHostMatchKeys = urlHostMatchKeys;
12
14
  exports.defaultServiceNameFromLiteralPublicUrl = defaultServiceNameFromLiteralPublicUrl;
13
15
  exports.inferThirdPartyFromLiteralHttpUrl = inferThirdPartyFromLiteralHttpUrl;
14
16
  const config_1 = require("./config");
15
17
  const organization_domains_scan_scope_1 = require("./organization-domains-scan-scope");
18
+ const third_party_detection_config_1 = require("../config/third-party-detection-config");
16
19
  /**
17
20
  * Structural heuristics (not a vendor list): URLs that are obviously templated or
18
21
  * env-driven should not be treated as static third-party endpoints.
@@ -197,6 +200,38 @@ function deriveServiceKeyFromHostname(host) {
197
200
  }
198
201
  return `${parts[parts.length - 2]}.${parts[parts.length - 1]}`;
199
202
  }
203
+ /**
204
+ * Second-level public suffixes (`co.uk`): the registrable domain then has three labels.
205
+ * A short list of the common ones; anything else is treated as a one-label suffix.
206
+ */
207
+ const TWO_LABEL_PUBLIC_SUFFIXES = new Set([
208
+ "co.uk", "org.uk", "ac.uk", "gov.uk", "me.uk", "ltd.uk",
209
+ "com.au", "net.au", "org.au", "edu.au", "gov.au",
210
+ "co.nz", "org.nz", "co.jp", "ne.jp", "or.jp", "co.kr", "co.in", "co.za", "co.id", "co.il",
211
+ "com.br", "com.mx", "com.ar", "com.sg", "com.hk", "com.tw", "com.cn", "com.tr", "com.my", "com.ph",
212
+ ]);
213
+ /** Registrable domain of a host (`www.shop.example.co.uk` -> `example.co.uk`). */
214
+ function registrableDomainOf(host) {
215
+ const parts = host.replace(/^www\./, "").toLowerCase().split(".").filter(Boolean);
216
+ if (parts.length < 2)
217
+ return parts.join(".");
218
+ const lastTwo = parts.slice(-2).join(".");
219
+ const labels = parts.length >= 3 && TWO_LABEL_PUBLIC_SUFFIXES.has(lastTwo) ? 3 : 2;
220
+ return parts.slice(-labels).join(".");
221
+ }
222
+ /**
223
+ * Vendor key for a host the catalog does not know: the registrable domain without its
224
+ * public suffix (`api.dramaboxdb.com` -> `dramaboxdb`, `shop.example.co.uk` -> `example`),
225
+ * so components are named after a vendor, not a domain (DATAP-818).
226
+ */
227
+ function vendorNameFromHostname(host) {
228
+ const parts = host.replace(/^www\./, "").toLowerCase().split(".").filter(Boolean);
229
+ if (parts.length < 2)
230
+ return parts[0] ?? host.toLowerCase();
231
+ const lastTwo = parts.slice(-2).join(".");
232
+ const suffixLabels = parts.length >= 3 && TWO_LABEL_PUBLIC_SUFFIXES.has(lastTwo) ? 2 : 1;
233
+ return parts[parts.length - 1 - suffixLabels] ?? lastTwo;
234
+ }
200
235
  /**
201
236
  * Hostname + registrable domain keys from an absolute http(s) URL (for matching
202
237
  * external_api_call findings to third_party nodes by endpoint.
@@ -236,7 +271,10 @@ function defaultServiceNameFromLiteralPublicUrl(url, options) {
236
271
  if (hostname == null || !hostname) {
237
272
  return undefined;
238
273
  }
239
- return deriveServiceKeyFromHostname(hostname);
274
+ // A shared hosting host (`*.run.app`) is someone's own service, not a vendor.
275
+ if ((0, third_party_detection_config_1.platformOfHost)(hostname))
276
+ return undefined;
277
+ return vendorNameFromHostname(hostname);
240
278
  }
241
279
  catch {
242
280
  return undefined;
@@ -294,7 +332,10 @@ function inferThirdPartyFromLiteralHttpUrl(finding, options) {
294
332
  if (isLocalOrPrivateHost(hostname) || isReservedPlaceholderHost(hostname)) {
295
333
  return undefined;
296
334
  }
297
- const serviceName = deriveServiceKeyFromHostname(hostname);
335
+ if ((0, third_party_detection_config_1.platformOfHost)(hostname)) {
336
+ return undefined;
337
+ }
338
+ const serviceName = vendorNameFromHostname(hostname);
298
339
  if (!serviceName) {
299
340
  return undefined;
300
341
  }
@@ -135,7 +135,10 @@ function buildComponentDedupeKey(component, nameNormalization) {
135
135
  const serviceName = component.properties.serviceName;
136
136
  if (typeof serviceName === "string" && serviceName.trim()) {
137
137
  const key = serviceName.trim().toLowerCase();
138
- return `third_party:${sectionId}:${key}`;
138
+ // Endpoints of one service routed to another subtype stay separate (DATAP-818).
139
+ const routed = component.properties.thirdPartySubType;
140
+ const subtypeKey = typeof routed === "string" && routed.trim() ? `:${component.subType ?? routed}` : "";
141
+ return `third_party:${sectionId}:${key}${subtypeKey}`;
139
142
  }
140
143
  const normalized = (0, naming_1.normalizeComponentName)(component.name, nameNormalization);
141
144
  const keyName = normalized || component.name.trim().toLowerCase() || "<unknown>";
@@ -17,9 +17,50 @@ export interface ThirdPartyServiceConfig {
17
17
  confidence: number;
18
18
  urlHostPatterns: string[];
19
19
  }
20
+ /**
21
+ * One rule for a host shared by several products (DATAP-818). `path` is tested against the
22
+ * URL path (no query); `hint` against the calling code's names (file path, class, function,
23
+ * URL expression). The first rule whose tests all pass names the service.
24
+ */
25
+ export interface ThirdPartyUrlRouteRule {
26
+ path?: RegExp;
27
+ hint?: RegExp;
28
+ serviceName: string;
29
+ /** Overrides the catalog subtype for this route (e.g. Instagram messaging vs publishing). */
30
+ subType?: string;
31
+ }
32
+ export interface ThirdPartyUrlRoute {
33
+ host: string;
34
+ rules: ThirdPartyUrlRouteRule[];
35
+ }
36
+ /** LLM gateway model prefix (`groq/llama-3.1-8b`) naming the provider (DATAP-818). */
37
+ export interface LlmModelPrefix {
38
+ prefix: string;
39
+ serviceName: string;
40
+ }
20
41
  export interface ThirdPartyDetectionConfig {
21
42
  httpClients: ThirdPartyHttpClientConfig[];
22
43
  services: ThirdPartyServiceConfig[];
44
+ urlRoutes: ThirdPartyUrlRoute[];
45
+ /** Rules for URLs whose host is only known at runtime (`https://{shop}/api/mcp`): path and hint required. */
46
+ urlPathRoutes: ThirdPartyUrlRouteRule[];
47
+ llmModelPrefixes: LlmModelPrefix[];
48
+ /** `googleapiclient.discovery.build("<api>", ...)` API name -> service (DATAP-818). */
49
+ googleApiServices: Map<string, string>;
50
+ /** Shared hosting suffixes (`*.run.app`): own services, never vendors (DATAP-818). */
51
+ platformHosts: Array<{
52
+ pattern: RegExp;
53
+ platform: string;
54
+ name: string;
55
+ }>;
23
56
  }
24
57
  export declare function clearThirdPartyDetectionConfigCache(): void;
25
58
  export declare function loadThirdPartyDetectionConfig(): ThirdPartyDetectionConfig;
59
+ /** Platform of a host on a shared hosting suffix (`gcp/cloud_run`), or undefined. */
60
+ export declare function platformOfHost(host: string): string | undefined;
61
+ /**
62
+ * Display name for a service on a shared hosting platform: the first host label without
63
+ * project numbers, deploy hashes or region codes, plus the platform
64
+ * (`mom-skipify-328574824807.us-central1.run.app` -> "mom-skipify (Cloud Run)").
65
+ */
66
+ export declare function platformServiceDisplayName(host: string): string | undefined;
@@ -10,6 +10,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.clearThirdPartyDetectionConfigCache = clearThirdPartyDetectionConfigCache;
12
12
  exports.loadThirdPartyDetectionConfig = loadThirdPartyDetectionConfig;
13
+ exports.platformOfHost = platformOfHost;
14
+ exports.platformServiceDisplayName = platformServiceDisplayName;
13
15
  const fs_1 = __importDefault(require("fs"));
14
16
  const path_1 = __importDefault(require("path"));
15
17
  const yaml_1 = __importDefault(require("yaml"));
@@ -92,6 +94,68 @@ function loadThirdPartyDetectionConfig() {
92
94
  });
93
95
  }
94
96
  }
95
- cached = { httpClients, services };
97
+ const urlRoutes = [];
98
+ if (Array.isArray(parsed.url_routes)) {
99
+ for (const route of parsed.url_routes) {
100
+ if (!route?.host || !Array.isArray(route.rules)) {
101
+ throw new Error(`third-party-detection.url_routes entries need host and rules (${configPath}).`);
102
+ }
103
+ urlRoutes.push({
104
+ host: route.host.toLowerCase(),
105
+ rules: route.rules.map((rule) => {
106
+ if (!rule.serviceName) {
107
+ throw new Error(`third-party-detection.url_routes['${route.host}'] rule is missing serviceName.`);
108
+ }
109
+ return {
110
+ serviceName: rule.serviceName,
111
+ ...(rule.path ? { path: new RegExp(rule.path, "i") } : {}),
112
+ ...(rule.hint ? { hint: new RegExp(rule.hint, "i") } : {}),
113
+ ...(rule.subType ? { subType: rule.subType } : {}),
114
+ };
115
+ }),
116
+ });
117
+ }
118
+ }
119
+ const urlPathRoutes = (parsed.url_path_routes ?? []).map((rule) => {
120
+ if (!rule.serviceName || !rule.path || !rule.hint) {
121
+ throw new Error("third-party-detection.url_path_routes rules need path, hint and serviceName.");
122
+ }
123
+ return {
124
+ serviceName: rule.serviceName,
125
+ path: new RegExp(rule.path, "i"),
126
+ hint: new RegExp(rule.hint, "i"),
127
+ ...(rule.subType ? { subType: rule.subType } : {}),
128
+ };
129
+ });
130
+ const llmModelPrefixes = Object.entries(parsed.llm_model_prefixes ?? {}).map(([prefix, serviceName]) => ({ prefix: prefix.toLowerCase().replace(/\/$/, ""), serviceName: String(serviceName) }));
131
+ const googleApiServices = new Map(Object.entries(parsed.google_api_services ?? {}).map(([api, serviceName]) => [api.toLowerCase(), String(serviceName)]));
132
+ const platformHosts = (parsed.platform_hosts ?? []).map((entry) => ({
133
+ pattern: compileRegex(entry.pattern),
134
+ platform: String(entry.platform),
135
+ name: String(entry.name ?? entry.platform),
136
+ }));
137
+ cached = { httpClients, services, urlRoutes, urlPathRoutes, llmModelPrefixes, googleApiServices, platformHosts };
96
138
  return cached;
97
139
  }
140
+ /** Platform of a host on a shared hosting suffix (`gcp/cloud_run`), or undefined. */
141
+ function platformOfHost(host) {
142
+ const h = host.toLowerCase();
143
+ return loadThirdPartyDetectionConfig().platformHosts.find((entry) => entry.pattern.test(h))?.platform;
144
+ }
145
+ /**
146
+ * Display name for a service on a shared hosting platform: the first host label without
147
+ * project numbers, deploy hashes or region codes, plus the platform
148
+ * (`mom-skipify-328574824807.us-central1.run.app` -> "mom-skipify (Cloud Run)").
149
+ */
150
+ function platformServiceDisplayName(host) {
151
+ const h = host.toLowerCase();
152
+ const entry = loadThirdPartyDetectionConfig().platformHosts.find((e) => e.pattern.test(h));
153
+ if (!entry)
154
+ return undefined;
155
+ let label = h.split(".")[0] ?? h;
156
+ label = label
157
+ .replace(/-[a-z0-9]{8,12}-[a-z]{2}$/, "") // Cloud Run `service-<hash>-<region code>`
158
+ .replace(/-\d{6,}$/, "") // project number
159
+ .replace(/-[a-f0-9]{8,}$/, ""); // deploy hash
160
+ return `${label || h} (${entry.name})`;
161
+ }
@@ -7,4 +7,12 @@ import type { DetectedComponent } from "../types/component";
7
7
  * The managed tuple embeds `managed_by_provider`, which is a component id; the
8
8
  * id assigners resolve it to the provider's own key so the result is stable.
9
9
  */
10
+ /**
11
+ * Set on a component whose name is the project name, or the scan folder's name when no project
12
+ * name is configured (the root Application component). Its stable key uses
13
+ * {@link PROJECT_NAME_KEY_TOKEN} instead of the name, so the id does not depend on the folder the
14
+ * repository was checked out into (KDATAP-296090, DATAP-858).
15
+ */
16
+ export declare const NAME_FROM_PROJECT_PROPERTY = "name_from_project";
17
+ export declare const PROJECT_NAME_KEY_TOKEN = "<project>";
10
18
  export declare function stableComponentKey(component: DetectedComponent): string;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PROJECT_NAME_KEY_TOKEN = exports.NAME_FROM_PROJECT_PROPERTY = void 0;
3
4
  exports.stableComponentKey = stableComponentKey;
4
5
  const sectioning_1 = require("../../classifier/sectioning");
5
6
  function normalizeName(name) {
@@ -19,6 +20,14 @@ function firstSourceFilePath(component) {
19
20
  * The managed tuple embeds `managed_by_provider`, which is a component id; the
20
21
  * id assigners resolve it to the provider's own key so the result is stable.
21
22
  */
23
+ /**
24
+ * Set on a component whose name is the project name, or the scan folder's name when no project
25
+ * name is configured (the root Application component). Its stable key uses
26
+ * {@link PROJECT_NAME_KEY_TOKEN} instead of the name, so the id does not depend on the folder the
27
+ * repository was checked out into (KDATAP-296090, DATAP-858).
28
+ */
29
+ exports.NAME_FROM_PROJECT_PROPERTY = "name_from_project";
30
+ exports.PROJECT_NAME_KEY_TOKEN = "<project>";
22
31
  function stableComponentKey(component) {
23
32
  const addr = component.properties?.terraform_address;
24
33
  if (typeof addr === "string" && addr.trim()) {
@@ -36,5 +45,6 @@ function stableComponentKey(component) {
36
45
  const sid = (0, sectioning_1.getSectionIdFromProperties)(component.properties);
37
46
  const subType = component.subType ?? "";
38
47
  const filePath = firstSourceFilePath(component);
39
- return `app:${sid}|${component.type}|${subType}|${filePath}|${normalizeName(component.name)}`;
48
+ const name = component.properties?.[exports.NAME_FROM_PROJECT_PROPERTY] === true ? exports.PROJECT_NAME_KEY_TOKEN : normalizeName(component.name);
49
+ return `app:${sid}|${component.type}|${subType}|${filePath}|${name}`;
40
50
  }
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.runStructuralScanPhase = runStructuralScanPhase;
7
7
  exports.runStructuralScan = runStructuralScan;
8
8
  const path_1 = __importDefault(require("path"));
9
+ const git_remote_owner_1 = require("../../patterns/detectors/git-remote-owner");
9
10
  const scan_result_schema_1 = require("../schema/scan-result.schema");
10
11
  const file_system_1 = require("../../ingest/file-system");
11
12
  const registry_1 = require("../../analyzers/registry");
@@ -184,6 +185,7 @@ async function runStructuralScanPhase(rootPath, config, onWarning) {
184
185
  terraformModuleManifest,
185
186
  terraformScanRootPath: scanRootDir,
186
187
  organizationDomains: config.organizationDomains,
188
+ gitRemoteOwner: (0, git_remote_owner_1.readGitRemoteOwner)(scanRootDir),
187
189
  });
188
190
  }
189
191
  finally {
@@ -1,4 +1,9 @@
1
1
  import type { DetectedComponent } from "../../../core/types/component";
2
2
  import type { CanonicalScannerFinding } from "../types";
3
+ /**
4
+ * Gold vendor keys are snake_case (`facebook_messenger`); scanner display names and the
5
+ * vendor property are title case with spaces (`Facebook Messenger`).
6
+ */
7
+ export declare function thirdPartyVendorKey(value: string): string;
3
8
  export declare function componentScannerIdentityKey(component: DetectedComponent): string;
4
9
  export declare function adaptDetectedComponent(component: DetectedComponent, adapterMapVersion?: string): CanonicalScannerFinding;
@@ -1,14 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.thirdPartyVendorKey = thirdPartyVendorKey;
3
4
  exports.componentScannerIdentityKey = componentScannerIdentityKey;
4
5
  exports.adaptDetectedComponent = adaptDetectedComponent;
5
6
  const record_factory_1 = require("../record-factory");
6
7
  const manifest_1 = require("./manifest");
8
+ /**
9
+ * Gold vendor keys are snake_case (`facebook_messenger`); scanner display names and the
10
+ * vendor property are title case with spaces (`Facebook Messenger`).
11
+ */
12
+ function thirdPartyVendorKey(value) {
13
+ return value.trim().toLowerCase().replace(/\s+/g, "_");
14
+ }
7
15
  function componentScannerIdentityKey(component) {
8
16
  const nameKey = component.name.toLowerCase();
9
17
  const subtype = component.subType?.trim().toLowerCase();
10
18
  if (component.type === "third_party") {
11
- return `${component.type}:${nameKey}`;
19
+ return `${component.type}:${thirdPartyVendorKey(nameKey)}`;
12
20
  }
13
21
  if (component.type === "asset" || component.type === "actor") {
14
22
  if (subtype) {
@@ -44,7 +52,7 @@ function resolveOptionalVendor(component) {
44
52
  if (typeof vendor !== "string" || vendor.trim().length === 0) {
45
53
  return undefined;
46
54
  }
47
- return vendor.trim().toLowerCase();
55
+ return thirdPartyVendorKey(vendor);
48
56
  }
49
57
  function adaptDetectedComponent(component, adapterMapVersion = (0, manifest_1.resolveScannerAdapterMapVersion)()) {
50
58
  const identityKey = componentScannerIdentityKey(component);
@@ -14,7 +14,7 @@ function flowComponentIdentityKey(component) {
14
14
  }
15
15
  const vendor = component.properties?.vendor;
16
16
  if (typeof vendor === "string" && vendor.trim()) {
17
- return `${component.type}:${vendor.trim().toLowerCase()}`;
17
+ return `${component.type}:${(0, components_1.thirdPartyVendorKey)(vendor)}`;
18
18
  }
19
19
  return (0, components_1.componentScannerIdentityKey)(component);
20
20
  }
@@ -105,7 +105,7 @@ function resolveFlowEndpointVendor(flow, component) {
105
105
  }
106
106
  const vendor = component?.properties?.vendor;
107
107
  if (typeof vendor === "string" && vendor.trim()) {
108
- return vendor.trim().toLowerCase();
108
+ return (0, components_1.thirdPartyVendorKey)(vendor);
109
109
  }
110
110
  return undefined;
111
111
  }
@@ -164,9 +164,9 @@ function endpointKeyForFlowComponent(component, fallback) {
164
164
  }
165
165
  const vendor = component.properties?.vendor;
166
166
  if (typeof vendor === "string" && vendor.trim()) {
167
- return vendor.trim().toLowerCase();
167
+ return (0, components_1.thirdPartyVendorKey)(vendor);
168
168
  }
169
- return component.name.trim().toLowerCase() || fallback;
169
+ return (0, components_1.thirdPartyVendorKey)(component.name) || fallback;
170
170
  }
171
171
  const subType = component.subType?.trim();
172
172
  if (subType) {
@@ -8,7 +8,7 @@ export { buildDiagramGraphFromScanResult, selectPrimaryDataAction } from "./core
8
8
  export { runGraphify, loadGraphifyGraph, type GraphifyGraph, type GraphifyNode, type GraphifyLink, type StructureGraphConfig, type StructureGraphInfo, } from "./structure/graphify";
9
9
  export { buildDataParadeGraph, writeKnowledgeGraph, DATAPARADE_GRAPH_FILE, DATAPARADE_GRAPH_SCHEMA, type DataParadeGraph, type DataParadeNode, type DataParadeLink, } from "./graph/build-dataparade-graph";
10
10
  export { collectEvalFindings } from "./core/pipeline/collect-eval-findings";
11
- export { stableComponentKey } from "./core/pipeline/stable-component-ids";
11
+ export { NAME_FROM_PROJECT_PROPERTY, PROJECT_NAME_KEY_TOKEN, stableComponentKey } from "./core/pipeline/stable-component-ids";
12
12
  export { assignStableComponentIds, assignStableEntityIds, assignStableEntityIdsWithMaps, buildComponentKeyById, normalizeFlowEndpoint, resolvedStableComponentKey, stableComponentId, stableFlowId, stableFlowKey, STABLE_COMPONENT_ID_PATTERN, STABLE_COMPONENT_ID_PREFIX, STABLE_FLOW_ID_PATTERN, STABLE_FLOW_ID_PREFIX, } from "./core/pipeline/stable-entity-ids";
13
13
  export type { ComponentKeyLookup, StableEntityIdAssignment, } from "./core/pipeline/stable-entity-ids";
14
14
  export { sortDataFlowsDeterministically } from "./core/pipeline/sorting";
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.runAnalyzers = exports.toDisplayName = exports.frameworkDisplayName = exports.canonicalFrameworkId = exports.DETECTABLE_PROPERTY_KEYS = exports.normalizeOrganizationDomains = exports.hostMatchesOrganizationDomains = exports.loadClassifierConfig = exports.dedupeDataFlows = exports.appendTerraformBareProviderAttachmentFlows = exports.shouldSkipDirectoryName = exports.DEFAULT_EXCLUDED_FILE_GLOBS = exports.toPosixPath = exports.isPathIgnored = exports.gitignoreRulesForDir = exports.gitignorePatternToRegex = exports.isSensitiveEnvPath = exports.resolveScanFilesystemEntry = exports.ingestFileSystem = exports.sortDataFlowsDeterministically = exports.STABLE_FLOW_ID_PREFIX = exports.STABLE_FLOW_ID_PATTERN = exports.STABLE_COMPONENT_ID_PREFIX = exports.STABLE_COMPONENT_ID_PATTERN = exports.stableFlowKey = exports.stableFlowId = exports.stableComponentId = exports.resolvedStableComponentKey = exports.normalizeFlowEndpoint = exports.buildComponentKeyById = exports.assignStableEntityIdsWithMaps = exports.assignStableEntityIds = exports.assignStableComponentIds = exports.stableComponentKey = exports.collectEvalFindings = exports.DATAPARADE_GRAPH_SCHEMA = exports.DATAPARADE_GRAPH_FILE = exports.writeKnowledgeGraph = exports.buildDataParadeGraph = exports.loadGraphifyGraph = exports.runGraphify = exports.selectPrimaryDataAction = exports.buildDiagramGraphFromScanResult = exports.buildScanPersonalDataLayers = exports.enrichOrchestratorResultWithPersonalDataLayers = exports.runDeterministicScanPhases = exports.finalizeDeterministicScanResult = exports.emitScanProgress = exports.scan = exports.createDefaultScanConfiguration = void 0;
18
- exports.runDataActionPhase = exports.hasVerb = exports.readDataActions = exports.mergeOneAssignment = exports.mergeAssignmentsOntoComponents = exports.DATA_ACTION_RULE_LANGUAGES = exports.ruleAppliesToLanguage = exports.clearDataActionRulesCacheForTest = exports.loadDataActionRules = exports.loadDataActionRuleCatalog = exports.TERRAFORM_GATEWAY_SUBTYPES = exports.SUBTYPE_STORE_SUBTYPES = exports.deriveFromSubtypes = exports.pathsReferToSameFile = exports.deriveFromPatterns = exports.STORAGE_SUBTYPES = exports.deriveFromTopology = exports.normalizeDataActionToken = exports.normalizeDataAction = exports.isDataAction = exports.DATA_ACTION_SET = exports.DATA_ACTION_FRAMEWORK_ANCHORS = exports.DATA_ACTION_ALIASES = exports.DATA_ACTIONS = exports.tagFindingsWithServiceSections = exports.discoverServiceSections = void 0;
17
+ exports.frameworkDisplayName = exports.canonicalFrameworkId = exports.DETECTABLE_PROPERTY_KEYS = exports.normalizeOrganizationDomains = exports.hostMatchesOrganizationDomains = exports.loadClassifierConfig = exports.dedupeDataFlows = exports.appendTerraformBareProviderAttachmentFlows = exports.shouldSkipDirectoryName = exports.DEFAULT_EXCLUDED_FILE_GLOBS = exports.toPosixPath = exports.isPathIgnored = exports.gitignoreRulesForDir = exports.gitignorePatternToRegex = exports.isSensitiveEnvPath = exports.resolveScanFilesystemEntry = exports.ingestFileSystem = exports.sortDataFlowsDeterministically = exports.STABLE_FLOW_ID_PREFIX = exports.STABLE_FLOW_ID_PATTERN = exports.STABLE_COMPONENT_ID_PREFIX = exports.STABLE_COMPONENT_ID_PATTERN = exports.stableFlowKey = exports.stableFlowId = exports.stableComponentId = exports.resolvedStableComponentKey = exports.normalizeFlowEndpoint = exports.buildComponentKeyById = exports.assignStableEntityIdsWithMaps = exports.assignStableEntityIds = exports.assignStableComponentIds = exports.stableComponentKey = exports.PROJECT_NAME_KEY_TOKEN = exports.NAME_FROM_PROJECT_PROPERTY = exports.collectEvalFindings = exports.DATAPARADE_GRAPH_SCHEMA = exports.DATAPARADE_GRAPH_FILE = exports.writeKnowledgeGraph = exports.buildDataParadeGraph = exports.loadGraphifyGraph = exports.runGraphify = exports.selectPrimaryDataAction = exports.buildDiagramGraphFromScanResult = exports.buildScanPersonalDataLayers = exports.enrichOrchestratorResultWithPersonalDataLayers = exports.runDeterministicScanPhases = exports.finalizeDeterministicScanResult = exports.emitScanProgress = exports.scan = exports.createDefaultScanConfiguration = void 0;
18
+ exports.runDataActionPhase = exports.hasVerb = exports.readDataActions = exports.mergeOneAssignment = exports.mergeAssignmentsOntoComponents = exports.DATA_ACTION_RULE_LANGUAGES = exports.ruleAppliesToLanguage = exports.clearDataActionRulesCacheForTest = exports.loadDataActionRules = exports.loadDataActionRuleCatalog = exports.TERRAFORM_GATEWAY_SUBTYPES = exports.SUBTYPE_STORE_SUBTYPES = exports.deriveFromSubtypes = exports.pathsReferToSameFile = exports.deriveFromPatterns = exports.STORAGE_SUBTYPES = exports.deriveFromTopology = exports.normalizeDataActionToken = exports.normalizeDataAction = exports.isDataAction = exports.DATA_ACTION_SET = exports.DATA_ACTION_FRAMEWORK_ANCHORS = exports.DATA_ACTION_ALIASES = exports.DATA_ACTIONS = exports.tagFindingsWithServiceSections = exports.discoverServiceSections = exports.runAnalyzers = exports.toDisplayName = void 0;
19
19
  var orchestrator_1 = require("./core/pipeline/orchestrator");
20
20
  Object.defineProperty(exports, "createDefaultScanConfiguration", { enumerable: true, get: function () { return orchestrator_1.createDefaultScanConfiguration; } });
21
21
  Object.defineProperty(exports, "scan", { enumerable: true, get: function () { return orchestrator_1.scan; } });
@@ -41,6 +41,8 @@ Object.defineProperty(exports, "DATAPARADE_GRAPH_SCHEMA", { enumerable: true, ge
41
41
  var collect_eval_findings_1 = require("./core/pipeline/collect-eval-findings");
42
42
  Object.defineProperty(exports, "collectEvalFindings", { enumerable: true, get: function () { return collect_eval_findings_1.collectEvalFindings; } });
43
43
  var stable_component_ids_1 = require("./core/pipeline/stable-component-ids");
44
+ Object.defineProperty(exports, "NAME_FROM_PROJECT_PROPERTY", { enumerable: true, get: function () { return stable_component_ids_1.NAME_FROM_PROJECT_PROPERTY; } });
45
+ Object.defineProperty(exports, "PROJECT_NAME_KEY_TOKEN", { enumerable: true, get: function () { return stable_component_ids_1.PROJECT_NAME_KEY_TOKEN; } });
44
46
  Object.defineProperty(exports, "stableComponentKey", { enumerable: true, get: function () { return stable_component_ids_1.stableComponentKey; } });
45
47
  var stable_entity_ids_1 = require("./core/pipeline/stable-entity-ids");
46
48
  Object.defineProperty(exports, "assignStableComponentIds", { enumerable: true, get: function () { return stable_entity_ids_1.assignStableComponentIds; } });
@@ -247,7 +247,13 @@ function validateUnifiedPatternConfig(unified) {
247
247
  throw new Error(`Unified pattern config validation failed: classifier.pattern_defaults is missing ${missingInClassifier.join(", ")}.`);
248
248
  }
249
249
  // Ensure third-party service catalog alignment (serviceName label).
250
- const patternServiceNames = unified.thirdParty.services.map((s) => s.serviceName.toLowerCase());
250
+ const patternServiceNames = [
251
+ ...unified.thirdParty.services.map((s) => s.serviceName),
252
+ ...unified.thirdParty.urlRoutes.flatMap((route) => route.rules.map((rule) => rule.serviceName)),
253
+ ...unified.thirdParty.urlPathRoutes.map((rule) => rule.serviceName),
254
+ ...unified.thirdParty.llmModelPrefixes.map((entry) => entry.serviceName),
255
+ ...unified.thirdParty.googleApiServices.values(),
256
+ ].map((name) => name.toLowerCase());
251
257
  const classifierServiceNames = unified.classifier.thirdParties.map((s) => s.serviceName.toLowerCase());
252
258
  const missingThirdPartyServices = patternServiceNames.filter((svc) => !classifierServiceNames.includes(svc));
253
259
  if (missingThirdPartyServices.length > 0) {
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The owner (user or organization) of the scanned repository's `origin` remote, read from
3
+ * the git config (DATAP-818). It is one more conservative first-party signal: a host whose
4
+ * registrable-domain label matches the owner name is the organization's own service.
5
+ */
6
+ export declare function readGitRemoteOwner(startDir: string): string | undefined;
7
+ /** `git@github.com:Acme/repo.git`, `https://github.com/Acme/repo` -> `Acme`. */
8
+ export declare function ownerFromRemoteUrl(url: string): string | undefined;
9
+ /**
10
+ * Comparable organization name: lowercase, alphanumerics only, common suffixes removed
11
+ * (`Acme-Widgets-AI` -> `acmewidgets`). A suffix is removed only when at least three
12
+ * characters remain.
13
+ */
14
+ export declare function normalizeOrganizationName(name: string): string;