@slicedearth/whoisleuth-cli 1.45.0 → 1.47.4

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 (133) hide show
  1. package/DISCLOSURE +7 -3
  2. package/NOTICE +5 -4
  3. package/README.md +59 -6
  4. package/bin/whoisleuth.mjs +5 -3
  5. package/cli/arguments.mjs +256 -9
  6. package/cli/artifact-structure.mjs +1833 -0
  7. package/cli/artifact-verify.mjs +242 -49
  8. package/cli/bounded-json.mjs +1 -0
  9. package/cli/bulk-checkpoint.mjs +2 -3
  10. package/cli/bulk-command-runner.mjs +2 -5
  11. package/cli/case-pack.mjs +819 -34
  12. package/cli/command-reference.mjs +48 -24
  13. package/cli/completion.mjs +16 -8
  14. package/cli/ct-event-intake.mjs +32 -2
  15. package/cli/discovery-scan-command-runner.mjs +4 -5
  16. package/cli/discovery-workflow.mjs +2 -3
  17. package/cli/doctor.mjs +2 -2
  18. package/cli/domain-control-monitor.mjs +21 -15
  19. package/cli/domain-control-observations.mjs +25 -2
  20. package/cli/evidence-command-runner.mjs +17 -11
  21. package/cli/evidence-signing.mjs +73 -45
  22. package/cli/export-evidence.mjs +11 -4
  23. package/cli/formatters/html.mjs +3 -3
  24. package/cli/formatters/terminal.mjs +3 -0
  25. package/cli/input.mjs +57 -0
  26. package/cli/interchange-report.mjs +226 -0
  27. package/cli/investigation-manifest.mjs +16 -17
  28. package/cli/investigation-run.mjs +71 -23
  29. package/cli/local-mmdb-review.mjs +45 -14
  30. package/cli/lookup-command-runner.mjs +2 -2
  31. package/cli/lookup-diff.mjs +9 -0
  32. package/cli/network-command-runner.mjs +78 -0
  33. package/cli/offline-evidence-review.mjs +28 -8
  34. package/cli/page-compare.mjs +8 -5
  35. package/cli/registry-cohort.mjs +385 -61
  36. package/cli/registry-support.mjs +2 -1
  37. package/cli/retained-artifact-diff.mjs +376 -0
  38. package/cli/risk-calibration.mjs +7 -5
  39. package/cli/runner.mjs +147 -185
  40. package/cli/saved-lookup.mjs +26 -3
  41. package/cli/sharing-review.mjs +12 -6
  42. package/docs/cli-reference.md +444 -70
  43. package/docs/cli.md +24 -5
  44. package/frontend/src/lib/analysis/acquisition-decision-packet.js +4 -4
  45. package/frontend/src/lib/analysis/artifact-integrity.js +42 -0
  46. package/frontend/src/lib/analysis/brand-profile-model.js +29 -5
  47. package/frontend/src/lib/analysis/bulk-domain-comparison.js +25 -5
  48. package/frontend/src/lib/analysis/bulk-mail-exposure.js +66 -15
  49. package/frontend/src/lib/analysis/bulk-retry-plan.js +1 -1
  50. package/frontend/src/lib/analysis/bulk-review-export.js +7 -6
  51. package/frontend/src/lib/analysis/bulk-review-model.js +3 -2
  52. package/frontend/src/lib/analysis/bulk-session-model.js +192 -26
  53. package/frontend/src/lib/analysis/bulk-sort.js +4 -0
  54. package/frontend/src/lib/analysis/case-brand-profile-references.js +85 -0
  55. package/frontend/src/lib/analysis/case-evidence-model.js +8 -0
  56. package/frontend/src/lib/analysis/case-investigation-branch-model.js +134 -0
  57. package/frontend/src/lib/analysis/case-migration-model.js +83 -31
  58. package/frontend/src/lib/analysis/case-record-contracts.js +4 -2
  59. package/frontend/src/lib/analysis/case-record-model.js +2 -0
  60. package/frontend/src/lib/analysis/case-record-operations.js +42 -12
  61. package/frontend/src/lib/analysis/case-report.js +39 -6
  62. package/frontend/src/lib/analysis/case-response-model.js +66 -7
  63. package/frontend/src/lib/analysis/case-response-packet.js +15 -5
  64. package/frontend/src/lib/analysis/comparison-ledger-bulk.js +366 -0
  65. package/frontend/src/lib/analysis/comparison-ledger-contract.js +241 -0
  66. package/frontend/src/lib/analysis/comparison-ledger-json.js +79 -0
  67. package/frontend/src/lib/analysis/comparison-ledger-serialization.js +51 -0
  68. package/frontend/src/lib/analysis/domain-control-manifest-core.js +145 -0
  69. package/frontend/src/lib/analysis/domain-control-records.js +88 -0
  70. package/frontend/src/lib/analysis/external-findings-import.js +70 -6
  71. package/frontend/src/lib/analysis/investigation-capsule.js +47 -13
  72. package/frontend/src/lib/analysis/investigation-guide.js +52 -10
  73. package/frontend/src/lib/analysis/investigation-template-model.js +9 -6
  74. package/frontend/src/lib/analysis/lookup-claim-passport.js +236 -0
  75. package/frontend/src/lib/analysis/lookup-claim-readiness.js +280 -0
  76. package/frontend/src/lib/analysis/lookup-decision-support.js +61 -6
  77. package/frontend/src/lib/analysis/lookup-presentation.js +62 -0
  78. package/frontend/src/lib/analysis/opaque-reference-id.js +9 -0
  79. package/frontend/src/lib/analysis/utils.js +26 -3
  80. package/frontend/src/lib/analysis/visualization-matrix.js +71 -28
  81. package/frontend/src/lib/analysis/visualization-models.js +63 -94
  82. package/frontend/src/lib/analysis/visualization-time-series.js +53 -12
  83. package/frontend/src/lib/analysis/website-snapshot-model.js +6 -0
  84. package/frontend/src/lib/analysis/workspace-archive.js +104 -14
  85. package/lib/application-version.mjs +3 -0
  86. package/lib/availability.mjs +14 -12
  87. package/lib/bounded-file.mjs +13 -0
  88. package/lib/bounded-json-response.mjs +17 -4
  89. package/lib/bounded-json.mjs +249 -0
  90. package/lib/certificate-extension-profile.mjs +2 -1
  91. package/lib/cryptographic-assurance.mjs +155 -0
  92. package/lib/ct-search.mjs +87 -47
  93. package/lib/dns-intelligence.mjs +3 -2
  94. package/lib/dns-resolver-selection.mjs +6 -4
  95. package/lib/dnssec-chain-validation.mjs +1053 -0
  96. package/lib/dnssec-evidence-validation.mjs +10 -3
  97. package/lib/domain-change-packet.mjs +7 -5
  98. package/lib/domain-control-manifest.mjs +17 -129
  99. package/lib/domain-posture.mjs +7 -4
  100. package/lib/evidence-export.mjs +751 -78
  101. package/lib/evidence-report-markdown.mjs +3 -0
  102. package/lib/evidence-report.mjs +5 -0
  103. package/lib/favicon.mjs +8 -5
  104. package/lib/http-evidence-bounds.mjs +3 -0
  105. package/lib/http-intelligence.mjs +2 -5
  106. package/lib/interchange-fidelity-registry.mjs +122 -0
  107. package/lib/local-geoip-evidence.mjs +2 -1
  108. package/lib/lookup-network-evidence-bounds.mjs +9 -0
  109. package/lib/lookup-response-contract.mjs +691 -3
  110. package/lib/lookup.mjs +2 -2
  111. package/lib/observation.mjs +7 -6
  112. package/lib/outbound-identity.mjs +2 -3
  113. package/lib/perceptual-hash.mjs +12 -4
  114. package/lib/portable-generator.mjs +21 -0
  115. package/lib/provider-policy-admission.mjs +9 -4
  116. package/lib/rdap-normalization.mjs +18 -5
  117. package/lib/rdap-registrar.mjs +5 -1
  118. package/lib/registry-capabilities.mjs +3 -0
  119. package/lib/registry-capability-catalogue.mjs +12 -2
  120. package/lib/registry-comparison.mjs +28 -11
  121. package/lib/risk-calibration-summary.mjs +338 -0
  122. package/lib/rpki-evidence.mjs +9 -8
  123. package/lib/safe-fetch.mjs +59 -10
  124. package/lib/security-txt.mjs +26 -3
  125. package/lib/service-binding-dns.mjs +6 -1
  126. package/lib/smtp-transport-review.mjs +784 -0
  127. package/lib/sslbl-certificates.generated.mjs +136 -134
  128. package/lib/threat-intelligence-runtime.mjs +3 -11
  129. package/lib/threat-intelligence-types.mjs +18 -1
  130. package/lib/tls-intelligence.mjs +11 -5
  131. package/lib/tlsa-evidence.mjs +37 -7
  132. package/package.json +1 -1
  133. package/third-party-notices.txt +95 -5817
@@ -4,6 +4,7 @@
4
4
  // must declare exact input exposure, reviewed terms, and bounded request and
5
5
  // output budgets before producing separately attributed normalized evidence.
6
6
  import { createObservation } from "./observation.mjs";
7
+ import { THREAT_INTELLIGENCE_CATEGORIES, THREAT_INTELLIGENCE_RESULT_STATES, } from "./threat-intelligence-types.mjs";
7
8
  import { assertCuratedConnectorDefinition, assertThreatIntelligenceProvider, } from "./threat-intelligence-definition-registry.mjs";
8
9
  import { boundedHttpsUrl, boundedString, isRecord, isoTimestamp, strictBoundedString, } from "./bounded-contract-normalizers.mjs";
9
10
  import { CURATED_CONNECTOR_ENTITY_TYPES, MAX_THREAT_INTELLIGENCE_URL_LENGTH, normalizeCuratedConnectorTarget, normalizeThreatIntelligenceTarget, } from "./threat-intelligence-targets.mjs";
@@ -11,16 +12,7 @@ const THREAT_INTELLIGENCE_CONTRACT_VERSION = 1;
11
12
  const THREAT_INTELLIGENCE_SCHEMA = 'whoisleuth.threat-intelligence-result';
12
13
  const CURATED_CONNECTOR_CONTRACT_VERSION = 1;
13
14
  const CURATED_CONNECTOR_RESULT_SCHEMA = 'whoisleuth.curated-connector-result';
14
- const RESULT_STATES = new Set([
15
- 'success',
16
- 'partial',
17
- 'not_found',
18
- 'unsupported',
19
- 'skipped',
20
- 'rate_limited',
21
- 'unavailable',
22
- 'error',
23
- ]);
15
+ const RESULT_STATES = new Set(THREAT_INTELLIGENCE_RESULT_STATES);
24
16
  const TERMINAL_STATES_WITHOUT_FINDINGS = new Set([
25
17
  'not_found',
26
18
  'unsupported',
@@ -29,7 +21,7 @@ const TERMINAL_STATES_WITHOUT_FINDINGS = new Set([
29
21
  'unavailable',
30
22
  'error',
31
23
  ]);
32
- const CATEGORIES = new Set(['phishing', 'malware', 'spam', 'suspicious', 'abuse', 'unknown']);
24
+ const CATEGORIES = new Set(THREAT_INTELLIGENCE_CATEGORIES);
33
25
  const SEVERITIES = new Set(['critical', 'high', 'medium', 'low', 'unknown']);
34
26
  const CONFIDENCES = new Set(['high', 'medium', 'low', 'unknown']);
35
27
  const CONNECTOR_RELATIONSHIP_TYPES = new Set([
@@ -1,3 +1,20 @@
1
1
  // Provider-neutral types shared by threat-intelligence and curated connector
2
2
  // manifests, fixture harnesses, normalizers, and result builders.
3
- export {};
3
+ export const THREAT_INTELLIGENCE_CATEGORIES = Object.freeze([
4
+ 'phishing',
5
+ 'malware',
6
+ 'spam',
7
+ 'suspicious',
8
+ 'abuse',
9
+ 'unknown',
10
+ ]);
11
+ export const THREAT_INTELLIGENCE_RESULT_STATES = Object.freeze([
12
+ 'success',
13
+ 'partial',
14
+ 'not_found',
15
+ 'unsupported',
16
+ 'skipped',
17
+ 'rate_limited',
18
+ 'unavailable',
19
+ 'error',
20
+ ]);
@@ -11,18 +11,19 @@ import * as net from 'node:net';
11
11
  import * as tls from 'node:tls';
12
12
  import { domainToASCII } from 'node:url';
13
13
  import { createObservation } from "./observation.mjs";
14
+ import { MAX_LOOKUP_TLS_ALT_NAMES, MAX_LOOKUP_TLS_CHAIN_CERTIFICATES, MAX_LOOKUP_TLS_FINDINGS, MAX_LOOKUP_TLS_NAME_VALUES, } from "./lookup-network-evidence-bounds.mjs";
14
15
  import { isPrivateAddress, resolvePublicAddresses } from "./safe-fetch.mjs";
15
16
  import { parseCertificateExtensionProfile, } from "./certificate-extension-profile.mjs";
16
17
  const TLS_PROFILE_VERSION = 3;
17
18
  const TLS_PORT = 443;
18
19
  const TLS_TIMEOUT_MS = 5000;
19
20
  const MAX_RESOLVED_ADDRESSES = 64;
20
- const MAX_CHAIN_CERTIFICATES = 8;
21
- const MAX_ALT_NAMES = 50;
21
+ const MAX_CHAIN_CERTIFICATES = MAX_LOOKUP_TLS_CHAIN_CERTIFICATES;
22
+ const MAX_ALT_NAMES = MAX_LOOKUP_TLS_ALT_NAMES;
22
23
  const MAX_SAN_ENTRIES = 100;
23
24
  const MAX_EXTENDED_KEY_USAGES = 16;
24
25
  const MAX_AIA_LOCATIONS = 32;
25
- const MAX_NAME_VALUES = 4;
26
+ const MAX_NAME_VALUES = MAX_LOOKUP_TLS_NAME_VALUES;
26
27
  const MAX_TEXT_LENGTH = 256;
27
28
  const MAX_ERROR_LENGTH = 240;
28
29
  const MAX_SERIAL_LENGTH = 128;
@@ -577,7 +578,7 @@ function tlsFindings(profile) {
577
578
  findings.push({ id: 'hostname_mismatch', tone: 'warning', label: 'Hostname mismatch', detail: 'The observed leaf certificate did not match the SNI hostname.' });
578
579
  if (profile.certificate?.subjectAltNames?.dnsNames.some((name) => name.startsWith('*.')))
579
580
  findings.push({ id: 'wildcard_certificate', tone: 'neutral', label: 'Wildcard certificate', detail: 'The leaf certificate includes at least one wildcard DNS name. Wildcard use is common and is not inherently suspicious.' });
580
- return findings;
581
+ return findings.slice(0, MAX_LOOKUP_TLS_FINDINGS);
581
582
  }
582
583
  function buildTlsObservation(handshake = {}, options = {}) {
583
584
  const state = tracker();
@@ -590,7 +591,9 @@ function buildTlsObservation(handshake = {}, options = {}) {
590
591
  const authorized = typeof handshake.authorized === 'boolean' ? handshake.authorized : null;
591
592
  const hostnameMatches = typeof handshake.hostnameMatches === 'boolean' ? handshake.hostnameMatches : null;
592
593
  const authorizationError = authorized === false
593
- ? boundedString(handshake.authorizationError, MAX_ERROR_LENGTH, state)
594
+ ? boundedString(handshake.authorizationError instanceof Error
595
+ ? handshake.authorizationError.message
596
+ : handshake.authorizationError, MAX_ERROR_LENGTH, state)
594
597
  : null;
595
598
  const hostnameError = hostnameMatches === false
596
599
  ? boundedString(handshake.hostnameError, MAX_ERROR_LENGTH, state)
@@ -780,6 +783,9 @@ async function collectTlsIntelligence(hostname, options = {}) {
780
783
  port: TLS_PORT,
781
784
  servername: normalizedHostname,
782
785
  rejectUnauthorized: false,
786
+ // Keep runtime CA-path authorization independent from the separately
787
+ // recorded endpoint-identity comparison below.
788
+ checkServerIdentity: () => undefined,
783
789
  ALPNProtocols: ['h2', 'http/1.1'],
784
790
  }, () => {
785
791
  try {
@@ -128,7 +128,15 @@ function analyzeTlsaEvidence(input) {
128
128
  const normalized = raw.slice(0, MAX_TLSA_RECORDS).map(normalizeTlsaRecord);
129
129
  const rejectedCount = normalized.filter((item) => item === null).length + Math.max(0, raw.length - MAX_TLSA_RECORDS);
130
130
  const records = normalized.filter((item) => item !== null);
131
+ const smtpRelayService = service.port === 25 && service.transport === 'tcp';
131
132
  const results = records.map((item) => {
133
+ if (smtpRelayService && (item.usage === 0 || item.usage === 1)) {
134
+ return Object.freeze({
135
+ ...item,
136
+ state: 'unsupported',
137
+ reason: 'PKIX-TA and PKIX-EE certificate usages are not treated as usable TLSA records for SMTP relay on port 25.',
138
+ });
139
+ }
132
140
  const materials = item.usage === 0 || item.usage === 2
133
141
  ? authorityMaterials
134
142
  : leafMaterial ? [leafMaterial] : [];
@@ -147,6 +155,7 @@ function analyzeTlsaEvidence(input) {
147
155
  const hasMatch = results.some((item) => item.state === 'matched');
148
156
  const hasDifferent = results.some((item) => item.state === 'different');
149
157
  const hasUnavailable = results.some((item) => item.state === 'unavailable');
158
+ const hasUnsupported = results.some((item) => item.state === 'unsupported');
150
159
  const limitations = [
151
160
  'This offline comparison does not connect to the target, retrieve DNS, negotiate SMTP STARTTLS, or validate a DNSSEC chain.',
152
161
  'A TLSA match is usable as DANE evidence only when the DNSSEC state was independently validated for the same observation.',
@@ -155,24 +164,45 @@ function analyzeTlsaEvidence(input) {
155
164
  if (dnssecState !== 'validated' && hasMatch) {
156
165
  limitations.push('Certificate material matched, but DNSSEC was not validated, so the result remains partial.');
157
166
  }
158
- const matchedPkixDependent = results.some((item) => item.state === 'matched' && (item.usage === 0 || item.usage === 1));
159
- const matchedDaneOnly = results.some((item) => item.state === 'matched' && (item.usage === 2 || item.usage === 3));
167
+ if (smtpRelayService && hasUnsupported) {
168
+ limitations.push('RFC 7672 leaves SMTP relay treatment of PKIX-TA usage 0 and PKIX-EE usage 1 undefined; this review treats those records as unusable and they cannot complete SMTP DANE assurance.');
169
+ }
170
+ const matchedPkixTa = results.some((item) => item.state === 'matched' && item.usage === 0);
171
+ const matchedPkixEe = results.some((item) => item.state === 'matched' && item.usage === 1);
172
+ const matchedPkixDependent = matchedPkixTa || matchedPkixEe;
173
+ const matchedDaneEe = results.some((item) => item.state === 'matched' && item.usage === 3);
174
+ const hasPkixTaAssociation = results.some((item) => item.usage === 0);
175
+ const hasDaneTaAssociation = results.some((item) => item.usage === 2);
160
176
  if (matchedPkixDependent && pkixValidationState !== 'validated') {
161
177
  limitations.push('A PKIX-dependent association matched, but a validated PKIX path was not supplied, so the result is not complete.');
162
178
  }
163
179
  if (authorityMaterialRejectedCount > 0 || authorityMaterialTruncated) {
164
180
  limitations.push('Authority certificate material was malformed or exceeded the review bound, so an unmatched trust-anchor association remains partial.');
165
181
  }
182
+ if (hasPkixTaAssociation) {
183
+ limitations.push('PKIX-TA usage 0 association bytes were compared, but the supplied authority material was not proven to be part of the independently validated leaf path, so the usage-0 association cannot complete PKIX-TA assurance.');
184
+ }
185
+ if (hasDaneTaAssociation) {
186
+ limitations.push('DANE-TA usage 2 association bytes were compared, but no certificate path from the observed leaf to the supplied trust-anchor material was constructed or validated, so the usage-2 association cannot complete DANE-TA assurance.');
187
+ }
188
+ if (hasUnavailable || rejectedCount > 0 || truncated) {
189
+ limitations.push('Some TLSA associations or required certificate material were unavailable, malformed, or beyond the review bound, so the comparison remains incomplete.');
190
+ }
191
+ const comparisonMaterialComplete = !hasUnavailable
192
+ && rejectedCount === 0
193
+ && !truncated
194
+ && authorityMaterialRejectedCount === 0
195
+ && !authorityMaterialTruncated;
166
196
  const trustedMatch = dnssecState === 'validated'
167
- && (matchedDaneOnly || matchedPkixDependent && pkixValidationState === 'validated');
197
+ && (matchedDaneEe || matchedPkixEe && pkixValidationState === 'validated');
168
198
  const state = results.length === 0
169
199
  ? 'unavailable'
170
- : hasDifferent && !hasMatch && rejectedCount === 0 && !truncated
171
- && authorityMaterialRejectedCount === 0 && !authorityMaterialTruncated
200
+ : dnssecState === 'validated' && hasDifferent && !hasMatch && comparisonMaterialComplete
201
+ && !hasPkixTaAssociation && !hasDaneTaAssociation
172
202
  ? 'different'
173
- : hasMatch && (dnssecState === 'bogus' || matchedPkixDependent && pkixValidationState === 'failed' && !matchedDaneOnly)
203
+ : hasMatch && (dnssecState === 'bogus' || matchedPkixDependent && pkixValidationState === 'failed' && !matchedDaneEe)
174
204
  ? 'untrusted'
175
- : trustedMatch && !hasUnavailable && rejectedCount === 0 && !truncated
205
+ : trustedMatch && comparisonMaterialComplete
176
206
  ? 'matched'
177
207
  : 'partial';
178
208
  return Object.freeze({
package/package.json CHANGED
@@ -33,7 +33,7 @@
33
33
  "bugs": {
34
34
  "url": "https://github.com/slicedearth/whoisleuth/issues"
35
35
  },
36
- "version": "1.45.0",
36
+ "version": "1.47.4",
37
37
  "dependencies": {
38
38
  "@peculiar/x509": "2.0.0",
39
39
  "maxmind": "5.0.7",