@slicedearth/whoisleuth-cli 1.39.1 → 1.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -4
- package/bin/whoisleuth.mjs +31 -9
- package/cli/archive-inspect.mjs +37 -2
- package/cli/arguments.mjs +361 -256
- package/cli/artifact-verify.mjs +35 -1
- package/cli/bulk-checkpoint.mjs +72 -39
- package/cli/bulk-command-runner.mjs +34 -4
- package/cli/bulk.mjs +18 -7
- package/cli/case-pack.mjs +136 -0
- package/cli/ci-report.mjs +73 -0
- package/cli/collection-preflight.mjs +59 -0
- package/cli/command-reference.mjs +395 -0
- package/cli/completion.mjs +67 -13
- package/cli/config-profile.mjs +183 -0
- package/cli/ct-event-intake.mjs +159 -0
- package/cli/discovery-observation-snapshot.mjs +8 -14
- package/cli/discovery-scan-command-runner.mjs +29 -2
- package/cli/discovery-snapshot.mjs +8 -15
- package/cli/domain-control-monitor.mjs +104 -0
- package/cli/domain-control-observations.mjs +235 -0
- package/cli/errors.mjs +7 -1
- package/cli/evidence-command-arguments.mjs +11 -0
- package/cli/evidence-command-runner.mjs +1 -0
- package/cli/external-observation-mapping.mjs +162 -0
- package/cli/fail-policy.mjs +64 -0
- package/cli/formatters/html.mjs +1 -1
- package/cli/formatters/json.mjs +12 -4
- package/cli/formatters/terminal.mjs +1 -1
- package/cli/http.mjs +2 -1
- package/cli/investigation-manifest.mjs +113 -0
- package/cli/investigation-run.mjs +112 -0
- package/cli/lookup-brief.mjs +116 -0
- package/cli/lookup-command-runner.mjs +8 -1
- package/cli/lookup-diff.mjs +17 -19
- package/cli/lookup-reconcile.mjs +1 -1
- package/cli/mail-review.mjs +5 -5
- package/cli/manual.mjs +1 -1
- package/cli/network-command-runner.mjs +4 -1
- package/cli/offline-evidence-review.mjs +105 -8
- package/cli/open-asset-model-bridge.mjs +169 -0
- package/cli/registry-cohort.mjs +121 -0
- package/cli/registry-doctor.mjs +106 -11
- package/cli/registry-fixture-scaffold.mjs +74 -0
- package/cli/runner.mjs +388 -315
- package/docs/cli-reference.md +266 -21
- package/docs/cli.md +43 -7
- package/frontend/src/lib/analysis/acquisition-due-diligence.js +2 -2
- package/frontend/src/lib/analysis/brand-profile-model.js +50 -6
- package/frontend/src/lib/analysis/case-evidence-model.js +1 -1
- package/frontend/src/lib/analysis/case-record-core.js +1 -1
- package/frontend/src/lib/analysis/case-record-operations.js +1 -1
- package/frontend/src/lib/analysis/case-report.js +573 -0
- package/frontend/src/lib/analysis/case-response-model.js +30 -1
- package/frontend/src/lib/analysis/detection-rule-model.js +36 -0
- package/frontend/src/lib/analysis/external-findings-import.js +320 -0
- package/frontend/src/lib/analysis/lookup-asset-graph.js +8 -8
- package/frontend/src/lib/analysis/lookup-decision-support.js +9 -2
- package/frontend/src/lib/analysis/lookup-presentation.js +14 -30
- package/frontend/src/lib/analysis/lookup-source-refresh.js +36 -63
- package/frontend/src/lib/analysis/scoring.js +1 -1
- package/frontend/src/lib/analysis/utils.js +1 -1
- package/frontend/src/lib/analysis/visualization-models.js +2 -3
- package/frontend/src/lib/analysis/workspace-archive-crypto.js +1 -4
- package/frontend/src/lib/analysis/workspace-archive.js +5 -7
- package/lib/abusech-auth.mjs +1 -1
- package/lib/availability.mjs +1 -1
- package/lib/bounded-contract-normalizers.mjs +33 -0
- package/lib/bounded-file.mjs +69 -0
- package/lib/bounded-json-response.mjs +157 -0
- package/lib/browser-library-profile.mjs +167 -38
- package/lib/dns-convergence-review.mjs +183 -0
- package/lib/dns-delegation-health.mjs +196 -3
- package/lib/domain-change-packet.mjs +133 -0
- package/lib/domain-change-review.mjs +307 -0
- package/lib/domain-control-flight-recorder.mjs +268 -0
- package/lib/domain-portfolio-review.mjs +151 -0
- package/lib/evidence-export.mjs +1 -1
- package/lib/html-signals.mjs +5 -11
- package/lib/lookup-cache.mjs +5 -1
- package/lib/nameserver-preflight-review.mjs +159 -0
- package/lib/page-language-signals.mjs +124 -0
- package/lib/rdap-transport.mjs +6 -6
- package/lib/risk-scoring.mjs +42 -1
- package/lib/safe-fetch.mjs +37 -32
- package/lib/static-html-analysis.mjs +29 -1
- package/lib/threat-intelligence-runtime.mjs +1 -2
- package/lib/trust-store-comparison.mjs +146 -0
- package/lib/website-technology.mjs +22 -12
- package/lib/zone-intent-review.mjs +534 -0
- package/package.json +1 -1
package/cli/registry-doctor.mjs
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { registryCapabilityFor, REGISTRY_CAPABILITIES_VERSION } from "../lib/registry-capabilities.mjs";
|
|
2
|
+
import { recordOrEmpty } from "../lib/bounded-contract-normalizers.mjs";
|
|
2
3
|
import { CliUsageError } from "./errors.mjs";
|
|
3
4
|
import { parseSavedLookupDocument } from "./saved-lookup.mjs";
|
|
4
5
|
const REGISTRY_DOCTOR_SCHEMA = 'whoisleuth.cli.registry-doctor';
|
|
5
|
-
const REGISTRY_DOCTOR_VERSION =
|
|
6
|
-
function record(value) {
|
|
7
|
-
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
8
|
-
}
|
|
6
|
+
const REGISTRY_DOCTOR_VERSION = 2;
|
|
9
7
|
function status(value) {
|
|
10
8
|
return typeof value === 'string'
|
|
11
9
|
? value.replace(/[\u0000-\u001f\u007f]+/gu, ' ').trim().toLowerCase().slice(0, 40) || 'unavailable'
|
|
@@ -31,27 +29,114 @@ function normalizedObjectIdentifier(parsed) {
|
|
|
31
29
|
const candidate = parsed.handle ?? parsed.objectIdentifier ?? parsed.registryObjectId ?? parsed.id;
|
|
32
30
|
return typeof candidate === 'string' && candidate.trim() ? 'observed' : 'not_observed';
|
|
33
31
|
}
|
|
32
|
+
function stringArray(value, limit = 100) {
|
|
33
|
+
return Array.isArray(value)
|
|
34
|
+
? [...new Set(value.slice(0, limit).filter((item) => typeof item === 'string').map((item) => item.trim().toLowerCase()).filter(Boolean))]
|
|
35
|
+
: [];
|
|
36
|
+
}
|
|
37
|
+
function publicationQuality(parsed, rdapStatus) {
|
|
38
|
+
if (!['success', 'partial'].includes(rdapStatus)) {
|
|
39
|
+
const unavailable = { state: 'unavailable', value: null };
|
|
40
|
+
return {
|
|
41
|
+
objectClass: unavailable,
|
|
42
|
+
objectIdentifier: unavailable,
|
|
43
|
+
mediaType: unavailable,
|
|
44
|
+
baseConformance: { state: 'unavailable', declarations: [] },
|
|
45
|
+
redactionMetadata: { state: 'unavailable', count: 0, truncated: false },
|
|
46
|
+
selfLink: { state: 'unavailable', observedRelations: [] },
|
|
47
|
+
events: { state: 'unavailable', count: 0, conflictingActions: [] },
|
|
48
|
+
reviewItems: 0,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
const objectClassName = typeof parsed.objectClassName === 'string' ? parsed.objectClassName.trim().toLowerCase() : '';
|
|
52
|
+
const identifier = [parsed.handle, parsed.objectIdentifier, parsed.registryObjectId, parsed.id]
|
|
53
|
+
.find((value) => typeof value === 'string' && Boolean(value.trim()))?.trim() ?? null;
|
|
54
|
+
const declarations = stringArray(parsed.conformance);
|
|
55
|
+
const redactions = Array.isArray(parsed.redactions) ? parsed.redactions.slice(0, 100) : [];
|
|
56
|
+
const links = Array.isArray(parsed.links) ? parsed.links.slice(0, 100).map(recordOrEmpty) : [];
|
|
57
|
+
const relations = [...new Set(links.flatMap((link) => stringArray(link.rel, 10).length
|
|
58
|
+
? stringArray(link.rel, 10)
|
|
59
|
+
: typeof link.rel === 'string' ? [link.rel.trim().toLowerCase()] : []).filter(Boolean))];
|
|
60
|
+
const events = Array.isArray(parsed.events) ? parsed.events.slice(0, 100).map(recordOrEmpty) : [];
|
|
61
|
+
const actionDates = new Map();
|
|
62
|
+
for (const event of events) {
|
|
63
|
+
const action = typeof event.action === 'string' ? event.action.trim().toLowerCase() : '';
|
|
64
|
+
const date = typeof event.date === 'string' ? event.date.trim() : '';
|
|
65
|
+
if (!action || !date)
|
|
66
|
+
continue;
|
|
67
|
+
const dates = actionDates.get(action) ?? [];
|
|
68
|
+
dates.push(date);
|
|
69
|
+
actionDates.set(action, dates);
|
|
70
|
+
}
|
|
71
|
+
const lifecycle = recordOrEmpty(parsed.lifecycle);
|
|
72
|
+
const lifecycleMappings = [
|
|
73
|
+
['registration', 'createdDateIso', false],
|
|
74
|
+
['reregistration', 'reregistrationDateIso', true],
|
|
75
|
+
['expiration', 'expiryDateIso', true],
|
|
76
|
+
['last changed', 'updatedDateIso', true],
|
|
77
|
+
['transfer', 'transferDateIso', true],
|
|
78
|
+
['deletion', 'deletionDateIso', true],
|
|
79
|
+
['reinstantiation', 'reinstantiationDateIso', true],
|
|
80
|
+
['last update of rdap database', 'databaseUpdatedDateIso', true],
|
|
81
|
+
];
|
|
82
|
+
const conflictingActions = lifecycleMappings.flatMap(([action, field, newest]) => {
|
|
83
|
+
const published = typeof lifecycle[field] === 'string' ? Date.parse(lifecycle[field]) : Number.NaN;
|
|
84
|
+
if (!Number.isFinite(published))
|
|
85
|
+
return [];
|
|
86
|
+
const dates = (actionDates.get(action) ?? []).map(Date.parse).filter(Number.isFinite);
|
|
87
|
+
if (!dates.length)
|
|
88
|
+
return [action];
|
|
89
|
+
const selected = newest ? Math.max(...dates) : Math.min(...dates);
|
|
90
|
+
return selected === published ? [] : [action];
|
|
91
|
+
}).sort();
|
|
92
|
+
const objectClassState = !objectClassName ? 'not_observed' : objectClassName === 'domain' ? 'observed' : 'inconsistent';
|
|
93
|
+
const baseConformanceState = declarations.includes('rdap_level_0') ? 'observed' : 'not_observed';
|
|
94
|
+
const selfLinkState = relations.includes('self') ? 'observed' : 'not_observed';
|
|
95
|
+
const hasLifecycle = lifecycleMappings.some(([, field]) => typeof lifecycle[field] === 'string');
|
|
96
|
+
const eventsState = conflictingActions.length
|
|
97
|
+
? 'inconsistent'
|
|
98
|
+
: events.length && hasLifecycle
|
|
99
|
+
? 'observed'
|
|
100
|
+
: events.length
|
|
101
|
+
? 'unavailable'
|
|
102
|
+
: 'not_observed';
|
|
103
|
+
return {
|
|
104
|
+
objectClass: { state: objectClassState, value: objectClassName || null },
|
|
105
|
+
objectIdentifier: { state: identifier ? 'observed' : 'not_observed', value: identifier },
|
|
106
|
+
mediaType: { state: 'unavailable', value: null },
|
|
107
|
+
baseConformance: { state: baseConformanceState, declarations },
|
|
108
|
+
redactionMetadata: {
|
|
109
|
+
state: redactions.length ? 'observed' : 'not_observed',
|
|
110
|
+
count: redactions.length,
|
|
111
|
+
truncated: parsed.redactionsTruncated === true,
|
|
112
|
+
},
|
|
113
|
+
selfLink: { state: selfLinkState, observedRelations: relations.sort() },
|
|
114
|
+
events: { state: eventsState, count: events.length, conflictingActions },
|
|
115
|
+
reviewItems: [objectClassState, baseConformanceState, selfLinkState, eventsState]
|
|
116
|
+
.filter((state) => state === 'inconsistent' || state === 'not_observed').length,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
34
119
|
function buildRegistryDoctorReport(raw, generatedAt = new Date().toISOString()) {
|
|
35
120
|
const document = parseSavedLookupDocument(raw, { label: 'Registry doctor input' });
|
|
36
121
|
const capability = registryCapabilityFor(document.registrableDomain);
|
|
37
122
|
if (!capability)
|
|
38
123
|
throw new CliUsageError('Registry doctor could not resolve a capability profile for this domain.');
|
|
39
|
-
const diagnostics =
|
|
40
|
-
const rdap =
|
|
41
|
-
const whois =
|
|
42
|
-
const rdapParsed =
|
|
43
|
-
const whoisParsed =
|
|
124
|
+
const diagnostics = recordOrEmpty(document.diagnostics);
|
|
125
|
+
const rdap = recordOrEmpty(document.rdap);
|
|
126
|
+
const whois = recordOrEmpty(document.whois);
|
|
127
|
+
const rdapParsed = recordOrEmpty(rdap.parsed);
|
|
128
|
+
const whoisParsed = recordOrEmpty(whois.parsed);
|
|
44
129
|
const sourceInputs = [
|
|
45
130
|
{
|
|
46
131
|
source: 'rdap',
|
|
47
132
|
expected: capability.rdapAccessProfile === 'iana-bootstrap' ? 'allowed' : 'unsupported',
|
|
48
|
-
observed: status(
|
|
133
|
+
observed: status(recordOrEmpty(diagnostics.rdap).status),
|
|
49
134
|
parsed: rdapParsed,
|
|
50
135
|
},
|
|
51
136
|
{
|
|
52
137
|
source: 'whois',
|
|
53
138
|
expected: expectedWhois(capability.whoisAccessProfile),
|
|
54
|
-
observed: status(
|
|
139
|
+
observed: status(recordOrEmpty(diagnostics.whois).status),
|
|
55
140
|
parsed: whoisParsed,
|
|
56
141
|
},
|
|
57
142
|
];
|
|
@@ -64,6 +149,7 @@ function buildRegistryDoctorReport(raw, generatedAt = new Date().toISOString())
|
|
|
64
149
|
objectIdentifier: normalizedObjectIdentifier(source.parsed),
|
|
65
150
|
limitation: capability.limitation.slice(0, 500),
|
|
66
151
|
}));
|
|
152
|
+
const publication = publicationQuality(rdapParsed, sourceInputs[0]?.observed ?? 'unavailable');
|
|
67
153
|
const recommendations = [
|
|
68
154
|
...sources.filter((source) => source.alignment === 'investigate').map((source) => (source.expected === 'allowed'
|
|
69
155
|
? `Review ${source.source.toUpperCase()} source health, transport attempts, and fixture coverage; the catalogue expected collection to be available.`
|
|
@@ -83,6 +169,7 @@ function buildRegistryDoctorReport(raw, generatedAt = new Date().toISOString())
|
|
|
83
169
|
explicitSuffixProfile: capability.explicitSuffixProfile,
|
|
84
170
|
coverageState: capability.coverageState,
|
|
85
171
|
},
|
|
172
|
+
publication,
|
|
86
173
|
sources,
|
|
87
174
|
summary: {
|
|
88
175
|
investigate: sources.filter((source) => source.alignment === 'investigate' || source.alignment === 'unexpected_observation').length,
|
|
@@ -94,6 +181,7 @@ function buildRegistryDoctorReport(raw, generatedAt = new Date().toISOString())
|
|
|
94
181
|
'This diagnostic compares one saved observation with the local reviewed capability catalogue and makes no registry, registrar, RDAP, or WHOIS request.',
|
|
95
182
|
'A catalogue alignment does not prove live reachability, parser completeness, current registry policy, registration, availability, ownership, safety, or maliciousness.',
|
|
96
183
|
'A missing registry object identifier can be a publication characteristic. It remains not observed and is not converted into a collection failure.',
|
|
184
|
+
'Publication-quality observations describe the saved normalised RDAP object. The saved Lookup format does not retain the response media type, so that field remains unavailable.',
|
|
97
185
|
'Use fixture-based maintenance checks before changing a registry parser or access profile; automated tests must not contact live registries.',
|
|
98
186
|
],
|
|
99
187
|
};
|
|
@@ -112,6 +200,13 @@ function formatRegistryDoctorReport(report) {
|
|
|
112
200
|
output.push(` Observed: ${source.observed.replaceAll('_', ' ')}`);
|
|
113
201
|
output.push(` Object identifier: ${source.objectIdentifier.replaceAll('_', ' ')}`);
|
|
114
202
|
}
|
|
203
|
+
output.push('', 'RDAP publication quality');
|
|
204
|
+
output.push(` Object class: ${report.publication.objectClass.state.replaceAll('_', ' ')}`);
|
|
205
|
+
output.push(` Object identifier: ${report.publication.objectIdentifier.state.replaceAll('_', ' ')}`);
|
|
206
|
+
output.push(` Base conformance: ${report.publication.baseConformance.state.replaceAll('_', ' ')}`);
|
|
207
|
+
output.push(` Self link: ${report.publication.selfLink.state.replaceAll('_', ' ')}`);
|
|
208
|
+
output.push(` Events: ${report.publication.events.state.replaceAll('_', ' ')}`);
|
|
209
|
+
output.push(' Media type: unavailable in the saved Lookup contract');
|
|
115
210
|
if (report.recommendations.length) {
|
|
116
211
|
output.push('', 'Recommendations:');
|
|
117
212
|
for (const item of report.recommendations)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { registryCompatibilityMatrix } from "../lib/registry-capabilities.mjs";
|
|
2
|
+
const SAFE_ID_RE = /^[a-z0-9](?:[a-z0-9-]{0,126}[a-z0-9])?$/u;
|
|
3
|
+
const SAFE_SUFFIX_RE = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/u;
|
|
4
|
+
const SCENARIOS = new Set(['registered', 'not_found', 'inconclusive']);
|
|
5
|
+
export function buildRegistryFixtureScaffold(profileIdInput, suffixInput, scenarioInput) {
|
|
6
|
+
const profileId = typeof profileIdInput === 'string' ? profileIdInput.toLowerCase() : '';
|
|
7
|
+
const suffix = typeof suffixInput === 'string' ? suffixInput.toLowerCase().replace(/^\./u, '') : '';
|
|
8
|
+
const scenario = typeof scenarioInput === 'string' ? scenarioInput.toLowerCase() : '';
|
|
9
|
+
if (!SAFE_ID_RE.test(profileId))
|
|
10
|
+
throw new TypeError('The capability profile is invalid.');
|
|
11
|
+
if (!SAFE_SUFFIX_RE.test(suffix))
|
|
12
|
+
throw new TypeError('The suffix is invalid.');
|
|
13
|
+
if (!SCENARIOS.has(scenario))
|
|
14
|
+
throw new TypeError('Scenario must be registered, not_found, or inconclusive.');
|
|
15
|
+
const matchingProfiles = registryCompatibilityMatrix().filter((item) => item.id === profileId);
|
|
16
|
+
if (!matchingProfiles.length)
|
|
17
|
+
throw new TypeError('The capability profile is not present in the registry catalogue.');
|
|
18
|
+
const profile = matchingProfiles.find((item) => item.suffixes.includes(suffix));
|
|
19
|
+
if (!profile)
|
|
20
|
+
throw new TypeError(`The capability profile does not cover .${suffix}.`);
|
|
21
|
+
const domain = `EXAMPLE.${suffix.toUpperCase()}`;
|
|
22
|
+
const response = scenario === 'registered'
|
|
23
|
+
? [
|
|
24
|
+
`Domain Name: ${domain}`,
|
|
25
|
+
'Registry Domain ID: EXAMPLE-SYNTHETIC-ID',
|
|
26
|
+
'Registrar: Example Registrar',
|
|
27
|
+
'Creation Date: 2020-01-02T03:04:05Z',
|
|
28
|
+
'Updated Date: 2024-05-06T07:08:09Z',
|
|
29
|
+
'Registry Expiry Date: 2030-01-02T03:04:05Z',
|
|
30
|
+
'Domain Status: active',
|
|
31
|
+
'Registrant Organization: Example Organisation',
|
|
32
|
+
'Registrant Email: registrant@example.invalid',
|
|
33
|
+
'Name Server: NS1.EXAMPLE.INVALID',
|
|
34
|
+
'DNSSEC: unsigned',
|
|
35
|
+
]
|
|
36
|
+
: scenario === 'not_found'
|
|
37
|
+
? ['REPLACE WITH A SYNTHETIC AUTHORITATIVE NO-RECORD DIALECT']
|
|
38
|
+
: ['REPLACE WITH A SYNTHETIC RESTRICTED, RATE-LIMITED, OR TEMPORARY-FAILURE DIALECT'];
|
|
39
|
+
const expected = scenario === 'registered'
|
|
40
|
+
? {
|
|
41
|
+
registrationStatus: 'registered',
|
|
42
|
+
domainName: domain,
|
|
43
|
+
registrar: 'Example Registrar',
|
|
44
|
+
registrantOrg: 'Example Organisation',
|
|
45
|
+
registrantEmail: 'registrant@example.invalid',
|
|
46
|
+
nameservers: ['NS1.EXAMPLE.INVALID'],
|
|
47
|
+
}
|
|
48
|
+
: scenario === 'not_found'
|
|
49
|
+
? { registrationStatus: 'not_found', notFound: true }
|
|
50
|
+
: { registrationStatus: 'inconclusive', notFound: false };
|
|
51
|
+
return [
|
|
52
|
+
'// Synthetic scaffold only. Do not paste a live WHOIS response or personal registration data.',
|
|
53
|
+
'// Preserve the registry dialect while replacing domains, contacts, handles, addresses, phones,',
|
|
54
|
+
'// nameservers, dates, identifiers, and free text with reserved or fictional values.',
|
|
55
|
+
'{',
|
|
56
|
+
` name: ${JSON.stringify(`.${suffix} ${scenario} synthetic response`)},`,
|
|
57
|
+
` capabilityProfile: ${JSON.stringify(profileId)},`,
|
|
58
|
+
` scenario: ${JSON.stringify(scenario)},`,
|
|
59
|
+
' chain: [',
|
|
60
|
+
` rootHop(${JSON.stringify(suffix.toUpperCase())}, ${JSON.stringify(`whois.${suffix}.invalid`)}),`,
|
|
61
|
+
` registryHop(${JSON.stringify(`whois.${suffix}.invalid`)}, ${JSON.stringify(response, null, 2).replace(/\n/gu, '\n ')}),`,
|
|
62
|
+
' ],',
|
|
63
|
+
` expected: ${JSON.stringify(expected, null, 2).replace(/\n/gu, '\n ')},`,
|
|
64
|
+
'},',
|
|
65
|
+
'',
|
|
66
|
+
'// Review checklist:',
|
|
67
|
+
'// - every domain and hostname uses the requested suffix or .invalid;',
|
|
68
|
+
'// - every email ends in .invalid; IP examples use documentation ranges;',
|
|
69
|
+
'// - no real name, address, phone, handle, identifier, or free-text notice remains;',
|
|
70
|
+
'// - authoritative absence is asserted only for a documented registry response;',
|
|
71
|
+
'// - add or refresh the tracked provenance digest after review.',
|
|
72
|
+
'',
|
|
73
|
+
].join('\n');
|
|
74
|
+
}
|