@slicedearth/whoisleuth-cli 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/NOTICE +6 -0
  2. package/README.md +19 -15
  3. package/bin/whoisleuth.mjs +8 -1
  4. package/cli/archive-content-digest.mjs +14 -0
  5. package/cli/archive-inspect.mjs +20 -53
  6. package/cli/arguments.mjs +68 -6
  7. package/cli/artifact-validation/case-response.mjs +47 -41
  8. package/cli/artifact-validation/investigation-capsule.mjs +52 -31
  9. package/cli/artifact-validation/lookup-evidence.mjs +12 -6
  10. package/cli/artifact-validation/signed-review.mjs +83 -61
  11. package/cli/artifact-validation/structure-primitives.mjs +1 -105
  12. package/cli/artifact-verify.mjs +90 -24
  13. package/cli/assurance-command-runner.mjs +39 -4
  14. package/cli/bagit-folder.mjs +57 -0
  15. package/cli/bagit-review.mjs +23 -0
  16. package/cli/bounded-json.mjs +1 -1
  17. package/cli/bulk-command-runner.mjs +2 -0
  18. package/cli/bulk-output.mjs +29 -3
  19. package/cli/case-command.mjs +195 -0
  20. package/cli/case-pack.mjs +39 -31
  21. package/cli/command-argument-grammar.mjs +4 -0
  22. package/cli/command-reference.mjs +145 -75
  23. package/cli/completion.mjs +298 -79
  24. package/cli/config-profile.mjs +7 -5
  25. package/cli/ct-event-intake.mjs +12 -12
  26. package/cli/discover.mjs +4 -3
  27. package/cli/discovery-observation-snapshot.mjs +44 -16
  28. package/cli/discovery-scan-command-runner.mjs +2 -0
  29. package/cli/discovery-scan.mjs +7 -4
  30. package/cli/discovery-workflow.mjs +1 -1
  31. package/cli/domain-control-monitor.mjs +50 -20
  32. package/cli/domain-control-observations.mjs +149 -102
  33. package/cli/errors.mjs +33 -1
  34. package/cli/evidence-command-runner.mjs +16 -5
  35. package/cli/evidence-signing.mjs +2 -2
  36. package/cli/external-observation-mapping.mjs +7 -8
  37. package/cli/formatters/terminal-lookup.mjs +18 -46
  38. package/cli/formatters/terminal-shared.mjs +5 -3
  39. package/cli/formatters/terminal-technology.mjs +114 -0
  40. package/cli/inline-command-families.mjs +1 -0
  41. package/cli/interactive-launcher.mjs +2 -160
  42. package/cli/interchange-report.mjs +4 -8
  43. package/cli/investigation-artifacts.mjs +176 -0
  44. package/cli/investigation-checkpoint.mjs +10 -0
  45. package/cli/investigation-folder.mjs +114 -0
  46. package/cli/investigation-manifest.mjs +1 -112
  47. package/cli/investigation-package-review.mjs +103 -0
  48. package/cli/investigation-plan.mjs +32 -19
  49. package/cli/investigation-run.mjs +188 -33
  50. package/cli/local-document-checkpoint.mjs +170 -0
  51. package/cli/lookup-browser.mjs +5 -12
  52. package/cli/lookup-command-runner.mjs +17 -6
  53. package/cli/lookup-diff.mjs +37 -3
  54. package/cli/lookup-plan.mjs +11 -5
  55. package/cli/lookup-reconcile.mjs +10 -8
  56. package/cli/mail-review.mjs +66 -14
  57. package/cli/manual.mjs +1 -0
  58. package/cli/network-command-runner.mjs +2 -0
  59. package/cli/output-file.mjs +31 -5
  60. package/cli/registry-doctor.mjs +3 -1
  61. package/cli/registry-support.mjs +1 -1
  62. package/cli/retained-artifact-diff.mjs +2 -2
  63. package/cli/review-command-runner.mjs +45 -0
  64. package/cli/runner.mjs +55 -6
  65. package/cli/sharing-review.mjs +21 -34
  66. package/cli/signer-trust.mjs +104 -0
  67. package/cli/source-reliability.mjs +74 -83
  68. package/cli/terminal-input.mjs +168 -0
  69. package/cli/workflow-command-runner.mjs +68 -13
  70. package/docs/cli-reference.md +76 -30
  71. package/docs/cli.md +289 -25
  72. package/lib/abort.mjs +4 -1
  73. package/lib/availability.mjs +161 -112
  74. package/lib/bounded-file.mjs +3 -1
  75. package/lib/bounded-html-document.mjs +125 -0
  76. package/lib/bounded-json.mjs +43 -3
  77. package/lib/browser-library-profile.mjs +42 -51
  78. package/lib/browser-library-worker.mjs +112 -0
  79. package/lib/client-behavior-profile.mjs +3 -3
  80. package/lib/ct-search.mjs +11 -4
  81. package/lib/dns-delegation-health.mjs +24 -14
  82. package/lib/dns-inheritance-review.mjs +217 -0
  83. package/lib/dns-intelligence.mjs +36 -23
  84. package/lib/dns-mx.mjs +1 -1
  85. package/lib/dnssec-evidence-validation.mjs +11 -3
  86. package/lib/domain-change-packet.mjs +7 -2
  87. package/lib/domain-change-review.mjs +14 -8
  88. package/lib/domain-control-flight-recorder.mjs +219 -118
  89. package/lib/domain-control-manifest.mjs +117 -57
  90. package/lib/domain-posture-analysis.mjs +20 -7
  91. package/lib/domain-posture-parsers.mjs +88 -6
  92. package/lib/domain-posture.mjs +113 -26
  93. package/lib/evidence-export-privacy.mjs +561 -0
  94. package/lib/evidence-export.mjs +11 -592
  95. package/lib/evidence-report.mjs +3 -1
  96. package/lib/favicon.mjs +117 -41
  97. package/lib/generated/cisa-kev-catalog.mjs +12 -4
  98. package/lib/generated/registrar-standing-catalogue.mjs +7 -7
  99. package/lib/generated/retire-browser-catalog.mjs +2335 -940
  100. package/lib/hostname.mjs +2 -38
  101. package/lib/html-signals.mjs +82 -85
  102. package/lib/http-evidence-bounds.mjs +2 -1
  103. package/lib/http-intelligence.mjs +39 -26
  104. package/lib/lookup-cache.mjs +34 -11
  105. package/lib/lookup-child-profile-contract.mjs +24 -15
  106. package/lib/lookup-diagnostics.mjs +24 -1
  107. package/lib/lookup-progress.mjs +30 -13
  108. package/lib/lookup-response-contract.mjs +1048 -0
  109. package/lib/lookup-response.mjs +7 -10
  110. package/lib/lookup-source-progress.mjs +17 -14
  111. package/lib/lookup.mjs +48 -27
  112. package/lib/observed-network-context.mjs +43 -27
  113. package/lib/outbound-request-bounds.mjs +4 -1
  114. package/lib/page-fingerprints.mjs +69 -133
  115. package/lib/page-role-profile.mjs +12 -8
  116. package/lib/perceptual-hash.mjs +43 -14
  117. package/lib/rdap-bootstrap.mjs +72 -22
  118. package/lib/rdap-client.mjs +15 -7
  119. package/lib/rdap-normalization.mjs +33 -18
  120. package/lib/rdap-search-workbench.mjs +1 -1
  121. package/lib/rdap-transport.mjs +47 -20
  122. package/lib/rdap-types.mjs +2 -1
  123. package/lib/rdap.mjs +18 -3
  124. package/lib/registrable-domain.mjs +21 -1
  125. package/lib/registrar-standing-contract.mjs +1 -0
  126. package/lib/registry-capabilities.mjs +5 -1
  127. package/lib/registry-capability-catalogue.mjs +2 -1
  128. package/lib/registry-dates.mjs +2 -190
  129. package/lib/registry-insights.mjs +56 -18
  130. package/lib/response-policy.mjs +86 -48
  131. package/lib/risk-calibration-summary.mjs +17 -3
  132. package/lib/rpki-evidence.mjs +8 -5
  133. package/lib/safe-fetch.mjs +54 -47
  134. package/lib/security-txt.mjs +10 -7
  135. package/lib/service-binding-dns.mjs +8 -0
  136. package/lib/smtp-transport-review.mjs +27 -15
  137. package/lib/sslbl-certificates.generated.mjs +136 -135
  138. package/lib/static-html-analysis.mjs +117 -146
  139. package/lib/structured-data-identity.mjs +1 -0
  140. package/lib/technology-markup.mjs +100 -0
  141. package/lib/threat-intelligence-manifests.mjs +11 -139
  142. package/lib/threat-intelligence-runtime.mjs +24 -52
  143. package/lib/threat-intelligence-targets.mjs +6 -34
  144. package/lib/threat-intelligence-types.mjs +39 -0
  145. package/lib/typosquat-generator.mjs +19 -15
  146. package/lib/urlhaus-intelligence.mjs +8 -3
  147. package/lib/urlscan-intelligence.mjs +1 -1
  148. package/lib/website-security-posture.mjs +30 -6
  149. package/lib/website-technology.mjs +111 -71
  150. package/lib/whois-authority.mjs +14 -2
  151. package/lib/whois-chain.mjs +9 -2
  152. package/lib/whois-common-formats.mjs +5 -5
  153. package/lib/whois-contracts.mjs +2 -1
  154. package/lib/whois-dialects.mjs +2 -2
  155. package/lib/whois-parser-support.mjs +8 -1
  156. package/lib/whois-transport.mjs +23 -7
  157. package/package.json +2 -1
  158. package/packages/cases/case-attachment-model.mjs +83 -0
  159. package/packages/cases/case-evidence-model.mjs +156 -62
  160. package/packages/cases/case-export-input.mjs +53 -0
  161. package/packages/cases/case-migration-model.mjs +59 -25
  162. package/packages/cases/case-model.mjs +1 -0
  163. package/packages/cases/case-recheck-model.mjs +91 -0
  164. package/packages/cases/case-record-core.mjs +3 -2
  165. package/packages/cases/case-record-operations.mjs +89 -27
  166. package/packages/cases/case-record-projection.mjs +23 -20
  167. package/packages/cases/case-report.mjs +63 -52
  168. package/packages/cases/case-response-actions.mjs +654 -0
  169. package/packages/cases/case-response-model.mjs +41 -1129
  170. package/packages/cases/case-response-outcomes.mjs +317 -0
  171. package/packages/cases/case-response-packet-render.mjs +153 -0
  172. package/packages/cases/case-response-packet-types.mjs +1 -0
  173. package/packages/cases/case-response-packet-vocabulary.mjs +48 -0
  174. package/packages/cases/case-response-packet.mjs +38 -587
  175. package/packages/cases/case-response-records.mjs +94 -0
  176. package/packages/cases/case-response-review-inputs.mjs +371 -0
  177. package/packages/cases/case-response-values.mjs +85 -0
  178. package/packages/cases/case-review-package.mjs +45 -0
  179. package/packages/cases/case-selection.mjs +46 -0
  180. package/packages/cases/case-storage-model.mjs +25 -0
  181. package/packages/cases/response-route-freshness.mjs +16 -0
  182. package/packages/comparison/capture-context.mjs +61 -0
  183. package/packages/comparison/comparison-ledger-bulk.mjs +4 -1
  184. package/packages/comparison/page-similarity.mjs +2 -1
  185. package/packages/comparison/relationship-evidence.mjs +85 -8
  186. package/packages/comparison/relationship-provenance.mjs +93 -0
  187. package/packages/contracts/analyst-interchange.mjs +216 -0
  188. package/packages/contracts/analyst-review-state-contract.mjs +11 -0
  189. package/packages/contracts/analyst-review-state.mjs +5 -4
  190. package/packages/contracts/case-portability.mjs +279 -116
  191. package/packages/contracts/case-views-contract.mjs +12 -0
  192. package/packages/contracts/case-views.mjs +26 -0
  193. package/packages/contracts/cli-command-semantics.mjs +1 -0
  194. package/packages/contracts/cli-lookup.mjs +0 -1
  195. package/packages/contracts/domain-control-flight-recorder.mjs +80 -42
  196. package/packages/contracts/domain-control-manifest.mjs +127 -73
  197. package/packages/contracts/domain-control-monitor.mjs +48 -45
  198. package/packages/contracts/domain-control-review.mjs +179 -121
  199. package/packages/contracts/domain-name.mjs +21 -0
  200. package/packages/contracts/external-observation-interchange.mjs +2 -1
  201. package/packages/contracts/extracted-domain-lifecycle.mjs +11 -32
  202. package/packages/contracts/http-url.mjs +2 -0
  203. package/packages/contracts/investigation-package-limits.mjs +24 -0
  204. package/packages/contracts/investigation-portability.mjs +56 -27
  205. package/packages/contracts/investigation-run.mjs +16 -0
  206. package/packages/contracts/ip-address.mjs +34 -0
  207. package/packages/contracts/lookup-evidence.mjs +35 -0
  208. package/packages/contracts/offline-comparison.mjs +1 -2
  209. package/packages/contracts/page-fingerprints.mjs +15 -0
  210. package/packages/contracts/risk-calibration.mjs +0 -1
  211. package/packages/contracts/schema-compatibility.mjs +1 -1
  212. package/packages/contracts/schema-lifecycle.mjs +83 -153
  213. package/packages/contracts/selected-file-limits.mjs +6 -0
  214. package/packages/contracts/vulnerability-identifiers.mjs +5 -0
  215. package/packages/contracts/web-capture.mjs +10 -0
  216. package/packages/contracts/workspace-portability.mjs +160 -225
  217. package/packages/evidence/artifact-integrity.mjs +8 -2
  218. package/packages/evidence/artifact-structure.mjs +105 -0
  219. package/packages/evidence/decision-fact.mjs +4 -1
  220. package/packages/evidence/domain-control-runtime.mjs +155 -27
  221. package/packages/evidence/domain-posture-context.mjs +79 -0
  222. package/packages/evidence/image-regions.mjs +56 -0
  223. package/packages/evidence/latest-observations.mjs +28 -0
  224. package/packages/evidence/lookup-target.mjs +104 -0
  225. package/packages/evidence/observation.mjs +16 -1
  226. package/packages/evidence/passphrase-encryption.mjs +44 -0
  227. package/packages/evidence/record-identity.mjs +72 -0
  228. package/packages/evidence/registry-dates.mjs +190 -0
  229. package/packages/evidence/retained-file.mjs +69 -0
  230. package/packages/evidence/review-age.mjs +14 -0
  231. package/packages/interchange/bagit.mjs +342 -0
  232. package/packages/interchange/bounded-zip-extraction.mjs +278 -0
  233. package/packages/interchange/crc32.mjs +17 -0
  234. package/packages/interchange/external-findings-import.mjs +89 -49
  235. package/packages/interchange/web-capture-import.mjs +382 -0
  236. package/packages/investigation/bulk-mail-exposure.mjs +2 -1
  237. package/packages/investigation/investigation-bagit.mjs +14 -0
  238. package/packages/investigation/investigation-capsule.mjs +33 -5
  239. package/packages/investigation/investigation-manifest.mjs +200 -0
  240. package/packages/investigation/investigation-package-crypto.mjs +98 -0
  241. package/packages/investigation/investigation-package.mjs +200 -0
  242. package/packages/investigation/lookup-asset-graph-inputs.mjs +38 -0
  243. package/packages/investigation/lookup-asset-graph.mjs +161 -141
  244. package/packages/investigation/lookup-claim-readiness.mjs +18 -0
  245. package/packages/investigation/lookup-investigation-brief.mjs +3 -3
  246. package/packages/investigation/lookup-task-guidance.mjs +58 -0
  247. package/packages/monitoring/analyst-review-state.mjs +38 -90
  248. package/packages/workspace/brand-profile-model.mjs +158 -20
  249. package/packages/workspace/bulk-columns.mjs +17 -0
  250. package/packages/workspace/bulk-review-model.mjs +11 -5
  251. package/packages/workspace/bulk-session-model.mjs +95 -20
  252. package/packages/workspace/bulk-sort.mjs +1 -0
  253. package/packages/workspace/case-views.mjs +102 -0
  254. package/packages/workspace/hostile-input.mjs +29 -8
  255. package/packages/workspace/investigation-template-model.mjs +19 -4
  256. package/packages/workspace/page-baseline.mjs +18 -15
  257. package/packages/workspace/relationship-observation-model.mjs +41 -26
  258. package/packages/workspace/watchlist-history.mjs +2 -2
  259. package/packages/workspace/watchlist-store.mjs +8 -2
  260. package/packages/workspace/website-snapshot-model.mjs +70 -30
  261. package/packages/workspace/workspace-archive-crypto.mjs +41 -61
  262. package/packages/workspace/workspace-archive.mjs +85 -21
  263. package/third-party-notices.txt +29 -2
  264. package/packages/investigation/bulk-review-export.mjs +0 -63
@@ -0,0 +1,1048 @@
1
+ // Shared HTTP response boundary for the unified Lookup API.
2
+ //
3
+ // The backend owns the evidence collectors, but an HTTP response is still an
4
+ // untrusted value when it reaches the browser. This module keeps the response
5
+ // envelope typed and validates the small set of fields the Lookup controller
6
+ // relies on before any evidence is derived or rendered. Nested source records
7
+ // stay separately attributed and additive; their own normalizers remain the
8
+ // authority for source-specific fields.
9
+ import { THREAT_INTELLIGENCE_CONTRACT_VERSION, THREAT_INTELLIGENCE_CATEGORIES, THREAT_INTELLIGENCE_CONFIDENCES, THREAT_INTELLIGENCE_ENVELOPE_VERSION, THREAT_INTELLIGENCE_RESULT_STATES, THREAT_INTELLIGENCE_SCHEMA, THREAT_INTELLIGENCE_SEVERITIES, } from "./threat-intelligence-types.mjs";
10
+ import { MAX_HTTP_ATTEMPTS, MAX_HTTP_ERROR_LENGTH, MAX_HTTP_EVIDENCE_REDIRECTS, } from "./http-evidence-bounds.mjs";
11
+ import { MAX_OBSERVATION_LIMITATIONS, MAX_OBSERVATION_LIMITATION_LENGTH, normalizeExplicitIsoTimestamp, } from "../packages/evidence/observation.mjs";
12
+ import { assertBoundedJsonStructure } from "./bounded-json.mjs";
13
+ import { canonicalRegistrableDomain } from "./registrable-domain.mjs";
14
+ import { validLookupObservationScope } from "../packages/evidence/lookup-target.mjs";
15
+ import { MAX_LOOKUP_DNS_RECORDS_PER_TYPE, MAX_LOOKUP_REVERSE_DNS_PTR_RECORDS, MAX_LOOKUP_TLS_ALT_NAMES, MAX_LOOKUP_TLS_CERTIFICATE_POLICIES, MAX_LOOKUP_TLS_CHAIN_CERTIFICATES, MAX_LOOKUP_TLS_FINDINGS, MAX_LOOKUP_TLS_NAME_VALUES, } from "./lookup-network-evidence-bounds.mjs";
16
+ import { MAX_SECURITY_POSTURE_FINDINGS, sanitizeLookupChildProfiles, validSecurityPostureFinding, validTlsChainCertificate, validTlsFinding, } from "./lookup-child-profile-contract.mjs";
17
+ import { validHttpDeliveryMetadata, validPagePublicationMetadata, } from "./homepage-metadata-contract.mjs";
18
+ import { resolveRegistrarIanaId, validRegistrarStanding, } from "./registrar-standing-contract.mjs";
19
+ import { LOOKUP_CONTROL_CHAR_RE as CONTROL_CHAR_RE, isJsonObject, normalizedDomain, validBoundedString, validHttpProvenanceUrl, validObservationDiagnostics, validOptionalNullableText, validStringArray, validUint, } from "./lookup-contract-primitives.mjs";
20
+ const INVALID_LOOKUP_RESPONSE = 'INVALID_LOOKUP_RESPONSE';
21
+ const INVALID_LOOKUP_RESPONSE_MESSAGE = 'Lookup returned an invalid response.';
22
+ const INVALID_COMPACT_LOOKUP_RESPONSE = 'INVALID_COMPACT_LOOKUP_RESPONSE';
23
+ const INVALID_COMPACT_LOOKUP_RESPONSE_MESSAGE = 'Bulk lookup returned an invalid response.';
24
+ const MAX_LOOKUP_RESPONSE_QUERY_LENGTH = 4096;
25
+ const MAX_LOOKUP_RESPONSE_HOST_LENGTH = 253;
26
+ const MAX_LOOKUP_RESPONSE_PAGE_TITLE_LENGTH = 200;
27
+ const MAX_LOOKUP_RESPONSE_TOP_LEVEL_KEYS = 32;
28
+ const MAX_LOOKUP_RESPONSE_ERROR_LENGTH = 240;
29
+ const MAX_LOOKUP_RESPONSE_CONTAINER_ITEMS = 500;
30
+ const MAX_COMPACT_LOOKUP_RESPONSE_TOP_LEVEL_KEYS = 8;
31
+ const MAX_COMPACT_LOOKUP_AVAILABILITY_KEYS = 128;
32
+ const MAX_COMPACT_LOOKUP_DIAGNOSTIC_KEYS = 16;
33
+ const MAX_COMPACT_BULK_TECHNOLOGY_IDS = 12;
34
+ const MAX_THREAT_INTELLIGENCE_PROVIDERS = 10;
35
+ const MAX_THREAT_INTELLIGENCE_FINDINGS = 100;
36
+ const MAX_THREAT_INTELLIGENCE_LIMITATIONS = 10;
37
+ const MAX_THREAT_INTELLIGENCE_TEXT_LENGTH = 500;
38
+ const MAX_LOOKUP_TIMING_MS = 120_000;
39
+ const MAX_LOOKUP_TIMING_SOURCES = 10;
40
+ const QUERY_TYPES = new Set(['domain', 'ipv4', 'ipv6', 'asn']);
41
+ const COMPACT_AVAILABILITY_STATES = new Set([
42
+ 'available',
43
+ 'expiring',
44
+ 'for_sale',
45
+ 'registered',
46
+ 'unknown',
47
+ ]);
48
+ const COMPACT_CONFIDENCE_LEVELS = new Set(['high', 'low', 'medium']);
49
+ const COMPACT_AVAILABILITY_DIAGNOSTIC_STATES = new Set(['complete', 'disabled', 'error']);
50
+ const COMPACT_BULK_COMPARISON_STATES = new Set([
51
+ 'error',
52
+ 'not_found',
53
+ 'partial',
54
+ 'success',
55
+ 'unavailable',
56
+ ]);
57
+ const COMPACT_BULK_TECHNOLOGY_ID_RE = /^[a-z0-9][a-z0-9_-]{0,79}$/u;
58
+ const SHA256_RE = /^[a-f0-9]{64}$/u;
59
+ const THREAT_INTELLIGENCE_PROVIDERS = Object.freeze({
60
+ urlscan_search: Object.freeze({ label: 'URLscan archived verdicts', host: 'urlscan.io' }),
61
+ urlhaus_host: Object.freeze({ label: 'URLhaus malware-host records', host: 'urlhaus.abuse.ch' }),
62
+ threatfox_domain_ioc: Object.freeze({ label: 'ThreatFox malware IOCs', host: 'threatfox.abuse.ch' }),
63
+ });
64
+ const THREAT_INTELLIGENCE_STATES = new Set(THREAT_INTELLIGENCE_RESULT_STATES);
65
+ const THREAT_INTELLIGENCE_CATEGORY_SET = new Set(THREAT_INTELLIGENCE_CATEGORIES);
66
+ const THREAT_INTELLIGENCE_SEVERITY_SET = new Set(THREAT_INTELLIGENCE_SEVERITIES);
67
+ const THREAT_INTELLIGENCE_CONFIDENCE_SET = new Set(THREAT_INTELLIGENCE_CONFIDENCES);
68
+ const LOOKUP_TIMING_SOURCES = new Set([
69
+ 'rdap',
70
+ 'whois',
71
+ 'domain_evidence',
72
+ 'reverse_dns',
73
+ 'registrar_rdap',
74
+ 'network_context',
75
+ 'security_txt',
76
+ 'external_intelligence',
77
+ 'malware_host_intelligence',
78
+ 'malware_ioc_intelligence',
79
+ ]);
80
+ const LOOKUP_TIMING_OUTCOMES = new Set(['fulfilled', 'rejected']);
81
+ const EMPTY_RECORD = Object.freeze({});
82
+ function record(value) {
83
+ return isJsonObject(value) ? value : EMPTY_RECORD;
84
+ }
85
+ function boundedThreatText(value, maximum = MAX_THREAT_INTELLIGENCE_TEXT_LENGTH) {
86
+ if (typeof value !== 'string' || CONTROL_CHAR_RE.test(value))
87
+ return null;
88
+ const text = value.slice(0, maximum * 2).trim();
89
+ return text ? text.slice(0, maximum) : null;
90
+ }
91
+ function threatTimestamp(value) {
92
+ const text = boundedThreatText(value, 40);
93
+ return text ? normalizeExplicitIsoTimestamp(text) : null;
94
+ }
95
+ function attributedThreatUrl(value, providerId) {
96
+ const expectedHost = THREAT_INTELLIGENCE_PROVIDERS[providerId]?.host;
97
+ if (!expectedHost || typeof value !== 'string' || value.length > 1_024 || CONTROL_CHAR_RE.test(value))
98
+ return null;
99
+ try {
100
+ const url = new URL(value);
101
+ return url.protocol === 'https:' && !url.username && !url.password && url.hostname === expectedHost
102
+ ? url.href
103
+ : null;
104
+ }
105
+ catch {
106
+ return null;
107
+ }
108
+ }
109
+ function normalizeThreatFinding(value, providerId) {
110
+ const input = record(value);
111
+ const category = boundedThreatText(input.category, 32);
112
+ if (!category || !THREAT_INTELLIGENCE_CATEGORY_SET.has(category))
113
+ return null;
114
+ const referenceUrl = attributedThreatUrl(input.referenceUrl, providerId);
115
+ const tags = Array.isArray(input.tags)
116
+ ? [...new Set(input.tags.slice(0, 40).map((tag) => boundedThreatText(tag, 80)).filter((tag) => tag !== null))].slice(0, 20)
117
+ : [];
118
+ const firstObservedAt = threatTimestamp(input.firstObservedAt);
119
+ const lastObservedAt = threatTimestamp(input.lastObservedAt);
120
+ const severity = boundedThreatText(input.severity, 32);
121
+ const confidence = boundedThreatText(input.confidence, 32);
122
+ if (firstObservedAt && lastObservedAt && Date.parse(firstObservedAt) > Date.parse(lastObservedAt))
123
+ return null;
124
+ return {
125
+ id: boundedThreatText(input.id, 160),
126
+ category,
127
+ severity: severity && THREAT_INTELLIGENCE_SEVERITY_SET.has(severity) ? severity : 'unknown',
128
+ confidence: confidence && THREAT_INTELLIGENCE_CONFIDENCE_SET.has(confidence) ? confidence : 'unknown',
129
+ providerVerdict: boundedThreatText(input.providerVerdict, 120),
130
+ detail: boundedThreatText(input.detail),
131
+ firstObservedAt,
132
+ lastObservedAt,
133
+ referenceUrl,
134
+ tags,
135
+ };
136
+ }
137
+ function normalizeThreatProvider(value, expectedDomain) {
138
+ const input = record(value);
139
+ if (input.schema !== THREAT_INTELLIGENCE_SCHEMA
140
+ || input.version !== THREAT_INTELLIGENCE_CONTRACT_VERSION)
141
+ return null;
142
+ const target = record(input.target);
143
+ if (target.type !== 'domain'
144
+ || target.exposure !== 'registrable_domain'
145
+ || target.value !== expectedDomain)
146
+ return null;
147
+ const identity = record(input.provider);
148
+ const providerId = boundedThreatText(identity.id, 80);
149
+ const providerDefinition = providerId ? THREAT_INTELLIGENCE_PROVIDERS[providerId] : null;
150
+ if (!providerId || !providerDefinition)
151
+ return null;
152
+ const state = boundedThreatText(input.state, 32);
153
+ if (!state || !THREAT_INTELLIGENCE_STATES.has(state))
154
+ return null;
155
+ const observationInput = record(input.observation);
156
+ const limitations = Array.isArray(observationInput.limitations)
157
+ ? observationInput.limitations
158
+ .slice(0, MAX_THREAT_INTELLIGENCE_LIMITATIONS * 2)
159
+ .map((limitation) => boundedThreatText(limitation))
160
+ .filter((limitation) => limitation !== null)
161
+ .slice(0, MAX_THREAT_INTELLIGENCE_LIMITATIONS)
162
+ : [];
163
+ const inputFindings = Array.isArray(input.findings) ? input.findings : [];
164
+ const normalizedFindings = inputFindings
165
+ .slice(0, MAX_THREAT_INTELLIGENCE_FINDINGS * 2)
166
+ .map((finding) => normalizeThreatFinding(finding, providerId))
167
+ .filter((finding) => finding !== null);
168
+ const findings = normalizedFindings.slice(0, MAX_THREAT_INTELLIGENCE_FINDINGS);
169
+ const omitted = inputFindings.length - findings.length;
170
+ const projectionIncomplete = omitted > 0 || !Array.isArray(input.findings);
171
+ const projectionTruncated = inputFindings.length > MAX_THREAT_INTELLIGENCE_FINDINGS * 2
172
+ || normalizedFindings.length > MAX_THREAT_INTELLIGENCE_FINDINGS;
173
+ if (projectionIncomplete) {
174
+ // Local qualification precedes supplied notices so a full limitation
175
+ // list cannot conceal evidence discarded at this trust boundary.
176
+ limitations.unshift(omitted > 0
177
+ ? `${omitted} invalid or over-limit provider finding${omitted === 1 ? ' was' : 's were'} omitted from this view.`
178
+ : 'Provider findings were not a supported array and were withheld from this view.');
179
+ }
180
+ return {
181
+ schema: THREAT_INTELLIGENCE_SCHEMA,
182
+ version: THREAT_INTELLIGENCE_CONTRACT_VERSION,
183
+ provider: {
184
+ id: providerId,
185
+ label: providerDefinition.label,
186
+ },
187
+ target: {
188
+ type: 'domain',
189
+ value: expectedDomain,
190
+ exposure: 'registrable_domain',
191
+ },
192
+ state: projectionIncomplete && ['success', 'not_found'].includes(state) ? 'partial' : state,
193
+ detail: boundedThreatText(input.detail),
194
+ findings,
195
+ observation: {
196
+ observedAt: threatTimestamp(observationInput.observedAt),
197
+ limitations: limitations.slice(0, MAX_THREAT_INTELLIGENCE_LIMITATIONS),
198
+ complete: projectionIncomplete ? false : typeof observationInput.complete === 'boolean' ? observationInput.complete : null,
199
+ truncated: projectionTruncated ? true : typeof observationInput.truncated === 'boolean' ? observationInput.truncated : null,
200
+ },
201
+ };
202
+ }
203
+ function projectThreatProviders(values, expectedDomain) {
204
+ const grouped = new Map();
205
+ for (const value of values.slice(0, MAX_THREAT_INTELLIGENCE_PROVIDERS * 2)) {
206
+ const provider = normalizeThreatProvider(value, expectedDomain);
207
+ if (!provider)
208
+ continue;
209
+ const providerId = String(record(provider.provider).id || '');
210
+ if (!providerId)
211
+ continue;
212
+ const signature = JSON.stringify(provider);
213
+ const existing = grouped.get(providerId);
214
+ if (existing) {
215
+ existing.signatures.add(signature);
216
+ }
217
+ else {
218
+ grouped.set(providerId, { first: provider, signatures: new Set([signature]) });
219
+ }
220
+ }
221
+ return [...grouped.values()].slice(0, MAX_THREAT_INTELLIGENCE_PROVIDERS).map(({ first, signatures }) => (signatures.size === 1
222
+ ? first
223
+ : {
224
+ ...first,
225
+ state: 'partial',
226
+ detail: 'Conflicting records were returned for this provider; no conclusive provider projection is available.',
227
+ findings: [],
228
+ observation: {
229
+ observedAt: null,
230
+ limitations: ['Conflicting records for the same provider identity were withheld rather than resolved by array order.'],
231
+ complete: false,
232
+ truncated: null,
233
+ },
234
+ }));
235
+ }
236
+ function optionalBoundedText(value, maxLength) {
237
+ return value === undefined || (typeof value === 'string'
238
+ && value.length <= maxLength
239
+ && !CONTROL_CHAR_RE.test(value));
240
+ }
241
+ function validCompactBulkComparison(value) {
242
+ if (!isJsonObject(value)
243
+ || Object.keys(value).length > 3
244
+ || value.version !== 1
245
+ || !isJsonObject(value.technology)
246
+ || Object.keys(value.technology).length > 3
247
+ || typeof value.technology.state !== 'string'
248
+ || !COMPACT_BULK_COMPARISON_STATES.has(value.technology.state)
249
+ || !Array.isArray(value.technology.ids)
250
+ || value.technology.ids.length > MAX_COMPACT_BULK_TECHNOLOGY_IDS
251
+ || typeof value.technology.truncated !== 'boolean'
252
+ || !isJsonObject(value.tls)
253
+ || Object.keys(value.tls).length > 3
254
+ || typeof value.tls.state !== 'string'
255
+ || !COMPACT_BULK_COMPARISON_STATES.has(value.tls.state)
256
+ || (value.tls.issuerLabel !== null && !optionalBoundedText(value.tls.issuerLabel, 240))
257
+ || (value.tls.spkiSha256 !== null
258
+ && (typeof value.tls.spkiSha256 !== 'string' || !SHA256_RE.test(value.tls.spkiSha256)))) {
259
+ return false;
260
+ }
261
+ const ids = value.technology.ids;
262
+ return ids.every((id) => typeof id === 'string' && COMPACT_BULK_TECHNOLOGY_ID_RE.test(id))
263
+ && new Set(ids).size === ids.length;
264
+ }
265
+ function invalidLookupResponse() {
266
+ return {
267
+ ok: false,
268
+ errorCode: INVALID_LOOKUP_RESPONSE,
269
+ error: INVALID_LOOKUP_RESPONSE_MESSAGE,
270
+ };
271
+ }
272
+ function invalidCompactLookupResponse() {
273
+ return {
274
+ ok: false,
275
+ errorCode: INVALID_COMPACT_LOOKUP_RESPONSE,
276
+ error: INVALID_COMPACT_LOOKUP_RESPONSE_MESSAGE,
277
+ };
278
+ }
279
+ function validOptionalHttpUrl(value) {
280
+ return value === undefined || value === null || validHttpProvenanceUrl(value);
281
+ }
282
+ function validOptionalHttpStatus(value) {
283
+ return value === undefined || value === null
284
+ || Number.isInteger(value) && Number(value) >= 100 && Number(value) <= 599;
285
+ }
286
+ function validObservationLimitations(value) {
287
+ return value === undefined || Array.isArray(value)
288
+ && value.length <= MAX_OBSERVATION_LIMITATIONS
289
+ && value.every((item) => typeof item === 'string'
290
+ && Boolean(item)
291
+ && item.length <= MAX_OBSERVATION_LIMITATION_LENGTH
292
+ && !CONTROL_CHAR_RE.test(item));
293
+ }
294
+ function validObservationFields(value) {
295
+ if (!isJsonObject(value))
296
+ return false;
297
+ return optionalBoundedText(value.status, 40)
298
+ && optionalBoundedText(value.source, 40)
299
+ && optionalBoundedText(value.observedAt, 64)
300
+ && (value.scanMode === undefined || value.scanMode === null
301
+ || typeof value.scanMode === 'string' && ['fast', 'deep'].includes(value.scanMode))
302
+ && (value.durationMs === undefined || value.durationMs === null
303
+ || Number.isFinite(value.durationMs) && Number(value.durationMs) >= 0
304
+ && Number(value.durationMs) <= 120_000)
305
+ && (value.complete === undefined || typeof value.complete === 'boolean')
306
+ && (value.truncated === undefined || typeof value.truncated === 'boolean')
307
+ && validObservationLimitations(value.limitations)
308
+ && validObservationDiagnostics(value.diagnostics);
309
+ }
310
+ function validSourceStatus(value) {
311
+ if (!isJsonObject(value))
312
+ return false;
313
+ return optionalBoundedText(value.status, 40)
314
+ && (value.error === undefined || value.error === null || optionalBoundedText(value.error, 240))
315
+ && (value.endpoint === undefined || value.endpoint === null || optionalBoundedText(value.endpoint, 2_048))
316
+ && (value.detail === undefined || value.detail === null || optionalBoundedText(value.detail, 500))
317
+ && (value.fetchedAt === undefined || value.fetchedAt === null || optionalBoundedText(value.fetchedAt, 64))
318
+ && (value.queriedAt === undefined || value.queriedAt === null || optionalBoundedText(value.queriedAt, 64))
319
+ && (value.attempts === undefined || Array.isArray(value.attempts)
320
+ && value.attempts.length <= 3
321
+ && value.attempts.every((item) => isJsonObject(item)
322
+ && optionalBoundedText(item.outcome, 40)));
323
+ }
324
+ function validNormalizedHttpEvidence(value) {
325
+ if (!validObservationFields(value)
326
+ || !validOptionalHttpUrl(value.requestUrl)
327
+ || !validOptionalHttpUrl(value.finalUrl)
328
+ || !validObservationLimitations(value.limitations))
329
+ return false;
330
+ const redirects = value.redirects;
331
+ if (redirects !== undefined && (!Array.isArray(redirects)
332
+ || redirects.length > MAX_HTTP_EVIDENCE_REDIRECTS
333
+ || !redirects.every((item) => isJsonObject(item)
334
+ && validHttpProvenanceUrl(item.from)
335
+ && validHttpProvenanceUrl(item.to)
336
+ && validOptionalHttpStatus(item.status)
337
+ && (item.queryOmitted === undefined || typeof item.queryOmitted === 'boolean'))))
338
+ return false;
339
+ const attempts = value.attempts;
340
+ if (attempts !== undefined && (!Array.isArray(attempts)
341
+ || attempts.length > MAX_HTTP_ATTEMPTS
342
+ || !attempts.every((item) => isJsonObject(item)
343
+ && validOptionalHttpUrl(item.url)
344
+ && validOptionalHttpStatus(item.httpStatus)
345
+ && (item.queryOmitted === undefined || typeof item.queryOmitted === 'boolean')
346
+ && (item.outcome === undefined || typeof item.outcome === 'string'
347
+ && ['error', 'response', 'unknown'].includes(item.outcome))
348
+ && (item.error === undefined || item.error === null || typeof item.error === 'string'
349
+ && item.error.length <= MAX_HTTP_ERROR_LENGTH && !CONTROL_CHAR_RE.test(item.error)))))
350
+ return false;
351
+ if (value.redirectCount !== undefined
352
+ && (!Number.isInteger(value.redirectCount)
353
+ || Number(value.redirectCount) < 0
354
+ || Number(value.redirectCount) > MAX_HTTP_EVIDENCE_REDIRECTS))
355
+ return false;
356
+ if (Array.isArray(redirects) && value.redirectCount !== undefined
357
+ && value.redirectCount !== redirects.length)
358
+ return false;
359
+ if (value.response !== undefined && value.response !== null) {
360
+ if (!isJsonObject(value.response)
361
+ || !validOptionalHttpStatus(value.response.status)
362
+ || value.response.deliveryMetadata !== undefined
363
+ && (!['success', 'partial'].includes(String(value.status))
364
+ || !validHttpDeliveryMetadata(value.response.deliveryMetadata)))
365
+ return false;
366
+ }
367
+ return true;
368
+ }
369
+ function optionalStringArrayWithin(value, maximum) {
370
+ return value === undefined || Array.isArray(value)
371
+ && value.length <= maximum
372
+ && value.every((item) => typeof item === 'string');
373
+ }
374
+ function optionalRecordArrayWithin(value, maximum) {
375
+ return value === undefined || Array.isArray(value)
376
+ && value.length <= maximum
377
+ && value.every(isJsonObject);
378
+ }
379
+ function validDnsMxRecord(value) {
380
+ return isJsonObject(value)
381
+ && validUint(value.priority, 0xffff)
382
+ && validBoundedString(value.exchange, 253, true);
383
+ }
384
+ function validDnsCaaRecord(value) {
385
+ return isJsonObject(value)
386
+ && validUint(value.critical, 0xff)
387
+ && typeof value.tag === 'string'
388
+ && /^[a-z0-9-]{1,15}$/u.test(value.tag)
389
+ && validBoundedString(value.value, 1_024);
390
+ }
391
+ function validDnsSoaRecord(value) {
392
+ return isJsonObject(value)
393
+ && validBoundedString(value.nsname, 253)
394
+ && validBoundedString(value.hostmaster, 253)
395
+ && ['serial', 'refresh', 'retry', 'expire', 'minttl']
396
+ .every((key) => validUint(value[key], 0xffff_ffff));
397
+ }
398
+ function validUintArray(value, maximumItems) {
399
+ return Array.isArray(value)
400
+ && value.length <= maximumItems
401
+ && value.every((item) => validUint(item, 0xffff));
402
+ }
403
+ function validDnsHttpsRecord(value) {
404
+ if (!isJsonObject(value)
405
+ || value.type !== 'HTTPS'
406
+ || !validBoundedString(value.owner, 253)
407
+ || !validUint(value.ttl, 0xffff_ffff)
408
+ || !validUint(value.priority, 0xffff)
409
+ || typeof value.mode !== 'string'
410
+ || !['alias', 'service'].includes(value.mode)
411
+ || !(value.target === null || validBoundedString(value.target, 253))
412
+ || typeof value.targetIsOwner !== 'boolean'
413
+ || typeof value.serviceUnavailable !== 'boolean'
414
+ || typeof value.compatible !== 'boolean'
415
+ || typeof value.parametersIgnored !== 'boolean'
416
+ || !isJsonObject(value.parameters))
417
+ return false;
418
+ const parameters = value.parameters;
419
+ if (Object.keys(parameters).length > 24
420
+ || !validUintArray(parameters.mandatory, 24)
421
+ || !validStringArray(parameters.alpn, 16, 132)
422
+ || typeof parameters.noDefaultAlpn !== 'boolean'
423
+ || !(parameters.port === null || validUint(parameters.port, 0xffff))
424
+ || !validStringArray(parameters.ipv4hint, 8, 64)
425
+ || !validStringArray(parameters.ipv6hint, 8, 64)
426
+ || !validUintArray(parameters.unknownKeys, 24)
427
+ || !validUintArray(parameters.unsupportedMandatoryKeys, 24)
428
+ || !Array.isArray(parameters.opaque)
429
+ || parameters.opaque.length > 24)
430
+ return false;
431
+ return parameters.opaque.every((item) => isJsonObject(item)
432
+ && validUint(item.key, 0xffff)
433
+ && (item.name === null || typeof item.name === 'string' && /^[a-z0-9-]{1,63}$/u.test(item.name))
434
+ && validUint(item.length, 0xffff));
435
+ }
436
+ function validOptionalStringArray(value, maximumItems, maximumLength) {
437
+ return value === undefined || validStringArray(value, maximumItems, maximumLength);
438
+ }
439
+ function validOptionalRecordArray(value, maximumItems, validate) {
440
+ return value === undefined || Array.isArray(value)
441
+ && value.length <= maximumItems
442
+ && value.every(validate);
443
+ }
444
+ function validRdapLink(value) {
445
+ return isJsonObject(value)
446
+ && validBoundedString(value.href, 2_048)
447
+ && validOptionalNullableText(value.rel, 100)
448
+ && validOptionalNullableText(value.type, 160)
449
+ && validOptionalNullableText(value.title, 300);
450
+ }
451
+ function validRdapContact(value) {
452
+ if (!isJsonObject(value))
453
+ return false;
454
+ return validOptionalNullableText(value.handle, 200)
455
+ && validOptionalNullableText(value.name, 300)
456
+ && validOptionalNullableText(value.org, 300)
457
+ && validOptionalNullableText(value.email, 320)
458
+ && validOptionalNullableText(value.phone, 100)
459
+ && validOptionalNullableText(value.address, 1_000)
460
+ && validOptionalStringArray(value.roles, 12, 80)
461
+ && validOptionalStringArray(value.names, 8, 300)
462
+ && validOptionalStringArray(value.organizations, 8, 300)
463
+ && validOptionalStringArray(value.emails, 8, 320)
464
+ && validOptionalStringArray(value.phones, 8, 100)
465
+ && validOptionalStringArray(value.addresses, 8, 1_000)
466
+ && validOptionalRecordArray(value.publicIds, 20, (item) => isJsonObject(item)
467
+ && validBoundedString(item.type, 160)
468
+ && validBoundedString(item.identifier, 300))
469
+ && validOptionalRecordArray(value.links, 10, validRdapLink);
470
+ }
471
+ function validRdapTextBlock(value) {
472
+ return isJsonObject(value)
473
+ && validBoundedString(value.title, 160)
474
+ && validOptionalNullableText(value.type, 160)
475
+ && validStringArray(value.descriptions, 6, 800);
476
+ }
477
+ function validRdapParsed(value) {
478
+ if (!isJsonObject(value))
479
+ return false;
480
+ if (!validOptionalStringArray(value.statuses, 100, 160)
481
+ || !validOptionalStringArray(value.nameservers, 200, 253)
482
+ || !validOptionalStringArray(value.conformance, 50, 160)
483
+ || !validOptionalStringArray(value.serverTruncationReasons, 8, 160)
484
+ || !validOptionalStringArray(value.truncatedEntityRoles, 11, 80)
485
+ || !validOptionalRecordArray(value.events, 100, (item) => isJsonObject(item)
486
+ && validOptionalNullableText(item.action, 160)
487
+ && validOptionalNullableText(item.date, 64))
488
+ || !validOptionalRecordArray(value.links, 20, validRdapLink)
489
+ || !validOptionalRecordArray(value.nameserverDetails, 200, (item) => isJsonObject(item)
490
+ && validBoundedString(item.name, 253)
491
+ && validStringArray(item.addresses, 20, 80))
492
+ || !validOptionalRecordArray(value.dsData, 50, (item) => isJsonObject(item)
493
+ && validUint(item.keyTag, 0xffff)
494
+ && validUint(item.algorithm, 0xff)
495
+ && validUint(item.digestType, 0xff)
496
+ && validBoundedString(item.digest, 512))
497
+ || !validOptionalRecordArray(value.notices, 12, validRdapTextBlock)
498
+ || !validOptionalRecordArray(value.remarks, 12, validRdapTextBlock)
499
+ || !validOptionalRecordArray(value.redactions, 100, (item) => isJsonObject(item)
500
+ && ['name', 'method', 'reason'].every((key) => validOptionalNullableText(item[key], 500))
501
+ && ['prePath', 'postPath', 'replacementPath']
502
+ .every((key) => validOptionalNullableText(item[key], 512)))
503
+ || !validOptionalRecordArray(value.variants, 20, (group) => isJsonObject(group)
504
+ && validOptionalNullableText(group.idnTable, 300)
505
+ && validOptionalStringArray(group.relation, 20, 100)
506
+ && validOptionalRecordArray(group.variantNames, 50, (name) => isJsonObject(name)
507
+ && validOptionalNullableText(name.ldhName, 253)
508
+ && validOptionalNullableText(name.unicodeName, 253))))
509
+ return false;
510
+ const entitiesByRole = value.entitiesByRole;
511
+ if (entitiesByRole !== undefined) {
512
+ if (!isJsonObject(entitiesByRole) || Object.keys(entitiesByRole).length > 11)
513
+ return false;
514
+ for (const [role, contacts] of Object.entries(entitiesByRole)) {
515
+ if (!['registrar', 'registrant', 'administrative', 'technical', 'billing', 'abuse', 'noc', 'reseller', 'sponsor', 'proxy', 'notifications'].includes(role)
516
+ || !Array.isArray(contacts)
517
+ || contacts.length > 5
518
+ || !contacts.every(validRdapContact))
519
+ return false;
520
+ }
521
+ }
522
+ return true;
523
+ }
524
+ function validWhoisParsed(value) {
525
+ if (!isJsonObject(value)
526
+ || !validOptionalStringArray(value.statuses, 100, 160)
527
+ || !validOptionalStringArray(value.nameservers, 200, 253)
528
+ || !validOptionalStringArray(value.fieldsTruncated, 64, 80))
529
+ return false;
530
+ const contactsByRole = value.contactsByRole;
531
+ if (contactsByRole !== undefined) {
532
+ if (!isJsonObject(contactsByRole) || Object.keys(contactsByRole).length > 5)
533
+ return false;
534
+ for (const contacts of Object.values(contactsByRole)) {
535
+ if (!Array.isArray(contacts) || contacts.length > 1 || !contacts.every(validRdapContact))
536
+ return false;
537
+ }
538
+ }
539
+ return true;
540
+ }
541
+ function validRegistrationEvidence(value) {
542
+ const rdap = value.rdap;
543
+ const whois = value.whois;
544
+ const rdapDiagnostics = isJsonObject(value.diagnostics.rdap) ? value.diagnostics.rdap : null;
545
+ const whoisDiagnostics = isJsonObject(value.diagnostics.whois) ? value.diagnostics.whois : null;
546
+ if (!validSourceStatus(rdap)
547
+ || !validSourceStatus(whois)
548
+ || rdapDiagnostics !== null && !validSourceStatus(rdapDiagnostics)
549
+ || whoisDiagnostics !== null && !validSourceStatus(whoisDiagnostics)
550
+ || rdapDiagnostics?.status === 'success' && !isJsonObject(rdap.parsed)
551
+ || whoisDiagnostics?.status === 'complete' && !isJsonObject(whois.parsed))
552
+ return false;
553
+ if (rdap.parsed !== undefined && rdap.parsed !== null && !validRdapParsed(rdap.parsed))
554
+ return false;
555
+ if (whois.parsed !== undefined && whois.parsed !== null && !validWhoisParsed(whois.parsed))
556
+ return false;
557
+ const registrar = rdap.registrarRdap;
558
+ return registrar === undefined || registrar === null || validSourceStatus(registrar)
559
+ && (registrar.parsed === undefined || registrar.parsed === null || validRdapParsed(registrar.parsed));
560
+ }
561
+ function validPageEvidence(value) {
562
+ const availability = value.availability;
563
+ const page = availability.pageIdentity;
564
+ if (page !== undefined && page !== null) {
565
+ if (!validObservationFields(page)
566
+ || page.publicationMetadata !== undefined
567
+ && (!['success', 'partial'].includes(String(page.status))
568
+ || !validPagePublicationMetadata(page.publicationMetadata))
569
+ || !validOptionalStringArray(page.embeddedOrigins, 20, 2_048)
570
+ || !validOptionalStringArray(page.contactDomains, 20, 253)
571
+ || !validOptionalRecordArray(page.trackingIdentifiers, 30, (item) => isJsonObject(item)
572
+ && validBoundedString(item.type, 80)
573
+ && validBoundedString(item.value, 240)))
574
+ return false;
575
+ if (page.forms !== undefined && (!isJsonObject(page.forms)
576
+ || !validOptionalStringArray(page.forms.externalActionOrigins, 10, 2_048)))
577
+ return false;
578
+ if (page.resources !== undefined && (!isJsonObject(page.resources)
579
+ || !validOptionalStringArray(page.resources.externalOrigins, 30, 2_048)))
580
+ return false;
581
+ if (page.downloads !== undefined && (!isJsonObject(page.downloads)
582
+ || !validOptionalStringArray(page.downloads.riskyFileTypes, 20, 80)
583
+ || !validOptionalStringArray(page.downloads.externalOrigins, 20, 2_048)))
584
+ return false;
585
+ }
586
+ const technology = availability.technologyProfile;
587
+ if (technology !== undefined && technology !== null) {
588
+ if (!validObservationFields(technology)
589
+ || !validOptionalRecordArray(technology.findings, 24, (finding) => isJsonObject(finding)
590
+ && validOptionalRecordArray(finding.evidence, 4, (item) => isJsonObject(item)
591
+ && validBoundedString(item.source, 80)
592
+ && validBoundedString(item.description, 180))))
593
+ return false;
594
+ const libraries = technology.browserLibraryProfile;
595
+ if (libraries !== undefined && libraries !== null && (!validObservationFields(libraries)
596
+ || !validOptionalRecordArray(libraries.findings, 16, (item) => isJsonObject(item))))
597
+ return false;
598
+ }
599
+ const structured = availability.structuredDataIdentity;
600
+ if (structured !== undefined && structured !== null && (!validObservationFields(structured)
601
+ || !validOptionalRecordArray(structured.entities, 16, (entity) => isJsonObject(entity)
602
+ && validOptionalStringArray(entity.types, 8, 160)
603
+ && validOptionalStringArray(entity.sameAsHosts, 12, 253))))
604
+ return false;
605
+ const roles = availability.pageRoleProfile;
606
+ if (roles !== undefined && roles !== null && (!validObservationFields(roles)
607
+ || !validOptionalRecordArray(roles.findings, 4, (finding) => isJsonObject(finding)
608
+ && validOptionalStringArray(finding.evidence, 4, 300))))
609
+ return false;
610
+ const behavior = availability.clientBehaviorProfile;
611
+ if (behavior !== undefined && behavior !== null && (!validObservationFields(behavior)
612
+ || !validOptionalRecordArray(behavior.indicators, 12, (item) => isJsonObject(item))))
613
+ return false;
614
+ const credential = availability.credentialSurfaceProfile;
615
+ return credential === undefined || credential === null || validObservationFields(credential);
616
+ }
617
+ function validAvailabilityScalars(value) {
618
+ return (value.applicable === undefined || typeof value.applicable === 'boolean')
619
+ && validOptionalNullableText(value.domain, MAX_LOOKUP_RESPONSE_HOST_LENGTH)
620
+ && validOptionalNullableText(value.state, 40)
621
+ && validOptionalNullableText(value.confidence, 40)
622
+ && validOptionalNullableText(value.activityStatus, 40)
623
+ && validOptionalNullableText(value.websiteProbeDetail, 500)
624
+ && validOptionalNullableText(value.pageTitle, MAX_LOOKUP_RESPONSE_PAGE_TITLE_LENGTH)
625
+ && validOptionalNullableText(value.dnssec, 40)
626
+ && (value.deepScanComplete === undefined || typeof value.deepScanComplete === 'boolean')
627
+ && (value.hasMx === undefined || value.hasMx === null || typeof value.hasMx === 'boolean')
628
+ && (value.hasNullMx === undefined || value.hasNullMx === null || typeof value.hasNullMx === 'boolean')
629
+ && (value.hasSpf === undefined || value.hasSpf === null || typeof value.hasSpf === 'boolean')
630
+ && (value.hasDmarc === undefined || value.hasDmarc === null || typeof value.hasDmarc === 'boolean')
631
+ && validOptionalStringArray(value.mxHosts, MAX_LOOKUP_DNS_RECORDS_PER_TYPE, 253);
632
+ }
633
+ function validLookupDomainIdentity(value) {
634
+ if (value.type !== 'domain')
635
+ return true;
636
+ const availability = record(value.availability);
637
+ const queryDomain = canonicalRegistrableDomain(value.query);
638
+ if (!queryDomain)
639
+ return false;
640
+ if (availability.domain !== undefined && availability.domain !== null
641
+ && (canonicalRegistrableDomain(availability.domain) !== queryDomain
642
+ || normalizedDomain(availability.domain) !== queryDomain))
643
+ return false;
644
+ if (!validLookupObservationScope(availability, {
645
+ inputHostname: normalizedDomain(value.inputHostname ?? value.query), registrableDomain: queryDomain,
646
+ }))
647
+ return false;
648
+ if (value.inputHostname !== undefined
649
+ && canonicalRegistrableDomain(value.inputHostname) !== queryDomain)
650
+ return false;
651
+ if (value.registrableDomain !== undefined
652
+ && normalizedDomain(value.registrableDomain) !== queryDomain)
653
+ return false;
654
+ if (value.isSubdomain !== undefined) {
655
+ const inputHostname = normalizedDomain(value.inputHostname ?? value.query);
656
+ if (!inputHostname || value.isSubdomain !== (inputHostname !== queryDomain))
657
+ return false;
658
+ }
659
+ return true;
660
+ }
661
+ function optionalTlsNameWithin(value) {
662
+ if (value === undefined || value === null)
663
+ return true;
664
+ if (!isJsonObject(value))
665
+ return false;
666
+ return optionalStringArrayWithin(value.commonNames, MAX_LOOKUP_TLS_NAME_VALUES)
667
+ && (!Array.isArray(value.commonNames)
668
+ || value.commonNames.every((item) => validBoundedString(item, 256)))
669
+ && optionalStringArrayWithin(value.organizations, MAX_LOOKUP_TLS_NAME_VALUES)
670
+ && (!Array.isArray(value.organizations)
671
+ || value.organizations.every((item) => validBoundedString(item, 256)));
672
+ }
673
+ function validNormalizedNetworkEvidence(value) {
674
+ const availability = value.availability;
675
+ const dns = availability.dns;
676
+ if (dns !== undefined) {
677
+ if (!validObservationFields(dns))
678
+ return false;
679
+ if (dns.records !== undefined) {
680
+ if (!isJsonObject(dns.records))
681
+ return false;
682
+ for (const [key, maximumLength] of [
683
+ ['a', 64], ['aaaa', 64], ['cname', 253], ['ns', 253], ['spf', 1_024], ['dmarc', 1_024],
684
+ ]) {
685
+ if (!optionalStringArrayWithin(dns.records[key], MAX_LOOKUP_DNS_RECORDS_PER_TYPE)
686
+ || Array.isArray(dns.records[key])
687
+ && !dns.records[key].every((item) => validBoundedString(item, maximumLength)))
688
+ return false;
689
+ }
690
+ if (dns.records.mx !== undefined && (!Array.isArray(dns.records.mx)
691
+ || dns.records.mx.length > MAX_LOOKUP_DNS_RECORDS_PER_TYPE
692
+ || !dns.records.mx.every(validDnsMxRecord)))
693
+ return false;
694
+ if (dns.records.caa !== undefined && (!Array.isArray(dns.records.caa)
695
+ || dns.records.caa.length > MAX_LOOKUP_DNS_RECORDS_PER_TYPE
696
+ || !dns.records.caa.every(validDnsCaaRecord)))
697
+ return false;
698
+ if (dns.records.soa !== undefined && (!Array.isArray(dns.records.soa)
699
+ || dns.records.soa.length > 1
700
+ || !dns.records.soa.every(validDnsSoaRecord)))
701
+ return false;
702
+ if (dns.records.https !== undefined && (!Array.isArray(dns.records.https)
703
+ || dns.records.https.length > MAX_LOOKUP_DNS_RECORDS_PER_TYPE
704
+ || !dns.records.https.every(validDnsHttpsRecord)))
705
+ return false;
706
+ }
707
+ }
708
+ const reverseDns = value.reverseDns;
709
+ if (reverseDns !== undefined) {
710
+ if (!validObservationFields(reverseDns)
711
+ || reverseDns.records !== undefined
712
+ && (!isJsonObject(reverseDns.records)
713
+ || !optionalStringArrayWithin(reverseDns.records.ptr, MAX_LOOKUP_REVERSE_DNS_PTR_RECORDS)
714
+ || Array.isArray(reverseDns.records.ptr)
715
+ && !reverseDns.records.ptr.every((item) => validBoundedString(item, 253))))
716
+ return false;
717
+ }
718
+ const tls = availability.tls;
719
+ if (tls !== undefined) {
720
+ if (!validObservationFields(tls)
721
+ || !optionalRecordArrayWithin(tls.findings, MAX_LOOKUP_TLS_FINDINGS)
722
+ || Array.isArray(tls.findings) && !tls.findings.every(validTlsFinding)
723
+ || !optionalRecordArrayWithin(tls.chain, MAX_LOOKUP_TLS_CHAIN_CERTIFICATES)
724
+ || Array.isArray(tls.chain) && !tls.chain.every(validTlsChainCertificate))
725
+ return false;
726
+ const certificate = tls.certificate;
727
+ if (certificate !== undefined && certificate !== null) {
728
+ if (!isJsonObject(certificate)
729
+ || !optionalTlsNameWithin(certificate.subject)
730
+ || !optionalTlsNameWithin(certificate.issuer))
731
+ return false;
732
+ const altNames = certificate.subjectAltNames;
733
+ if (altNames !== undefined && altNames !== null) {
734
+ if (!isJsonObject(altNames)
735
+ || !optionalStringArrayWithin(altNames.dnsNames, MAX_LOOKUP_TLS_ALT_NAMES)
736
+ || Array.isArray(altNames.dnsNames)
737
+ && !altNames.dnsNames.every((item) => validBoundedString(item, 253))
738
+ || !optionalStringArrayWithin(altNames.ipAddresses, MAX_LOOKUP_TLS_ALT_NAMES)
739
+ || Array.isArray(altNames.ipAddresses)
740
+ && !altNames.ipAddresses.every((item) => validBoundedString(item, 64)))
741
+ return false;
742
+ const totalAltNames = (Array.isArray(altNames.dnsNames) ? altNames.dnsNames.length : 0)
743
+ + (Array.isArray(altNames.ipAddresses) ? altNames.ipAddresses.length : 0);
744
+ if (totalAltNames > MAX_LOOKUP_TLS_ALT_NAMES)
745
+ return false;
746
+ }
747
+ const extensionProfile = certificate.extensionProfile;
748
+ if (extensionProfile !== undefined && extensionProfile !== null) {
749
+ if (!isJsonObject(extensionProfile))
750
+ return false;
751
+ const certificatePolicies = extensionProfile.certificatePolicies;
752
+ if (certificatePolicies !== undefined && certificatePolicies !== null
753
+ && (!isJsonObject(certificatePolicies)
754
+ || !optionalStringArrayWithin(certificatePolicies.oids, MAX_LOOKUP_TLS_CERTIFICATE_POLICIES)
755
+ || Array.isArray(certificatePolicies.oids)
756
+ && !certificatePolicies.oids.every((item) => validBoundedString(item, 128))))
757
+ return false;
758
+ }
759
+ }
760
+ for (const child of [tls.authorization, tls.hostname]) {
761
+ if (child !== undefined && child !== null && (!isJsonObject(child)
762
+ || !validOptionalNullableText(child.error, 240)))
763
+ return false;
764
+ }
765
+ }
766
+ const securityPosture = availability.securityPosture;
767
+ if (securityPosture !== undefined && securityPosture !== null) {
768
+ if (!validObservationFields(securityPosture)
769
+ || !optionalRecordArrayWithin(securityPosture.findings, MAX_SECURITY_POSTURE_FINDINGS)
770
+ || Array.isArray(securityPosture.findings)
771
+ && !securityPosture.findings.every(validSecurityPostureFinding))
772
+ return false;
773
+ }
774
+ return true;
775
+ }
776
+ function parseLookupHttpResponse(value) {
777
+ try {
778
+ assertBoundedJsonStructure(value, 'Lookup response', {
779
+ maximumContainerItems: MAX_LOOKUP_RESPONSE_CONTAINER_ITEMS,
780
+ });
781
+ }
782
+ catch {
783
+ return invalidLookupResponse();
784
+ }
785
+ if (!isJsonObject(value) || Object.keys(value).length > MAX_LOOKUP_RESPONSE_TOP_LEVEL_KEYS) {
786
+ return invalidLookupResponse();
787
+ }
788
+ if (typeof value.query !== 'string'
789
+ || !value.query.trim()
790
+ || value.query.length > MAX_LOOKUP_RESPONSE_QUERY_LENGTH
791
+ || CONTROL_CHAR_RE.test(value.query)
792
+ || typeof value.type !== 'string'
793
+ || !QUERY_TYPES.has(value.type)
794
+ || !isJsonObject(value.rdap)
795
+ || !isJsonObject(value.whois)
796
+ || !isJsonObject(value.availability)
797
+ || !isJsonObject(value.diagnostics)
798
+ || !optionalBoundedText(value.inputHostname, MAX_LOOKUP_RESPONSE_HOST_LENGTH)
799
+ || !optionalBoundedText(value.registrableDomain, MAX_LOOKUP_RESPONSE_HOST_LENGTH)
800
+ || (value.isSubdomain !== undefined && typeof value.isSubdomain !== 'boolean')) {
801
+ return invalidLookupResponse();
802
+ }
803
+ for (const key of ['reverseDns', 'networkContext', 'securityTxt', 'sslbl', 'threatIntelligence', 'registryInsights', 'registrarStanding']) {
804
+ const section = value[key];
805
+ if (section !== undefined && !isJsonObject(section))
806
+ return invalidLookupResponse();
807
+ }
808
+ const lookupResponse = sanitizeLookupChildProfiles(value);
809
+ if (lookupResponse.registrarStanding !== undefined
810
+ && (!validRegistrarStanding(lookupResponse.registrarStanding)
811
+ || lookupResponse.registrarStanding.ianaId !== resolveRegistrarIanaId(lookupResponse.rdap.parsed, lookupResponse.whois.parsed)))
812
+ return invalidLookupResponse();
813
+ if (!validAvailabilityScalars(lookupResponse.availability)
814
+ || !validLookupDomainIdentity(lookupResponse)
815
+ || !validRegistrationEvidence(lookupResponse))
816
+ return invalidLookupResponse();
817
+ if (lookupResponse.availability.http !== undefined && !validNormalizedHttpEvidence(lookupResponse.availability.http)) {
818
+ return invalidLookupResponse();
819
+ }
820
+ for (const section of [value.reverseDns, value.networkContext, value.securityTxt]) {
821
+ if (section !== undefined && !validObservationFields(section))
822
+ return invalidLookupResponse();
823
+ }
824
+ if (!validNormalizedNetworkEvidence(lookupResponse)
825
+ || !validPageEvidence(lookupResponse))
826
+ return invalidLookupResponse();
827
+ return { ok: true, value: lookupResponse };
828
+ }
829
+ function parseCompactLookupHttpResponse(value, expectedDomain) {
830
+ try {
831
+ assertBoundedJsonStructure(value, 'Compact Lookup response');
832
+ }
833
+ catch {
834
+ return invalidCompactLookupResponse();
835
+ }
836
+ if (!isJsonObject(value) || Object.keys(value).length > MAX_COMPACT_LOOKUP_RESPONSE_TOP_LEVEL_KEYS) {
837
+ return invalidCompactLookupResponse();
838
+ }
839
+ const availability = value.availability;
840
+ const diagnostics = value.diagnostics;
841
+ const expectedHostname = normalizedDomain(expectedDomain);
842
+ const expectedRegistrableDomain = canonicalRegistrableDomain(expectedDomain);
843
+ const compactPageIdentity = isJsonObject(availability) && isJsonObject(availability.pageIdentity)
844
+ ? availability.pageIdentity
845
+ : null;
846
+ const compactHttpResponse = isJsonObject(availability) && isJsonObject(availability.http)
847
+ && isJsonObject(availability.http.response)
848
+ ? availability.http.response
849
+ : null;
850
+ if (!isJsonObject(availability)
851
+ || !expectedHostname
852
+ || !expectedRegistrableDomain
853
+ || Object.keys(availability).length > MAX_COMPACT_LOOKUP_AVAILABILITY_KEYS
854
+ || availability.observationHostname !== undefined
855
+ || availability.webObservationMode !== undefined
856
+ || availability.applicable !== true
857
+ || normalizedDomain(availability.domain) !== expectedRegistrableDomain
858
+ || typeof availability.state !== 'string'
859
+ || !COMPACT_AVAILABILITY_STATES.has(availability.state)
860
+ || typeof availability.confidence !== 'string'
861
+ || !COMPACT_CONFIDENCE_LEVELS.has(availability.confidence)
862
+ || (availability.deepScanComplete !== undefined && typeof availability.deepScanComplete !== 'boolean')
863
+ || (availability.bulkComparison !== undefined
864
+ && !validCompactBulkComparison(availability.bulkComparison))
865
+ || compactPageIdentity !== null && Object.hasOwn(compactPageIdentity, 'publicationMetadata')
866
+ || compactHttpResponse !== null && Object.hasOwn(compactHttpResponse, 'deliveryMetadata')
867
+ || (value.query !== undefined && normalizedDomain(value.query) !== expectedHostname)
868
+ || (value.type !== undefined && value.type !== 'domain')
869
+ || (value.inputHostname !== undefined && normalizedDomain(value.inputHostname) !== expectedHostname)
870
+ || (value.registrableDomain !== undefined
871
+ && normalizedDomain(value.registrableDomain) !== expectedRegistrableDomain)
872
+ || (value.isSubdomain !== undefined
873
+ && (typeof value.isSubdomain !== 'boolean'
874
+ || value.isSubdomain !== (expectedHostname !== expectedRegistrableDomain)))
875
+ || !isJsonObject(diagnostics)
876
+ || Object.keys(diagnostics).length > MAX_COMPACT_LOOKUP_DIAGNOSTIC_KEYS
877
+ || diagnostics.version !== 7
878
+ || !isJsonObject(diagnostics.rdap)
879
+ || !isJsonObject(diagnostics.whois)
880
+ || !isJsonObject(diagnostics.availability)
881
+ || typeof diagnostics.availability.status !== 'string'
882
+ || !COMPACT_AVAILABILITY_DIAGNOSTIC_STATES.has(diagnostics.availability.status)) {
883
+ return invalidCompactLookupResponse();
884
+ }
885
+ return { ok: true, value: value };
886
+ }
887
+ function lookupHttpErrorMessage(value, status) {
888
+ const source = record(value);
889
+ const message = typeof source.error === 'string'
890
+ ? source.error
891
+ .replace(/[\u0000-\u001f\u007f-\u009f]|\p{Default_Ignorable_Code_Point}/gu, ' ')
892
+ .replace(/\s+/gu, ' ')
893
+ .trim()
894
+ .slice(0, MAX_LOOKUP_RESPONSE_ERROR_LENGTH)
895
+ : '';
896
+ return message || `Lookup failed (${status})`;
897
+ }
898
+ function isBoundedTimingMs(value, totalMs) {
899
+ return Number.isInteger(value)
900
+ && Number(value) >= 0
901
+ && Number(value) <= totalMs
902
+ && Number(value) <= MAX_LOOKUP_TIMING_MS;
903
+ }
904
+ function normalizeLookupTiming(value) {
905
+ if (!isJsonObject(value)
906
+ || value.version !== 1
907
+ || !Number.isInteger(value.totalMs)
908
+ || Number(value.totalMs) < 0
909
+ || Number(value.totalMs) > MAX_LOOKUP_TIMING_MS
910
+ || !Array.isArray(value.sources)
911
+ || value.sources.length > MAX_LOOKUP_TIMING_SOURCES) {
912
+ return null;
913
+ }
914
+ const totalMs = Number(value.totalMs);
915
+ const seen = new Set();
916
+ const sources = [];
917
+ for (const candidate of value.sources) {
918
+ if (!isJsonObject(candidate)
919
+ || typeof candidate.source !== 'string'
920
+ || !LOOKUP_TIMING_SOURCES.has(candidate.source)
921
+ || seen.has(candidate.source)
922
+ || typeof candidate.outcome !== 'string'
923
+ || !LOOKUP_TIMING_OUTCOMES.has(candidate.outcome)
924
+ || !isBoundedTimingMs(candidate.durationMs, totalMs)
925
+ || !isBoundedTimingMs(candidate.completedAfterMs, totalMs)
926
+ || Number(candidate.durationMs) > Number(candidate.completedAfterMs)) {
927
+ return null;
928
+ }
929
+ const source = candidate.source;
930
+ seen.add(source);
931
+ sources.push({
932
+ source,
933
+ outcome: candidate.outcome,
934
+ durationMs: Number(candidate.durationMs),
935
+ completedAfterMs: Number(candidate.completedAfterMs),
936
+ });
937
+ }
938
+ return {
939
+ version: 1,
940
+ totalMs,
941
+ sources,
942
+ };
943
+ }
944
+ function createLookupHttpResponse(query, classified, result) {
945
+ return {
946
+ ...result,
947
+ query,
948
+ type: classified.type,
949
+ inputHostname: classified.inputHostname,
950
+ registrableDomain: classified.registrableDomain,
951
+ isSubdomain: classified.isSubdomain,
952
+ };
953
+ }
954
+ function createLookupViewModel(response) {
955
+ const availability = record(response?.availability);
956
+ const rdap = record(response?.rdap);
957
+ const registrarRdap = record(rdap.registrarRdap);
958
+ const whois = record(response?.whois);
959
+ const diagnostics = record(response?.diagnostics);
960
+ const reverseDns = record(response?.reverseDns);
961
+ const observedNetworkContext = record(response?.networkContext);
962
+ const registryInsights = record(response?.registryInsights);
963
+ const registrarStanding = record(response?.registrarStanding);
964
+ const securityTxt = record(response?.securityTxt);
965
+ const sslbl = record(response?.sslbl);
966
+ const rawThreatIntelligence = record(response?.threatIntelligence);
967
+ const expectedThreatDomain = response?.type === 'domain'
968
+ ? canonicalRegistrableDomain(response.registrableDomain)
969
+ ?? canonicalRegistrableDomain(availability.domain)
970
+ : null;
971
+ const providers = expectedThreatDomain
972
+ && rawThreatIntelligence.version === THREAT_INTELLIGENCE_ENVELOPE_VERSION
973
+ && Array.isArray(rawThreatIntelligence.providers)
974
+ ? projectThreatProviders(rawThreatIntelligence.providers, expectedThreatDomain)
975
+ : [];
976
+ const threatIntelligence = providers.length
977
+ ? { version: THREAT_INTELLIGENCE_ENVELOPE_VERSION, providers }
978
+ : {};
979
+ const dnsEvidence = record(availability.dns);
980
+ const httpEvidence = record(availability.http);
981
+ const httpResponse = record(httpEvidence.response);
982
+ const tlsEvidence = record(availability.tls);
983
+ const tlsCertificate = record(tlsEvidence.certificate);
984
+ const pageIdentity = record(availability.pageIdentity);
985
+ const pageOpenGraph = record(pageIdentity.openGraph);
986
+ const pageResources = record(pageIdentity.resources);
987
+ const securityPosture = record(availability.securityPosture);
988
+ return {
989
+ availability,
990
+ rdap,
991
+ registrarRdap,
992
+ registrarRdapParsed: record(registrarRdap.parsed),
993
+ whois,
994
+ rdapParsed: record(rdap.parsed),
995
+ whoisParsed: record(whois.parsed),
996
+ diagnostics,
997
+ timing: normalizeLookupTiming(diagnostics.timing),
998
+ registryAccess: record(diagnostics.registryAccess),
999
+ registryInsights,
1000
+ registrarStanding,
1001
+ reverseDns,
1002
+ reverseDnsRecords: record(reverseDns.records),
1003
+ observedNetworkContext,
1004
+ observedNetworkEndpoint: record(observedNetworkContext.endpoint),
1005
+ observedNetworkRdap: record(observedNetworkContext.rdap),
1006
+ observedNetwork: record(observedNetworkContext.network),
1007
+ securityTxt,
1008
+ sslbl,
1009
+ threatIntelligence,
1010
+ threatIntelligenceProviders: providers,
1011
+ dnsEvidence,
1012
+ dnsRecords: record(dnsEvidence.records),
1013
+ httpEvidence,
1014
+ httpResponse,
1015
+ httpSecurityHeaders: record(httpResponse.securityHeaders),
1016
+ httpDeliveryMetadata: record(httpResponse.deliveryMetadata),
1017
+ tlsEvidence,
1018
+ tlsCertificate,
1019
+ tlsSubject: record(tlsCertificate.subject),
1020
+ tlsIssuer: record(tlsCertificate.issuer),
1021
+ tlsAltNames: record(tlsCertificate.subjectAltNames),
1022
+ tlsPublicKey: record(tlsCertificate.publicKey),
1023
+ tlsCipher: record(tlsEvidence.cipher),
1024
+ tlsAuthorization: record(tlsEvidence.authorization),
1025
+ tlsHostname: record(tlsEvidence.hostname),
1026
+ tlsValidity: record(tlsEvidence.validity),
1027
+ tlsDiagnostics: record(tlsEvidence.diagnostics),
1028
+ pageIdentity,
1029
+ pagePublicationMetadata: record(pageIdentity.publicationMetadata),
1030
+ pageCanonical: record(pageIdentity.canonical),
1031
+ pageMetaRefresh: record(pageIdentity.metaRefresh),
1032
+ pageOpenGraph,
1033
+ pageOpenGraphUrl: record(pageOpenGraph.url),
1034
+ pageForms: record(pageIdentity.forms),
1035
+ pageResources,
1036
+ pageResourceTypes: record(pageResources.byType),
1037
+ pageDownloads: record(pageIdentity.downloads),
1038
+ pageFingerprints: record(pageIdentity.fingerprints),
1039
+ credentialSurfaceProfile: record(availability.credentialSurfaceProfile),
1040
+ structuredDataIdentity: record(availability.structuredDataIdentity),
1041
+ technologyProfile: record(availability.technologyProfile),
1042
+ pageRoleProfile: record(availability.pageRoleProfile),
1043
+ clientBehaviorProfile: record(availability.clientBehaviorProfile),
1044
+ securityPosture,
1045
+ securityPostureSummary: record(securityPosture.summary),
1046
+ };
1047
+ }
1048
+ export { INVALID_COMPACT_LOOKUP_RESPONSE, INVALID_COMPACT_LOOKUP_RESPONSE_MESSAGE, INVALID_LOOKUP_RESPONSE, INVALID_LOOKUP_RESPONSE_MESSAGE, MAX_COMPACT_LOOKUP_AVAILABILITY_KEYS, MAX_COMPACT_LOOKUP_DIAGNOSTIC_KEYS, MAX_COMPACT_LOOKUP_RESPONSE_TOP_LEVEL_KEYS, MAX_LOOKUP_RESPONSE_ERROR_LENGTH, MAX_LOOKUP_RESPONSE_CONTAINER_ITEMS, MAX_LOOKUP_RESPONSE_HOST_LENGTH, MAX_LOOKUP_RESPONSE_QUERY_LENGTH, MAX_LOOKUP_RESPONSE_TOP_LEVEL_KEYS, MAX_LOOKUP_DNS_RECORDS_PER_TYPE, MAX_LOOKUP_REVERSE_DNS_PTR_RECORDS, MAX_LOOKUP_TLS_ALT_NAMES, MAX_LOOKUP_TLS_CERTIFICATE_POLICIES, MAX_LOOKUP_TLS_CHAIN_CERTIFICATES, MAX_LOOKUP_TLS_FINDINGS, MAX_LOOKUP_TLS_NAME_VALUES, MAX_LOOKUP_TIMING_MS, MAX_LOOKUP_TIMING_SOURCES, MAX_THREAT_INTELLIGENCE_PROVIDERS, MAX_THREAT_INTELLIGENCE_FINDINGS, MAX_THREAT_INTELLIGENCE_LIMITATIONS, validNormalizedHttpEvidence, createLookupHttpResponse, createLookupViewModel, isJsonObject, lookupHttpErrorMessage, normalizeLookupTiming, parseCompactLookupHttpResponse, parseLookupHttpResponse, record as lookupRecord, };