@crimson-crawler/crimson-crawler-client 4.1.1 → 5.0.1
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/NOTICE +21 -0
- package/README.md +198 -94
- package/dist/.package-build.json +1 -1
- package/dist/_generated/index.cjs +54 -34
- package/dist/_generated/index.d.cts +2 -2
- package/dist/_generated/index.d.ts +2 -2
- package/dist/_generated/index.js +1 -1
- package/dist/_generated/sdk.gen.cjs +54 -34
- package/dist/_generated/sdk.gen.d.cts +402 -173
- package/dist/_generated/sdk.gen.d.ts +402 -173
- package/dist/_generated/sdk.gen.js +1 -1
- package/dist/_generated/types.gen.d.cts +14117 -3953
- package/dist/_generated/types.gen.d.ts +14117 -3953
- package/dist/{chunk-4HSWOQA6.cjs → chunk-ASYQPVBW.cjs} +46 -0
- package/dist/{chunk-C53EHGN4.js → chunk-EZD3XBDV.js} +86 -65
- package/dist/{chunk-2X3CCE46.js → chunk-MHC5LRPW.js} +42 -1
- package/dist/{chunk-4PCL3ANB.cjs → chunk-TAMKRTM6.cjs} +87 -64
- package/dist/index.cjs +900 -175
- package/dist/index.d.cts +558 -99
- package/dist/index.d.ts +558 -99
- package/dist/index.js +851 -130
- package/dist/presets-cAYp-Cru.d.cts +122 -0
- package/dist/presets-cAYp-Cru.d.ts +122 -0
- package/dist/presets.cjs +27 -19
- package/dist/presets.d.cts +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/presets.js +1 -1
- package/package.json +9 -5
- package/dist/presets-BMN8jy08.d.cts +0 -110
- package/dist/presets-BMN8jy08.d.ts +0 -110
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,56 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkTAMKRTM6_cjs = require('./chunk-TAMKRTM6.cjs');
|
|
4
|
+
var chunkASYQPVBW_cjs = require('./chunk-ASYQPVBW.cjs');
|
|
5
5
|
var chunk4CXMKUDH_cjs = require('./chunk-4CXMKUDH.cjs');
|
|
6
6
|
require('./chunk-75ZPJI57.cjs');
|
|
7
7
|
|
|
8
|
+
// src/cve-catalog.ts
|
|
9
|
+
function resolve(entries, keys) {
|
|
10
|
+
return keys.map((key) => {
|
|
11
|
+
if (typeof key !== "string" || !entries || !Object.hasOwn(entries, key)) {
|
|
12
|
+
throw new Error("Invalid CVE context catalogue reference");
|
|
13
|
+
}
|
|
14
|
+
return entries[key];
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function expandCveContext(page) {
|
|
18
|
+
if (!("cve_context_catalog" in page)) {
|
|
19
|
+
if ((page.cves ?? []).some(
|
|
20
|
+
(row) => Object.keys(row.catalog_refs ?? {}).length
|
|
21
|
+
)) {
|
|
22
|
+
throw new Error("Invalid CVE context catalogue reference");
|
|
23
|
+
}
|
|
24
|
+
return page;
|
|
25
|
+
}
|
|
26
|
+
const catalog = page.cve_context_catalog ?? {};
|
|
27
|
+
for (const row of page.cves ?? []) {
|
|
28
|
+
for (const [field, keys] of Object.entries(row.catalog_refs ?? {})) {
|
|
29
|
+
if (!Array.isArray(keys))
|
|
30
|
+
throw new Error("Invalid CVE context catalogue reference");
|
|
31
|
+
switch (field) {
|
|
32
|
+
case "attack_patterns":
|
|
33
|
+
row.attack_patterns = resolve(catalog.attack_patterns, keys);
|
|
34
|
+
break;
|
|
35
|
+
case "techniques":
|
|
36
|
+
row.techniques = resolve(catalog.techniques, keys);
|
|
37
|
+
break;
|
|
38
|
+
case "mitigations":
|
|
39
|
+
row.mitigations = resolve(catalog.mitigations, keys);
|
|
40
|
+
break;
|
|
41
|
+
case "weaknesses":
|
|
42
|
+
row.weaknesses = resolve(catalog.weaknesses, keys);
|
|
43
|
+
break;
|
|
44
|
+
default:
|
|
45
|
+
throw new Error("Invalid CVE context catalogue reference");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
row.catalog_refs = {};
|
|
49
|
+
}
|
|
50
|
+
page.cve_context_catalog = {};
|
|
51
|
+
return page;
|
|
52
|
+
}
|
|
53
|
+
|
|
8
54
|
// src/exceptions.ts
|
|
9
55
|
var CrawlerClientError = class extends Error {
|
|
10
56
|
constructor(message) {
|
|
@@ -29,6 +75,76 @@ var UnexpectedStatus = class extends CrawlerClientError {
|
|
|
29
75
|
body;
|
|
30
76
|
};
|
|
31
77
|
|
|
78
|
+
// src/paging.ts
|
|
79
|
+
function snapshotExpired(error) {
|
|
80
|
+
if (!(error instanceof UnexpectedStatus) || error.status !== 409)
|
|
81
|
+
return false;
|
|
82
|
+
let body = error.body;
|
|
83
|
+
if (typeof body === "string") {
|
|
84
|
+
try {
|
|
85
|
+
body = JSON.parse(body);
|
|
86
|
+
} catch {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (!body || typeof body !== "object") return false;
|
|
91
|
+
const value = body;
|
|
92
|
+
return value.error === "snapshot_expired" || value.detail?.error === "snapshot_expired";
|
|
93
|
+
}
|
|
94
|
+
async function collectSnapshotPages(fetch, nextOffset) {
|
|
95
|
+
for (let attempt = 0; ; attempt++) {
|
|
96
|
+
const pages = [];
|
|
97
|
+
let offset = 0;
|
|
98
|
+
let snapshotId;
|
|
99
|
+
try {
|
|
100
|
+
for (; ; ) {
|
|
101
|
+
const page = await fetch(offset, snapshotId);
|
|
102
|
+
const current = page.snapshot_id ?? void 0;
|
|
103
|
+
const next = nextOffset(page);
|
|
104
|
+
if (current !== void 0 && (typeof current !== "string" || !current) || snapshotId !== void 0 && current !== snapshotId || next != null && current === void 0) {
|
|
105
|
+
throw new Error("Enrichment returned an invalid snapshot identifier");
|
|
106
|
+
}
|
|
107
|
+
snapshotId = current;
|
|
108
|
+
pages.push(page);
|
|
109
|
+
if (next == null) return pages;
|
|
110
|
+
if (!Number.isInteger(next) || next <= offset) {
|
|
111
|
+
throw new Error("Enrichment returned an invalid next offset");
|
|
112
|
+
}
|
|
113
|
+
offset = next;
|
|
114
|
+
}
|
|
115
|
+
} catch (error) {
|
|
116
|
+
if (attempt === 0 && snapshotExpired(error)) continue;
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
async function* iterOsvPages(fetch) {
|
|
122
|
+
let offset = 0;
|
|
123
|
+
let snapshotId;
|
|
124
|
+
for (; ; ) {
|
|
125
|
+
const page = await fetch(offset, snapshotId);
|
|
126
|
+
if (snapshotId !== void 0 && page.errors?.some(
|
|
127
|
+
(error) => error.service === "osv" && error.error === "stored_copy_unavailable"
|
|
128
|
+
)) {
|
|
129
|
+
throw new Error("stored_copy_unavailable");
|
|
130
|
+
}
|
|
131
|
+
const current = page.osv_snapshot_id ?? void 0;
|
|
132
|
+
const next = page.osv_next_offset;
|
|
133
|
+
if (current !== void 0 && (typeof current !== "string" || !current) || current !== void 0 && snapshotId !== void 0 && current !== snapshotId) {
|
|
134
|
+
throw new Error("Enrichment returned an invalid OSV snapshot identifier");
|
|
135
|
+
}
|
|
136
|
+
if (next != null) {
|
|
137
|
+
if (current === void 0 || !Number.isInteger(next) || next < 0 || snapshotId !== void 0 && next <= offset) {
|
|
138
|
+
throw new Error("Enrichment returned an invalid OSV continuation");
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
yield page;
|
|
142
|
+
if (next == null) return;
|
|
143
|
+
offset = next;
|
|
144
|
+
snapshotId = current;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
32
148
|
// src/_auth.ts
|
|
33
149
|
function withApiKeyHeader(input, init, headerName, apiKey, origin) {
|
|
34
150
|
const inherited = init?.headers ?? (input instanceof Request ? input.headers : void 0);
|
|
@@ -36,9 +152,9 @@ function withApiKeyHeader(input, init, headerName, apiKey, origin) {
|
|
|
36
152
|
const raw = typeof input === "string" ? input : input instanceof URL ? input.href : input instanceof Request ? input.url : String(input);
|
|
37
153
|
let sameOrigin;
|
|
38
154
|
try {
|
|
39
|
-
sameOrigin = new URL(raw).origin === origin;
|
|
155
|
+
sameOrigin = !raw.startsWith("//") && !raw.startsWith("/\\") && new URL(raw).origin === origin;
|
|
40
156
|
} catch {
|
|
41
|
-
sameOrigin =
|
|
157
|
+
sameOrigin = false;
|
|
42
158
|
}
|
|
43
159
|
if (sameOrigin) {
|
|
44
160
|
headers.set(headerName, apiKey);
|
|
@@ -46,6 +162,21 @@ function withApiKeyHeader(input, init, headerName, apiKey, origin) {
|
|
|
46
162
|
return headers;
|
|
47
163
|
}
|
|
48
164
|
|
|
165
|
+
// src/tlp.ts
|
|
166
|
+
var TLP_VALUES = [
|
|
167
|
+
"CLEAR",
|
|
168
|
+
"GREEN",
|
|
169
|
+
"AMBER",
|
|
170
|
+
"AMBER+STRICT",
|
|
171
|
+
"RED"
|
|
172
|
+
];
|
|
173
|
+
var TLP_INVALID_MESSAGE = `tlp must be one of ${TLP_VALUES.join(", ")}`;
|
|
174
|
+
function validateTlp(value) {
|
|
175
|
+
if (value === void 0) return void 0;
|
|
176
|
+
if (TLP_VALUES.includes(value)) return value;
|
|
177
|
+
throw new RangeError(TLP_INVALID_MESSAGE);
|
|
178
|
+
}
|
|
179
|
+
|
|
49
180
|
// src/url.ts
|
|
50
181
|
function pathSegment(value) {
|
|
51
182
|
return encodeURIComponent(value);
|
|
@@ -100,6 +231,28 @@ function downloadFilename(disposition, fallback) {
|
|
|
100
231
|
}
|
|
101
232
|
return basename;
|
|
102
233
|
}
|
|
234
|
+
var STOP_STATUSES = {
|
|
235
|
+
502: "generation failed",
|
|
236
|
+
402: "no AI provider",
|
|
237
|
+
429: "rate limited"
|
|
238
|
+
};
|
|
239
|
+
var QUOTA_ERROR = "report_inference_quota_exceeded";
|
|
240
|
+
function errorCode(body) {
|
|
241
|
+
let parsed = body;
|
|
242
|
+
if (typeof body === "string") {
|
|
243
|
+
try {
|
|
244
|
+
parsed = JSON.parse(body);
|
|
245
|
+
} catch {
|
|
246
|
+
return void 0;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return parsed && typeof parsed === "object" ? parsed.error : void 0;
|
|
250
|
+
}
|
|
251
|
+
function stopNote(err) {
|
|
252
|
+
if (err.status === 429 && errorCode(err.body) === QUOTA_ERROR)
|
|
253
|
+
return "quota exhausted";
|
|
254
|
+
return STOP_STATUSES[err.status];
|
|
255
|
+
}
|
|
103
256
|
var AiReportsApi = class {
|
|
104
257
|
baseUrl;
|
|
105
258
|
// True ES2022 private field, not TypeScript `private`: `private` is erased at compile
|
|
@@ -177,12 +330,19 @@ var AiReportsApi = class {
|
|
|
177
330
|
* Create a DRAFT report from a template + source artifacts. Renders the scaffold (static +
|
|
178
331
|
* deterministic data sections) and returns the list of AI sections still to fill.
|
|
179
332
|
*
|
|
180
|
-
*
|
|
333
|
+
* `tlp` is an optional TLP 2.0 marking stored on the report exactly (`CLEAR` / `GREEN` / `AMBER` /
|
|
334
|
+
* `AMBER+STRICT` / `RED`). Omit it to use your default report TLP (the Report Generator's
|
|
335
|
+
* Settings), raised to the most restrictive source marking. An invalid value throws `RangeError`
|
|
336
|
+
* before any request.
|
|
337
|
+
*
|
|
338
|
+
* Resolves `{ id, name, html, ai_sections: [{section_type, label, ...}], skipped: [...], tlp }`.
|
|
181
339
|
*/
|
|
182
340
|
async createDraft(template, options = {}) {
|
|
341
|
+
const tlp = validateTlp(options.tlp);
|
|
183
342
|
const body = { template };
|
|
184
343
|
if (options.sourceIds !== void 0) body.source_ids = options.sourceIds;
|
|
185
344
|
if (options.name !== void 0) body.name = options.name;
|
|
345
|
+
if (tlp !== void 0) body.tlp = tlp;
|
|
186
346
|
return await (await this.request("POST", "/ai-reports/reports", { json: body })).json();
|
|
187
347
|
}
|
|
188
348
|
/**
|
|
@@ -235,13 +395,19 @@ var AiReportsApi = class {
|
|
|
235
395
|
/**
|
|
236
396
|
* Export a report as `html` or `md`. The body IS the export file.
|
|
237
397
|
*
|
|
398
|
+
* `options.tlp` sets the TLP 2.0 marking written into the document (`CLEAR` / `GREEN` / `AMBER` /
|
|
399
|
+
* `AMBER+STRICT` / `RED`), overriding the report's stored TLP; omit it to stamp the report's own
|
|
400
|
+
* stored TLP. An invalid value throws a `RangeError` before any request.
|
|
401
|
+
*
|
|
238
402
|
* Resolves `{ content, bytes, filename, contentType }`. `filename` is a sanitized basename from
|
|
239
|
-
* `Content-Disposition`. PDF/DOCX are browser-editor-only
|
|
403
|
+
* `Content-Disposition`. PDF/DOCX are browser-editor-only. Reports built in the browser export here too.
|
|
240
404
|
*/
|
|
241
|
-
async exportReport(reportId, fmt = "html") {
|
|
405
|
+
async exportReport(reportId, fmt = "html", options = {}) {
|
|
406
|
+
const tlp = validateTlp(options.tlp);
|
|
242
407
|
const resp = await this.request(
|
|
243
408
|
"GET",
|
|
244
|
-
`/ai-reports/reports/${pathSegment(reportId)}/export/${pathSegment(fmt)}
|
|
409
|
+
`/ai-reports/reports/${pathSegment(reportId)}/export/${pathSegment(fmt)}`,
|
|
410
|
+
tlp === void 0 ? {} : { params: { tlp } }
|
|
245
411
|
);
|
|
246
412
|
const disposition = resp.headers.get("content-disposition") ?? "";
|
|
247
413
|
const filename = downloadFilename(disposition, `${reportId}.${fmt}`);
|
|
@@ -255,13 +421,22 @@ var AiReportsApi = class {
|
|
|
255
421
|
}
|
|
256
422
|
/**
|
|
257
423
|
* Generate a report end-to-end: create the draft, fill every AI section, return the finished
|
|
258
|
-
* report. The convenience over `createDraft` + `fillSection
|
|
424
|
+
* report. The convenience over `createDraft` + `fillSection`; `options.tlp` is passed to
|
|
425
|
+
* `createDraft` (an exact marking; omit it for your default raised by the sources).
|
|
259
426
|
*
|
|
260
|
-
*
|
|
427
|
+
* Report sections run on the account's own AI provider (bring-your-own-key, saved in portal
|
|
428
|
+
* API Dashboard → AI Provider). If a section's model call fails (502), generation stops there and
|
|
429
|
+
* returns what filled so far:
|
|
261
430
|
* the report keeps the sections completed before the failure, the failed section is recorded in
|
|
262
431
|
* `sections` as `{ error: "generation failed", status: 502 }`, and that section plus any after it
|
|
263
432
|
* stay unfilled cards. Re-run `generateReport` or fill the rest individually with `fillSection`.
|
|
264
433
|
*
|
|
434
|
+
* No AI key at all (402) stops the loop the same way, recorded as
|
|
435
|
+
* `{ error: "no AI provider", status: 402 }` — add a key, then fill the rest with `fillSection`. A
|
|
436
|
+
* spent daily allowance on the built-in AI (429) is recorded as `{ error: "quota exhausted", status: 429 }`
|
|
437
|
+
* (your own key has no limit), and a gateway rate limit as `{ error: "rate limited", status: 429 }`.
|
|
438
|
+
* Draft creation never calls a model.
|
|
439
|
+
*
|
|
265
440
|
* Resolves `{ report, sections: [<fill result per section>], skipped: [...] }`.
|
|
266
441
|
*/
|
|
267
442
|
async generateReport(template, options = {}) {
|
|
@@ -274,12 +449,12 @@ var AiReportsApi = class {
|
|
|
274
449
|
try {
|
|
275
450
|
result = await this.fillSection(reportId);
|
|
276
451
|
} catch (err) {
|
|
277
|
-
if (err instanceof UnexpectedStatus
|
|
278
|
-
if (err
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
|
|
452
|
+
if (!(err instanceof UnexpectedStatus)) throw err;
|
|
453
|
+
if (err.status === 409) break;
|
|
454
|
+
const note = stopNote(err);
|
|
455
|
+
if (note === void 0) throw err;
|
|
456
|
+
sections.push({ error: note, status: err.status });
|
|
457
|
+
break;
|
|
283
458
|
}
|
|
284
459
|
sections.push(result);
|
|
285
460
|
if (result.complete) break;
|
|
@@ -391,14 +566,18 @@ var ArtifactManagerApi = class {
|
|
|
391
566
|
* List your artifacts (newest first, no content).
|
|
392
567
|
*
|
|
393
568
|
* @param options `kind` (input|enrichment|report) · `folder` (UUID or `"__root__"`)
|
|
394
|
-
* · `since`/`until` (ISO `created_at` window)
|
|
569
|
+
* · `since`/`until` (ISO `created_at` window) · `search` (names and contents, like the portal's search box)
|
|
570
|
+
* · `tlp` (filter by exact TLP 2.0 marking; each returned artifact carries its own `tlp`).
|
|
395
571
|
*/
|
|
396
572
|
async listArtifacts(options = {}) {
|
|
573
|
+
const tlp = validateTlp(options.tlp);
|
|
397
574
|
const params = {};
|
|
398
575
|
if (options.kind) params.kind = options.kind;
|
|
399
576
|
if (options.folder) params.folder = options.folder;
|
|
400
577
|
if (options.since) params.since = options.since;
|
|
401
578
|
if (options.until) params.until = options.until;
|
|
579
|
+
if (options.search) params.search = options.search;
|
|
580
|
+
if (tlp !== void 0) params.tlp = tlp;
|
|
402
581
|
const resp = await this.request("GET", "/artifact-manager/artifacts", {
|
|
403
582
|
params
|
|
404
583
|
});
|
|
@@ -408,14 +587,17 @@ var ArtifactManagerApi = class {
|
|
|
408
587
|
* Upload input artifacts (max 20/call, ≤10 MB content each).
|
|
409
588
|
*
|
|
410
589
|
* @param artifacts Each `{ name, content, format: "paste"|"file", mime? }`.
|
|
411
|
-
* @param options File into an existing `folderId`, or create one via `newFolderName
|
|
590
|
+
* @param options File into an existing `folderId`, or create one via `newFolderName`; `tlp` marks
|
|
591
|
+
* EVERY artifact in the batch (default `AMBER`).
|
|
412
592
|
* @returns `{ ids, folderId }` — the new artifact ids.
|
|
413
593
|
*/
|
|
414
594
|
async uploadArtifacts(artifacts, options = {}) {
|
|
595
|
+
const tlp = validateTlp(options.tlp);
|
|
415
596
|
const body = { artifacts };
|
|
416
597
|
if (options.folderId !== void 0) body.folderId = options.folderId;
|
|
417
598
|
if (options.newFolderName !== void 0)
|
|
418
599
|
body.newFolderName = options.newFolderName;
|
|
600
|
+
if (tlp !== void 0) body.tlp = tlp;
|
|
419
601
|
const resp = await this.request("POST", "/artifact-manager/artifacts", {
|
|
420
602
|
json: body
|
|
421
603
|
});
|
|
@@ -448,20 +630,24 @@ var ArtifactManagerApi = class {
|
|
|
448
630
|
name: decodeHeader(resp.headers.get("x-artifact-name"), artifactId),
|
|
449
631
|
format: resp.headers.get("x-artifact-format") ?? "",
|
|
450
632
|
mime: resp.headers.get("x-artifact-mime") ?? "",
|
|
633
|
+
tlp: resp.headers.get("x-artifact-tlp") ?? "",
|
|
451
634
|
created_at: resp.headers.get("x-artifact-created") ?? ""
|
|
452
635
|
};
|
|
453
636
|
}
|
|
454
637
|
/**
|
|
455
|
-
* Partial update: rename, star/unstar, and/or
|
|
638
|
+
* Partial update: rename, star/unstar, move between folders, and/or set the TLP marking.
|
|
456
639
|
*
|
|
457
640
|
* `folderId: null` moves the artifact back to root; omit it to leave the
|
|
458
|
-
* folder unchanged.
|
|
641
|
+
* folder unchanged. A call that sets only `tlp` is valid; an invalid value
|
|
642
|
+
* throws a `RangeError` before any request.
|
|
459
643
|
*/
|
|
460
644
|
async updateArtifact(artifactId, update) {
|
|
645
|
+
const tlp = validateTlp(update.tlp);
|
|
461
646
|
const body = {};
|
|
462
647
|
if (update.name !== void 0) body.name = update.name;
|
|
463
648
|
if (update.favorite !== void 0) body.favorite = update.favorite;
|
|
464
649
|
if ("folderId" in update) body.folderId = update.folderId;
|
|
650
|
+
if (tlp !== void 0) body.tlp = tlp;
|
|
465
651
|
const resp = await this.request(
|
|
466
652
|
"PATCH",
|
|
467
653
|
`/artifact-manager/artifacts/${pathSegment(artifactId)}`,
|
|
@@ -553,12 +739,17 @@ var ArtifactManagerApi = class {
|
|
|
553
739
|
}
|
|
554
740
|
/** Bundle an explicit set of your artifacts into one `.zip` (the bulk "Download .zip"). Enrichments
|
|
555
741
|
* contribute their machine exports under a per-enrichment subfolder; every other kind contributes its raw
|
|
556
|
-
* deliverable. Returns the raw `.zip` bytes.
|
|
557
|
-
|
|
742
|
+
* deliverable. Returns the raw `.zip` bytes. `options.tlp` marks every wrapped export, overriding each
|
|
743
|
+
* artifact's own stored TLP; omit it to mark each with that artifact's own TLP.
|
|
744
|
+
* See {@link downloadFolder} for the whole-folder twin. */
|
|
745
|
+
async downloadBundle(artifactIds, options = {}) {
|
|
746
|
+
const tlp = validateTlp(options.tlp);
|
|
747
|
+
const body = { ids: artifactIds };
|
|
748
|
+
if (tlp !== void 0) body.tlp = tlp;
|
|
558
749
|
const resp = await this.request(
|
|
559
750
|
"POST",
|
|
560
751
|
"/artifact-manager/artifacts/bundle",
|
|
561
|
-
{ json:
|
|
752
|
+
{ json: body }
|
|
562
753
|
);
|
|
563
754
|
return new Uint8Array(await resp.arrayBuffer());
|
|
564
755
|
}
|
|
@@ -592,11 +783,18 @@ var ArtifactManagerApi = class {
|
|
|
592
783
|
return (await resp.json()).formats;
|
|
593
784
|
}
|
|
594
785
|
/** Download one export. The body is the export file; `filename` is a sanitized basename from
|
|
595
|
-
* `Content-Disposition`. Text formats land in `content`; binary XLSX formats in `bytes`.
|
|
596
|
-
|
|
786
|
+
* `Content-Disposition`. Text formats land in `content`; binary XLSX formats in `bytes`.
|
|
787
|
+
*
|
|
788
|
+
* `options.tlp` sets the TLP 2.0 marking written into the export (`CLEAR` / `GREEN` / `AMBER` /
|
|
789
|
+
* `AMBER+STRICT` / `RED`), overriding the artifact's stored TLP; omit it to stamp the artifact's
|
|
790
|
+
* own stored TLP. Formats with no marking slot — OpenVEX, CSV and the
|
|
791
|
+
* DISA eMASS worksheet — ignore it. An invalid value throws a `RangeError` before any request. */
|
|
792
|
+
async getExport(enrichmentId, format, options = {}) {
|
|
793
|
+
const tlp = validateTlp(options.tlp);
|
|
597
794
|
const resp = await this.request(
|
|
598
795
|
"GET",
|
|
599
|
-
`/artifact-manager/artifacts/${pathSegment(enrichmentId)}/exports/${pathSegment(format)}
|
|
796
|
+
`/artifact-manager/artifacts/${pathSegment(enrichmentId)}/exports/${pathSegment(format)}`,
|
|
797
|
+
tlp === void 0 ? {} : { params: { tlp } }
|
|
600
798
|
);
|
|
601
799
|
const disposition = resp.headers.get("content-disposition") ?? "";
|
|
602
800
|
const filename = downloadFilename2(disposition, format);
|
|
@@ -611,11 +809,14 @@ var ArtifactManagerApi = class {
|
|
|
611
809
|
/** Download EVERY machine export of a saved artifact as one `.zip` (one file per format —
|
|
612
810
|
* `stix.json`, `vex.json`, `emass.xlsx`, …). The bulk twin of {@link getExport}, matching the export
|
|
613
811
|
* panel's "Download all (.zip)" button. Works for any saved enrichment / inventory-enrichment /
|
|
614
|
-
* inventory id. Returns the raw `.zip` bytes.
|
|
615
|
-
|
|
812
|
+
* inventory id. Returns the raw `.zip` bytes. `options.tlp` marks each export, overriding the
|
|
813
|
+
* artifact's stored TLP; omit it to stamp each with the artifact's own stored TLP. */
|
|
814
|
+
async downloadAllExports(enrichmentId, options = {}) {
|
|
815
|
+
const tlp = validateTlp(options.tlp);
|
|
616
816
|
const resp = await this.request(
|
|
617
817
|
"GET",
|
|
618
|
-
`/artifact-manager/artifacts/${pathSegment(enrichmentId)}/exports/all
|
|
818
|
+
`/artifact-manager/artifacts/${pathSegment(enrichmentId)}/exports/all`,
|
|
819
|
+
tlp === void 0 ? {} : { params: { tlp } }
|
|
619
820
|
);
|
|
620
821
|
return new Uint8Array(await resp.arrayBuffer());
|
|
621
822
|
}
|
|
@@ -666,14 +867,50 @@ var ArtifactManagerApi = class {
|
|
|
666
867
|
}
|
|
667
868
|
/** Download every artifact filed under a folder as one `<folder>.zip` (the folder "Download .zip").
|
|
668
869
|
* Enrichments contribute their machine exports under a per-enrichment subfolder; every other kind
|
|
669
|
-
* contributes its raw deliverable. Returns the raw `.zip` bytes.
|
|
670
|
-
|
|
870
|
+
* contributes its raw deliverable. Returns the raw `.zip` bytes. `options.tlp` marks every wrapped
|
|
871
|
+
* export, overriding each artifact's own stored TLP; omit it to mark each with that artifact's own
|
|
872
|
+
* stored TLP. */
|
|
873
|
+
async downloadFolder(folderId, options = {}) {
|
|
874
|
+
const tlp = validateTlp(options.tlp);
|
|
671
875
|
const resp = await this.request(
|
|
672
876
|
"GET",
|
|
673
|
-
`/artifact-manager/folders/${pathSegment(folderId)}/exports/all
|
|
877
|
+
`/artifact-manager/folders/${pathSegment(folderId)}/exports/all`,
|
|
878
|
+
tlp === void 0 ? {} : { params: { tlp } }
|
|
674
879
|
);
|
|
675
880
|
return new Uint8Array(await resp.arrayBuffer());
|
|
676
881
|
}
|
|
882
|
+
// -- Enricher settings -------------------------------------------------- //
|
|
883
|
+
/** Your default TLP 2.0 marking for NEW enrichments, as two independent values —
|
|
884
|
+
* `AMBER` for either one you have not set. The Artifact Enricher page's Settings
|
|
885
|
+
* button edits the same two values. */
|
|
886
|
+
async getEnricherSettings() {
|
|
887
|
+
const resp = await this.request("GET", "/artifact-manager/settings");
|
|
888
|
+
return await resp.json();
|
|
889
|
+
}
|
|
890
|
+
/** Set the default marking a NEW enrichment starts from. Pass one or both — only what
|
|
891
|
+
* you pass is written, and the stored pair is returned. An invalid value throws
|
|
892
|
+
* before any request; passing neither throws too.
|
|
893
|
+
*
|
|
894
|
+
* The value is a BASELINE, not an override: an enrichment saved afterwards is marked
|
|
895
|
+
* with the most restrictive of the setting and the artifacts it was built from, so a
|
|
896
|
+
* more restrictive source still wins. An explicit `tlp` on `client.enricher.enrich(...)`
|
|
897
|
+
* overrides `artifact_tlp` for that run's exports. */
|
|
898
|
+
async setEnricherSettings(options) {
|
|
899
|
+
const artifactTlp = validateTlp(options.artifactTlp);
|
|
900
|
+
const inventoryTlp = validateTlp(options.inventoryTlp);
|
|
901
|
+
const json = {};
|
|
902
|
+
if (artifactTlp !== void 0) json.artifact_tlp = artifactTlp;
|
|
903
|
+
if (inventoryTlp !== void 0) json.inventory_tlp = inventoryTlp;
|
|
904
|
+
if (!Object.keys(json).length) {
|
|
905
|
+
throw new RangeError(
|
|
906
|
+
"setEnricherSettings needs artifactTlp and/or inventoryTlp"
|
|
907
|
+
);
|
|
908
|
+
}
|
|
909
|
+
const resp = await this.request("PUT", "/artifact-manager/settings", {
|
|
910
|
+
json
|
|
911
|
+
});
|
|
912
|
+
return await resp.json();
|
|
913
|
+
}
|
|
677
914
|
};
|
|
678
915
|
|
|
679
916
|
// src/_poll.ts
|
|
@@ -690,8 +927,8 @@ async function beforeDeadline(operation, remaining, enrichmentId) {
|
|
|
690
927
|
if (remaining <= 0) throw timeoutError(enrichmentId);
|
|
691
928
|
let cancelDeadline = () => {
|
|
692
929
|
};
|
|
693
|
-
const deadline = new Promise((
|
|
694
|
-
const timer = setTimeout(() =>
|
|
930
|
+
const deadline = new Promise((resolve2) => {
|
|
931
|
+
const timer = setTimeout(() => resolve2(TIMED_OUT), remaining);
|
|
695
932
|
cancelDeadline = () => clearTimeout(timer);
|
|
696
933
|
});
|
|
697
934
|
void Promise.resolve(operation).catch(() => void 0);
|
|
@@ -746,7 +983,7 @@ async function pollUntilDone(request, enrichmentId, statusPath, opts) {
|
|
|
746
983
|
remaining = remainingMs(deadline);
|
|
747
984
|
await beforeDeadline(
|
|
748
985
|
new Promise(
|
|
749
|
-
(
|
|
986
|
+
(resolve2) => setTimeout(resolve2, Math.min(opts.pollIntervalMs, remaining))
|
|
750
987
|
),
|
|
751
988
|
remaining,
|
|
752
989
|
enrichmentId
|
|
@@ -781,12 +1018,20 @@ function assembleBriefing(report, meta) {
|
|
|
781
1018
|
const actions = [...seen.values()].sort(
|
|
782
1019
|
(a, b) => (a.kev ? 0 : 1) - (b.kev ? 0 : 1) || (b.weaponization_score || 0) - (a.weaponization_score || 0)
|
|
783
1020
|
).slice(0, 10);
|
|
1021
|
+
const unverifiedAssets = assets.filter(
|
|
1022
|
+
(asset) => asset.status !== "error" && (asset.match === "none" || asset.match === "cpe_fuzzy")
|
|
1023
|
+
).map((asset) => ({
|
|
1024
|
+
product: asset.product || asset.name || "\u2014",
|
|
1025
|
+
versions: (Array.isArray(asset.versions) ? asset.versions : []).filter(Boolean).slice(0, 1),
|
|
1026
|
+
match_detail: asset.match_detail ?? null
|
|
1027
|
+
}));
|
|
784
1028
|
const out = {
|
|
785
1029
|
format: meta.format,
|
|
786
1030
|
parsed_count: meta.parsedCount,
|
|
787
1031
|
enrichment_id: meta.enrichmentId,
|
|
788
1032
|
report,
|
|
789
|
-
recommended_actions: actions
|
|
1033
|
+
recommended_actions: actions,
|
|
1034
|
+
unverified_assets: unverifiedAssets
|
|
790
1035
|
};
|
|
791
1036
|
if (meta.truncated) out.truncated = meta.truncated;
|
|
792
1037
|
return out;
|
|
@@ -820,6 +1065,29 @@ function wireContent(content) {
|
|
|
820
1065
|
function wireSources(sources) {
|
|
821
1066
|
return sources.map((s) => ({ ...s, content: wireContent(s.content) }));
|
|
822
1067
|
}
|
|
1068
|
+
function historyParams(opts) {
|
|
1069
|
+
const types = Array.isArray(opts.types) ? opts.types.join(",") : opts.types;
|
|
1070
|
+
const raw = {
|
|
1071
|
+
type: types,
|
|
1072
|
+
q: opts.q,
|
|
1073
|
+
since: opts.since,
|
|
1074
|
+
until: opts.until,
|
|
1075
|
+
actor: opts.actor,
|
|
1076
|
+
limit: opts.limit,
|
|
1077
|
+
cursor: opts.cursor
|
|
1078
|
+
};
|
|
1079
|
+
const params = {};
|
|
1080
|
+
for (const [k, v] of Object.entries(raw))
|
|
1081
|
+
if (v !== void 0) params[k] = String(v);
|
|
1082
|
+
return params;
|
|
1083
|
+
}
|
|
1084
|
+
function manifestVexOverlay(manifest) {
|
|
1085
|
+
const overlay = manifest.vex_overlay;
|
|
1086
|
+
if (!overlay || typeof overlay !== "object" || !("document" in overlay))
|
|
1087
|
+
return void 0;
|
|
1088
|
+
const doc = overlay.document;
|
|
1089
|
+
return typeof doc === "string" && doc.trim() ? doc : void 0;
|
|
1090
|
+
}
|
|
823
1091
|
function inventoryBody(inventoryName, o) {
|
|
824
1092
|
const body = { inventory_name: inventoryName };
|
|
825
1093
|
if (o.description !== void 0) body.description = o.description;
|
|
@@ -932,14 +1200,37 @@ var InventoryManagerApi = class {
|
|
|
932
1200
|
);
|
|
933
1201
|
return (await resp.json()).matrix;
|
|
934
1202
|
}
|
|
1203
|
+
/**
|
|
1204
|
+
* One page of an inventory's change history, newest first. Covers asset, attachment, TLP, rename,
|
|
1205
|
+
* settings and VEX changes, saved enrichments and generated reports. Exports and Copy for AI are
|
|
1206
|
+
* not logged. Pass `cursor` from a previous page's `next_cursor` to continue.
|
|
1207
|
+
*/
|
|
1208
|
+
async getHistory(inventoryId, opts = {}) {
|
|
1209
|
+
const resp = await this.request(
|
|
1210
|
+
"GET",
|
|
1211
|
+
`/inventory-manager/inventories/${pathSegment(inventoryId)}/history`,
|
|
1212
|
+
{ params: historyParams(opts) }
|
|
1213
|
+
);
|
|
1214
|
+
return await resp.json();
|
|
1215
|
+
}
|
|
1216
|
+
/** Yield every history item newest first, following `next_cursor` across pages until exhausted. */
|
|
1217
|
+
async *iterHistory(inventoryId, opts = {}) {
|
|
1218
|
+
let cursor;
|
|
1219
|
+
do {
|
|
1220
|
+
const page = await this.getHistory(inventoryId, { ...opts, cursor });
|
|
1221
|
+
yield* page.items;
|
|
1222
|
+
cursor = page.next_cursor ?? void 0;
|
|
1223
|
+
} while (cursor);
|
|
1224
|
+
}
|
|
935
1225
|
/**
|
|
936
1226
|
* Create an Inventory Manager inventory (a continuously-monitored context window).
|
|
937
1227
|
*
|
|
938
1228
|
* @param inventoryName The inventory's display name.
|
|
939
1229
|
* @param options `description`, `items` (asset inventory — each `{ product, vendor?, versions?,
|
|
940
1230
|
* ecosystem?, category?, criticality?, notes? }`), `monitoring` (always full depth — no fast/lite
|
|
941
|
-
* mode), `linkedArtifactIds
|
|
942
|
-
* @returns `{ id, item_count }
|
|
1231
|
+
* mode), `linkedArtifactIds` (each takes the new inventory's own TLP 2.0 marking).
|
|
1232
|
+
* @returns `{ id, item_count }`, plus `attachment_tlp` / `attachment_tlp_ids` when
|
|
1233
|
+
* `linkedArtifactIds` were passed (the marking carried onto them).
|
|
943
1234
|
*/
|
|
944
1235
|
async createInventory(inventoryName, options = {}) {
|
|
945
1236
|
const resp = await this.request("POST", "/inventory-manager/inventories", {
|
|
@@ -951,7 +1242,10 @@ var InventoryManagerApi = class {
|
|
|
951
1242
|
* Update an inventory's definition (name, description, inventory, monitoring, attachments).
|
|
952
1243
|
* This is a **partial merge** (PATCH): only the fields you pass change — omitted fields are PRESERVED,
|
|
953
1244
|
* including the asset-group metadata and daily-report config this method doesn't expose. `inventoryName`
|
|
954
|
-
* is still required by the API.
|
|
1245
|
+
* is still required by the API. Any artifact newly added through `linkedArtifactIds` takes the
|
|
1246
|
+
* inventory's own TLP 2.0 marking (already-attached artifacts are left alone). Resolves
|
|
1247
|
+
* `{ id, item_count }`, plus `attachment_tlp` / `attachment_tlp_ids` (the marking carried onto newly
|
|
1248
|
+
* attached artifacts).
|
|
955
1249
|
*/
|
|
956
1250
|
async updateInventory(inventoryId, options) {
|
|
957
1251
|
const resp = await this.request(
|
|
@@ -966,10 +1260,14 @@ var InventoryManagerApi = class {
|
|
|
966
1260
|
*
|
|
967
1261
|
* @param options `format` — one of `json` (asset JSON), `sbom` (CycloneDX / SPDX SBOM), `csv`,
|
|
968
1262
|
* `nmap` (nmap `-sV` XML), `list` (CPE / purl list), `grype`, `trivy` (SCA JSON), `depcheck`
|
|
969
|
-
* (OWASP Dependency-Check JSON), `nessus` (`.nessus` XML), `gvm` (OpenVAS / Greenbone XML)
|
|
970
|
-
* `
|
|
971
|
-
*
|
|
972
|
-
*
|
|
1263
|
+
* (OWASP Dependency-Check JSON), `nessus` (`.nessus` XML), `gvm` (OpenVAS / Greenbone XML),
|
|
1264
|
+
* `vex` (a VEX suppression overlay — OpenVEX 0.2.0 / CSAF 2.0 VEX JSON; attaches to the
|
|
1265
|
+
* inventory named by `inventoryId`, or creates a bare inventory holding it — imports NO assets);
|
|
1266
|
+
* `content` — the file's text (or `Uint8Array` for the binary `xlsx`); optional
|
|
1267
|
+
* `inventoryName` / `description` (override anything the file carries).
|
|
1268
|
+
* @returns `{ id, item_count, imported, format, truncated?, dropped? }` — `dropped` (SBOM imports
|
|
1269
|
+
* only) counts dependency edges the parser could not retain (#334). `format:'vex'` returns
|
|
1270
|
+
* `{ id, imported:0, format:'vex', statements }` instead.
|
|
973
1271
|
*/
|
|
974
1272
|
async importInventory(options) {
|
|
975
1273
|
const body = {
|
|
@@ -1001,7 +1299,7 @@ var InventoryManagerApi = class {
|
|
|
1001
1299
|
* override. A binary `xlsx` source can't be sniffed, so it needs `format: "xlsx"` + `Uint8Array` content
|
|
1002
1300
|
* (base64-encoded on the wire). A source that fails to parse is ISOLATED (it appears in `per_source` with
|
|
1003
1301
|
* its `error`, contributing nothing — never failing the whole call).
|
|
1004
|
-
* @returns `{ items, count, asset_groups, truncated?, per_source: [{ label, contributed, truncated?, error? }] }`.
|
|
1302
|
+
* @returns `{ items, count, asset_groups, truncated?, dropped?, per_source: [{ label, contributed, truncated?, dropped?, error? }] }`.
|
|
1005
1303
|
*/
|
|
1006
1304
|
async parseMulti(sources) {
|
|
1007
1305
|
const resp = await this.request(
|
|
@@ -1067,12 +1365,16 @@ var InventoryManagerApi = class {
|
|
|
1067
1365
|
* Apply a recommended upgrade — set the matched asset's version to the published fix the Inventory
|
|
1068
1366
|
* Enricher surfaced (`recommended_fix_version` / `recommended_fix_version_kev`), PRESERVING everything
|
|
1069
1367
|
* else on the inventory. Match is by `product` (case-insensitive; `vendor` disambiguates duplicate
|
|
1070
|
-
* product names).
|
|
1071
|
-
*
|
|
1368
|
+
* product names). This rewrites **every** asset carrying that product — pass `group` to scope the fix
|
|
1369
|
+
* to one host/asset group (`group` is the asset's own grouping, which host-derived imports set per
|
|
1370
|
+
* host). Writes the inventory only — it does NOT re-enrich (the next enrichment / daily monitor
|
|
1371
|
+
* confirms the CVEs cleared). Resolves `{ id, product, version, applied, item_count }` (404 when no
|
|
1372
|
+
* asset matches, or none matches within `group`).
|
|
1072
1373
|
*/
|
|
1073
|
-
async applyAssetFix(inventoryId, product, version, vendor) {
|
|
1374
|
+
async applyAssetFix(inventoryId, product, version, vendor, group) {
|
|
1074
1375
|
const json = { product, version };
|
|
1075
1376
|
if (vendor !== void 0) json.vendor = vendor;
|
|
1377
|
+
if (group !== void 0) json.group = group;
|
|
1076
1378
|
const resp = await this.request(
|
|
1077
1379
|
"PATCH",
|
|
1078
1380
|
`/inventory-manager/inventories/${pathSegment(inventoryId)}/asset-version`,
|
|
@@ -1095,15 +1397,22 @@ var InventoryManagerApi = class {
|
|
|
1095
1397
|
*
|
|
1096
1398
|
* @param inventoryId The inventory id.
|
|
1097
1399
|
* @param format `json` / `csv` / `list` (CPE/purl) / `cyclonedx` / `spdx` (3.0.1) / `spdx2` (SPDX 2.3)
|
|
1098
|
-
* / `workbook` (binary Excel .xlsx). `json` / `csv` / `list` round-trip
|
|
1099
|
-
* {@link importInventory}. Defaults to `json`.
|
|
1100
|
-
|
|
1101
|
-
|
|
1400
|
+
* / `workbook` (binary Excel .xlsx) / `all` (.zip of every format). `json` / `csv` / `list` round-trip
|
|
1401
|
+
* back through {@link importInventory}. Defaults to `json`.
|
|
1402
|
+
* @param options.tlp The TLP 2.0 marking written into the asset-inventory formats that have a slot
|
|
1403
|
+
* (`cyclonedx` / `spdx` / `spdx2` / `workbook`; `CLEAR` / `GREEN` / `AMBER` / `AMBER+STRICT` / `RED`),
|
|
1404
|
+
* overriding the inventory's stored TLP; omit it to stamp the inventory's own stored TLP.
|
|
1405
|
+
* `json` / `csv` / `list` have no marking slot and ignore it. An invalid value
|
|
1406
|
+
* throws a `RangeError` before any request.
|
|
1407
|
+
*/
|
|
1408
|
+
async exportInventory(inventoryId, format = "json", options = {}) {
|
|
1409
|
+
const tlp = validateTlp(options.tlp);
|
|
1102
1410
|
const resp = await this.request(
|
|
1103
1411
|
"GET",
|
|
1104
|
-
`/inventory-manager/inventories/${pathSegment(inventoryId)}/export/${pathSegment(format)}
|
|
1412
|
+
`/inventory-manager/inventories/${pathSegment(inventoryId)}/export/${pathSegment(format)}`,
|
|
1413
|
+
tlp === void 0 ? {} : { params: { tlp } }
|
|
1105
1414
|
);
|
|
1106
|
-
return format === "workbook" ? new Uint8Array(await resp.arrayBuffer()) : await resp.text();
|
|
1415
|
+
return format === "workbook" || format === "all" ? new Uint8Array(await resp.arrayBuffer()) : await resp.text();
|
|
1107
1416
|
}
|
|
1108
1417
|
/** Delete an inventory. Resolves `true` on success (404 throws). */
|
|
1109
1418
|
async deleteInventory(inventoryId) {
|
|
@@ -1113,7 +1422,9 @@ var InventoryManagerApi = class {
|
|
|
1113
1422
|
);
|
|
1114
1423
|
return Boolean((await resp.json()).deleted);
|
|
1115
1424
|
}
|
|
1116
|
-
/** Link an existing artifact to an inventory.
|
|
1425
|
+
/** Link an existing artifact to an inventory. The newly attached artifact takes the INVENTORY's own
|
|
1426
|
+
* TLP 2.0 marking (it can raise or lower the artifact's marking). Resolves to
|
|
1427
|
+
* `{ ok, linked, already, attachment_tlp, attachment_tlp_ids }`. */
|
|
1117
1428
|
async attachToInventory(inventoryId, artifactId) {
|
|
1118
1429
|
const resp = await this.request(
|
|
1119
1430
|
"POST",
|
|
@@ -1139,7 +1450,8 @@ var InventoryManagerApi = class {
|
|
|
1139
1450
|
* REPLACE an inventory's attached reference artifacts in one call (the bulk twin of
|
|
1140
1451
|
* {@link attachToInventory}), PRESERVING its inventory / monitoring / alert-prefs. Only attachable
|
|
1141
1452
|
* kinds (`input` / `enrichment` / `report`) are kept; inventories and inventory enrichments are skipped. Deduped +
|
|
1142
|
-
* capped at 100.
|
|
1453
|
+
* capped at 100. Each newly attached artifact takes the inventory's own TLP 2.0 marking. Resolves
|
|
1454
|
+
* `{ id, linked_count, attached, skipped, mode, attachment_tlp, attachment_tlp_ids }`.
|
|
1143
1455
|
*/
|
|
1144
1456
|
async setAttachments(inventoryId, artifactIds) {
|
|
1145
1457
|
const resp = await this.request(
|
|
@@ -1152,7 +1464,8 @@ var InventoryManagerApi = class {
|
|
|
1152
1464
|
return await resp.json();
|
|
1153
1465
|
}
|
|
1154
1466
|
/** APPEND several artifacts to an inventory's attachments in one call (bulk {@link attachToInventory});
|
|
1155
|
-
* same filtering/cap/return as {@link setAttachments}
|
|
1467
|
+
* same filtering/cap/return as {@link setAttachments} — including the re-marking of the newly attached
|
|
1468
|
+
* artifacts to the inventory's own TLP 2.0 marking. */
|
|
1156
1469
|
async addAttachments(inventoryId, artifactIds) {
|
|
1157
1470
|
const resp = await this.request(
|
|
1158
1471
|
"PATCH",
|
|
@@ -1228,7 +1541,14 @@ var InventoryManagerApi = class {
|
|
|
1228
1541
|
* The enrichment submit is enrichment compute and **counts toward your usage** (it rides your key to
|
|
1229
1542
|
* `/v1/inventory-enrich`); reading the inventory and polling do not.
|
|
1230
1543
|
*
|
|
1231
|
-
*
|
|
1544
|
+
* The inventory's attached **VEX suppression overlay** (imported with `format: 'vex'`) always rides along
|
|
1545
|
+
* as the engine's `vex_overlay`, so findings the VEX marks `not_affected`/`fixed` come back
|
|
1546
|
+
* `suppressed_by_vex` (retained + justification, excluded from the actionable counts) instead of being
|
|
1547
|
+
* re-reported. Nothing to pass — it is read from the inventory manifest.
|
|
1548
|
+
*
|
|
1549
|
+
* Resolves to `{ enrichment_id, report }`; `report` is the InventoryEnrichmentResult (per-asset CVEs with
|
|
1550
|
+
* CVSS vectors, EPSS percentile, NIST LEV (`lev`), KEV detail, Metasploit / Nuclei, `provenance`; plus `technique_catalog` and
|
|
1551
|
+
* `mitigation_catalog`). If the inventory's inventory is empty this short-circuits and
|
|
1232
1552
|
* resolves to `{ enrichment_id: null, empty: true }` without submitting. Throws `UnexpectedStatus` on a
|
|
1233
1553
|
* non-2xx (or enrichment error), or `Error` if the enrichment doesn't finish within `timeoutMs`.
|
|
1234
1554
|
*/
|
|
@@ -1241,13 +1561,13 @@ var InventoryManagerApi = class {
|
|
|
1241
1561
|
const items = Array.isArray(manifest.inventory) ? manifest.inventory : [];
|
|
1242
1562
|
if (items.length === 0) return { enrichment_id: null, empty: true };
|
|
1243
1563
|
const doAttach = options.enrichAttachments ?? manifest.enrich_attachments === true;
|
|
1244
|
-
let
|
|
1564
|
+
let attachmentsTexts = [];
|
|
1245
1565
|
let attachmentsFiles;
|
|
1246
1566
|
let attachmentOmissions = [];
|
|
1247
1567
|
if (doAttach) {
|
|
1248
1568
|
const ids = (Array.isArray(manifest.attached) ? manifest.attached : []).map((a) => a?.id).filter((x) => typeof x === "string");
|
|
1249
1569
|
const resolved = await this.resolveAttachments(ids);
|
|
1250
|
-
|
|
1570
|
+
attachmentsTexts = resolved.texts;
|
|
1251
1571
|
if (resolved.files.length) attachmentsFiles = resolved.files;
|
|
1252
1572
|
attachmentOmissions = resolved.omissions;
|
|
1253
1573
|
if (options.strictAttachments && attachmentOmissions.length) {
|
|
@@ -1258,8 +1578,9 @@ var InventoryManagerApi = class {
|
|
|
1258
1578
|
}
|
|
1259
1579
|
const result = await this.enrichItems(items, {
|
|
1260
1580
|
...options,
|
|
1261
|
-
|
|
1262
|
-
attachmentsFiles
|
|
1581
|
+
attachmentsTexts,
|
|
1582
|
+
attachmentsFiles,
|
|
1583
|
+
vexOverlay: manifestVexOverlay(manifest)
|
|
1263
1584
|
});
|
|
1264
1585
|
if (doAttach) result.attachment_omissions = attachmentOmissions;
|
|
1265
1586
|
if (options.save && result.enrichment_id) {
|
|
@@ -1270,11 +1591,15 @@ var InventoryManagerApi = class {
|
|
|
1270
1591
|
}
|
|
1271
1592
|
return result;
|
|
1272
1593
|
}
|
|
1273
|
-
/** Fetch the inventory's attached artifacts (≤20) and split them for the engine
|
|
1274
|
-
*
|
|
1275
|
-
*
|
|
1594
|
+
/** Fetch the inventory's attached artifacts (≤20) and split them for the engine: TEXT artifacts become
|
|
1595
|
+
* one `texts` entry each, carrying the id and name of the artifact they came from, and BINARY ones
|
|
1596
|
+
* (`X-Artifact-Format: file`) become raw `files` entries that name their source artifact too.
|
|
1597
|
+
* Attribution is per artifact rather than a whole-run id list — the id is known for the exact block
|
|
1598
|
+
* fetched, so nothing has to be inferred from the text later. Resolution is permissive: every skipped
|
|
1599
|
+
* attachment is returned in `omissions`; callers that need complete evidence should use
|
|
1600
|
+
* `enrichInventory({ strictAttachments: true })`. */
|
|
1276
1601
|
async resolveAttachments(attachmentIds) {
|
|
1277
|
-
const
|
|
1602
|
+
const texts = [];
|
|
1278
1603
|
const files = [];
|
|
1279
1604
|
const omissions = attachmentIds.slice(20).map((attachmentId) => ({
|
|
1280
1605
|
attachment_id: attachmentId,
|
|
@@ -1303,7 +1628,11 @@ var InventoryManagerApi = class {
|
|
|
1303
1628
|
}
|
|
1304
1629
|
}
|
|
1305
1630
|
if (resp.headers.get("X-Artifact-Format") === "file") {
|
|
1306
|
-
files.push({
|
|
1631
|
+
files.push({
|
|
1632
|
+
filename: name,
|
|
1633
|
+
content_b64: content,
|
|
1634
|
+
source_artifact_id: aid
|
|
1635
|
+
});
|
|
1307
1636
|
continue;
|
|
1308
1637
|
}
|
|
1309
1638
|
if (total >= 5e5) {
|
|
@@ -1314,8 +1643,11 @@ var InventoryManagerApi = class {
|
|
|
1314
1643
|
continue;
|
|
1315
1644
|
}
|
|
1316
1645
|
const chunk = content.slice(0, Math.min(8e4, 5e5 - total));
|
|
1317
|
-
|
|
1318
|
-
|
|
1646
|
+
texts.push({
|
|
1647
|
+
text: chunk,
|
|
1648
|
+
source_artifact_id: aid,
|
|
1649
|
+
filename: name
|
|
1650
|
+
});
|
|
1319
1651
|
total += chunk.length;
|
|
1320
1652
|
} catch (error) {
|
|
1321
1653
|
omissions.push({
|
|
@@ -1324,8 +1656,7 @@ ${chunk}`);
|
|
|
1324
1656
|
});
|
|
1325
1657
|
}
|
|
1326
1658
|
}
|
|
1327
|
-
|
|
1328
|
-
return { text: text.trim() ? text : void 0, files, omissions };
|
|
1659
|
+
return { texts, files, omissions };
|
|
1329
1660
|
}
|
|
1330
1661
|
/**
|
|
1331
1662
|
* Persist a COMPLETED inventory enrichment into this inventory's saved history, by its engine
|
|
@@ -1359,8 +1690,14 @@ ${chunk}`);
|
|
|
1359
1690
|
if (options.include) body.include = options.include;
|
|
1360
1691
|
if (options.attachmentsText)
|
|
1361
1692
|
body.attachments_text = options.attachmentsText;
|
|
1693
|
+
if (options.attachmentsTexts?.length)
|
|
1694
|
+
body.attachments_texts = options.attachmentsTexts;
|
|
1695
|
+
if (options.attachedArtifactIds?.length)
|
|
1696
|
+
body.attached_artifact_ids = options.attachedArtifactIds;
|
|
1362
1697
|
if (options.attachmentsFiles?.length)
|
|
1363
1698
|
body.attachments_files = options.attachmentsFiles;
|
|
1699
|
+
if (options.vexOverlay)
|
|
1700
|
+
body.vex_overlay = { format: "vex", content: options.vexOverlay };
|
|
1364
1701
|
const submit = await (await this.request("POST", "/v1/inventory-enrich", { json: body })).json();
|
|
1365
1702
|
const enrichmentId = submit.enrichment_id;
|
|
1366
1703
|
const job = await pollUntilDone(
|
|
@@ -1376,9 +1713,11 @@ ${chunk}`);
|
|
|
1376
1713
|
return { enrichment_id: enrichmentId, report: job.result };
|
|
1377
1714
|
}
|
|
1378
1715
|
/** Parse a scan / inventory FILE into canonical asset items WITHOUT saving anything (the parse-only twin
|
|
1379
|
-
* of `importInventory`). You PICK the `format` — one of json/sbom/csv/nmap/list/grype/trivy/depcheck/nessus/gvm/xlsx
|
|
1380
|
-
* (no auto-detect; pass a `Uint8Array` for the binary `xlsx`
|
|
1381
|
-
* `{
|
|
1716
|
+
* of `importInventory`). You PICK the `format` — one of json/sbom/csv/nmap/list/grype/trivy/depcheck/nessus/gvm/xlsx/vex
|
|
1717
|
+
* (no auto-detect; pass a `Uint8Array` for the binary `xlsx`; `vex` is a VEX suppression overlay
|
|
1718
|
+
* parse — OpenVEX/CSAF — returning `{ items: [], vex_overlay }`). Resolves
|
|
1719
|
+
* `{ format, items, count, inventory_name?, truncated?, dropped? }` (`dropped` — SBOM only — is the
|
|
1720
|
+
* dependency edges not retained, #334). Usage-exempt — the building block for `ingestScan`. */
|
|
1382
1721
|
async parseScan(content, format) {
|
|
1383
1722
|
const resp = await this.request(
|
|
1384
1723
|
"POST",
|
|
@@ -1389,10 +1728,11 @@ ${chunk}`);
|
|
|
1389
1728
|
}
|
|
1390
1729
|
/** Scan → briefing in one call: parse the scan FILE (`parseScan`), enrich the discovered assets against
|
|
1391
1730
|
* the `/v1/inventory-enrich` ranking engine, and assemble a structured briefing. `format` is one of
|
|
1392
|
-
* json/sbom/csv/nmap/list/grype/trivy/depcheck/nessus/gvm/xlsx. The parse is usage-exempt; the enrichment **submit counts
|
|
1731
|
+
* json/sbom/csv/nmap/list/grype/trivy/depcheck/nessus/gvm/xlsx/vex. The parse is usage-exempt; the enrichment **submit counts
|
|
1393
1732
|
* toward usage** (one `/v1/inventory-enrich` request). Resolves
|
|
1394
|
-
* `{ format, parsed_count, truncated?, enrichment_id, report, recommended_actions }`
|
|
1395
|
-
* engine's KEV-first-ranked findings + rollup
|
|
1733
|
+
* `{ format, parsed_count, truncated?, enrichment_id, report, recommended_actions, unverified_assets }`
|
|
1734
|
+
* (report = the engine's KEV-first-ranked findings + rollup; unverified_assets names the assets whose
|
|
1735
|
+
* identity never resolved). An empty parse short-circuits to
|
|
1396
1736
|
* `{ format, parsed_count: 0, enrichment_id: null, empty: true }`. */
|
|
1397
1737
|
async ingestScan(content, format, options = {}) {
|
|
1398
1738
|
return ingestScan(this, content, format, options);
|
|
@@ -1446,8 +1786,13 @@ var EnricherApi = class {
|
|
|
1446
1786
|
/**
|
|
1447
1787
|
* Run an artifact enrichment end-to-end against the /v1 engine: submit → poll → return the report.
|
|
1448
1788
|
*
|
|
1449
|
-
* Stages pasted `text` + base64 `files` (`[{ filename, content_b64 }]`), submits
|
|
1450
|
-
* `/v1/artifact-enrich`, polls the job until done, and resolves to the enrichment report.
|
|
1789
|
+
* Stages pasted `text` + base64 `files` (`[{ filename, content_b64, source_artifact_id? }]`), submits
|
|
1790
|
+
* to `/v1/artifact-enrich`, polls the job until done, and resolves to the enrichment report.
|
|
1791
|
+
*
|
|
1792
|
+
* `texts` is the per-artifact form of `text` (`[{ text, source_artifact_id?, filename? }]`) — use it
|
|
1793
|
+
* when the blocks came from several stored artifacts, so the report attributes each reference to the
|
|
1794
|
+
* artifact it appeared in. `attachedArtifactIds` names the artifacts an opaque `text` blob came from;
|
|
1795
|
+
* attribution is never inferred from the text itself.
|
|
1451
1796
|
*
|
|
1452
1797
|
* `stakeholder` is the optional SSVC stakeholder context applied to every reference when `include`
|
|
1453
1798
|
* contains `"ssvc"` (`{ method, exposure, human_impact, mission_prevalence, public_wellbeing_impact }`;
|
|
@@ -1455,7 +1800,10 @@ var EnricherApi = class {
|
|
|
1455
1800
|
*
|
|
1456
1801
|
* Counts toward your API usage (it's `/v1/artifact-enrich` compute). Throws `UnexpectedStatus` on a
|
|
1457
1802
|
* non-2xx (or enrichment error), or `Error` if the enrichment doesn't finish within `timeoutMs`.
|
|
1458
|
-
* Resolves to `{ enrichment_id, report }`.
|
|
1803
|
+
* Resolves to `{ enrichment_id, report }`. `report` is the ArtifactEnrichmentReport (`report.meta.schema_version`):
|
|
1804
|
+
* each reference carries its full record — CVSS vectors, EPSS percentile, NIST LEV (`lev`), CWEs, the CISA KEV record,
|
|
1805
|
+
* Metasploit / Nuclei, OSV fixed versions, ATT&CK v18 detection data, knowledge-base profiles, threat actors
|
|
1806
|
+
* targeting a country or sector, and `provenance`.
|
|
1459
1807
|
*/
|
|
1460
1808
|
async enrich(options = {}) {
|
|
1461
1809
|
validatePollOptions(
|
|
@@ -1464,10 +1812,15 @@ var EnricherApi = class {
|
|
|
1464
1812
|
);
|
|
1465
1813
|
const body = {};
|
|
1466
1814
|
if (options.text) body.text = options.text;
|
|
1815
|
+
if (options.texts) body.texts = options.texts;
|
|
1467
1816
|
if (options.files) body.files = options.files;
|
|
1817
|
+
if (options.attachedArtifactIds)
|
|
1818
|
+
body.attached_artifact_ids = options.attachedArtifactIds;
|
|
1468
1819
|
if (options.formats) body.formats = options.formats;
|
|
1469
1820
|
if (options.include) body.include = options.include;
|
|
1470
1821
|
if (options.stakeholder) body.stakeholder = options.stakeholder;
|
|
1822
|
+
const tlp = validateTlp(options.tlp);
|
|
1823
|
+
if (tlp !== void 0) body.tlp = tlp;
|
|
1471
1824
|
const submit = await (await this.request("POST", "/v1/artifact-enrich", { json: body })).json();
|
|
1472
1825
|
const enrichmentId = submit.enrichment_id;
|
|
1473
1826
|
const job = await pollUntilDone(
|
|
@@ -1500,6 +1853,40 @@ var EnricherApi = class {
|
|
|
1500
1853
|
}
|
|
1501
1854
|
return result;
|
|
1502
1855
|
}
|
|
1856
|
+
/**
|
|
1857
|
+
* Run an Event Enrichment end-to-end against the /v1 engine: submit → poll → return the result.
|
|
1858
|
+
*
|
|
1859
|
+
* Submits a raw security event (a Defender XDR / Sentinel alert, a SIEM/EDR log line, any JSON or
|
|
1860
|
+
* text) to `/v1/event-enrich`, polls the job until done, and resolves to
|
|
1861
|
+
* `{ enrichment_id, result }` — where `result` is the EventEnrichmentResult (per-indicator
|
|
1862
|
+
* findings + the aggregate event threat assessment). CC extracts every indicator server-side.
|
|
1863
|
+
* Each CVE indicator carries `kev` and `weaponized` (a Metasploit module exists, which floors its
|
|
1864
|
+
* verdict at high); `threat_assessment` counts both as `kev_count` / `weaponized_count`.
|
|
1865
|
+
*
|
|
1866
|
+
* Counts toward your API usage (it's `/v1/event-enrich` compute). Throws `UnexpectedStatus` on a
|
|
1867
|
+
* non-2xx (or enrichment error), or `Error` if the enrichment doesn't finish within `timeoutMs`.
|
|
1868
|
+
*/
|
|
1869
|
+
async enrichEvent(options) {
|
|
1870
|
+
validatePollOptions(
|
|
1871
|
+
options.pollIntervalMs ?? 1500,
|
|
1872
|
+
options.timeoutMs ?? 12e5
|
|
1873
|
+
);
|
|
1874
|
+
const body = { event: options.event };
|
|
1875
|
+
if (options.eventId) body.event_id = options.eventId;
|
|
1876
|
+
const submit = await (await this.request("POST", "/v1/event-enrich", { json: body })).json();
|
|
1877
|
+
const enrichmentId = submit.enrichment_id;
|
|
1878
|
+
const job = await pollUntilDone(
|
|
1879
|
+
(m, p, timeoutMs) => this.request(m, p, { timeoutMs }),
|
|
1880
|
+
enrichmentId,
|
|
1881
|
+
`/v1/event-enrich/${pathSegment(enrichmentId)}`,
|
|
1882
|
+
{
|
|
1883
|
+
pollIntervalMs: options.pollIntervalMs ?? 1500,
|
|
1884
|
+
timeoutMs: options.timeoutMs ?? 12e5,
|
|
1885
|
+
onProgress: options.onProgress
|
|
1886
|
+
}
|
|
1887
|
+
);
|
|
1888
|
+
return { enrichment_id: enrichmentId, result: job.result };
|
|
1889
|
+
}
|
|
1503
1890
|
};
|
|
1504
1891
|
|
|
1505
1892
|
// src/retry.ts
|
|
@@ -1514,7 +1901,7 @@ var RETRY_MAX_DELAY = 8;
|
|
|
1514
1901
|
var RETRY_JITTER_RATIO = 0.25;
|
|
1515
1902
|
var RETRY_AFTER_MAX = 60;
|
|
1516
1903
|
var DEFAULT_MAX_RETRIES = 2;
|
|
1517
|
-
var defaultSleep = (seconds) => new Promise((
|
|
1904
|
+
var defaultSleep = (seconds) => new Promise((resolve2) => setTimeout(resolve2, seconds * 1e3));
|
|
1518
1905
|
function computeBackoff(attempt, rng = Math.random) {
|
|
1519
1906
|
const raw = RETRY_BASE_DELAY * 2 ** attempt;
|
|
1520
1907
|
const jitter = raw * RETRY_JITTER_RATIO * (rng() * 2 - 1);
|
|
@@ -1632,9 +2019,12 @@ var CrawlerClient = class {
|
|
|
1632
2019
|
"verifySsl=false is only supported in Node.js; this runtime cannot disable TLS verification per client."
|
|
1633
2020
|
);
|
|
1634
2021
|
}
|
|
1635
|
-
insecureDispatcher ??= import('undici').then(
|
|
1636
|
-
(
|
|
1637
|
-
|
|
2022
|
+
insecureDispatcher ??= import('undici').then(({ Agent }) => {
|
|
2023
|
+
console.warn(
|
|
2024
|
+
"Crimson Crawler: TLS certificate verification is disabled (verifySsl=false). Do not use in production."
|
|
2025
|
+
);
|
|
2026
|
+
return new Agent({ connect: { rejectUnauthorized: false } });
|
|
2027
|
+
});
|
|
1638
2028
|
const dispatcher = await insecureDispatcher;
|
|
1639
2029
|
const scopedInit = { ...init, dispatcher };
|
|
1640
2030
|
return globalThis.fetch(input, scopedInit);
|
|
@@ -1714,7 +2104,7 @@ var CrawlerClient = class {
|
|
|
1714
2104
|
this._enricher = new EnricherApi(this.baseUrl, apiKey, retryFetch);
|
|
1715
2105
|
this._aiReports = new AiReportsApi(this.baseUrl, apiKey, retryFetch);
|
|
1716
2106
|
}
|
|
1717
|
-
/** Underlying Hey API client, scoped to this instance. Use to call any of the
|
|
2107
|
+
/** Underlying Hey API client, scoped to this instance. Use to call any of the 37 `/v1` operations (31 synchronous + 6 async-engine) directly. */
|
|
1718
2108
|
get api() {
|
|
1719
2109
|
return this._client;
|
|
1720
2110
|
}
|
|
@@ -1732,6 +2122,8 @@ var CrawlerClient = class {
|
|
|
1732
2122
|
* artifacts + saved enrichment history) over the same key. Its own section at
|
|
1733
2123
|
* `/inventory-manager/inventories/*` (outside the `/v1` OpenAPI contract). **Usage-exempt** except
|
|
1734
2124
|
* `enrichInventory`'s submit, which is enrichment compute and counts toward your usage.
|
|
2125
|
+
* For full log sources, PoCs, Sigma rules, or D3FEND rows, call `enrichCveFull` with the CVE ID,
|
|
2126
|
+
* `techniques`, the base layer, and its `*_full` token.
|
|
1735
2127
|
*/
|
|
1736
2128
|
get inventoryManager() {
|
|
1737
2129
|
return this._inventoryManager;
|
|
@@ -1756,26 +2148,60 @@ var CrawlerClient = class {
|
|
|
1756
2148
|
/**
|
|
1757
2149
|
* Walk the full CVE → CWE → CAPEC → ATT&CK → TIE chain plus MISP/knowledge base/web.
|
|
1758
2150
|
*
|
|
2151
|
+
* Returns one page. OSV advisories are paged: while `osv_next_offset` is set, request the next
|
|
2152
|
+
* page with that offset and the response's `osv_snapshot_id`, or stream the whole walk with
|
|
2153
|
+
* {@link iterCveOsvPages}.
|
|
2154
|
+
*
|
|
1759
2155
|
* @param cveId CVE identifier (e.g. `CVE-2024-3400`).
|
|
1760
|
-
* @param include Override
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
2156
|
+
* @param include Override `CVE_FULL_WALK`, which includes stored permissive OSV and Android
|
|
2157
|
+
* bulletin data. Restricted or unknown-licence OSV records require `osv_restricted`, which the
|
|
2158
|
+
* cursor is bound to.
|
|
2159
|
+
* @param options `osvOffset` (from the previous page's `osv_next_offset`) and `osvSnapshotId`
|
|
2160
|
+
* (the previous page's `osv_snapshot_id`; required with a continuation). A continuation answers
|
|
2161
|
+
* 409 `snapshot_expired` when its snapshot is gone and 503 `snapshot_unavailable` when the store is down.
|
|
2162
|
+
*/
|
|
2163
|
+
async enrichCveFull(cveId, include = chunkTAMKRTM6_cjs.CVE_FULL_WALK, options = {}) {
|
|
2164
|
+
const result = await chunkASYQPVBW_cjs.enrichCve({
|
|
1764
2165
|
client: this._client,
|
|
1765
|
-
body: {
|
|
2166
|
+
body: {
|
|
2167
|
+
cve_id: cveId,
|
|
2168
|
+
include: [...include],
|
|
2169
|
+
...options.osvOffset !== void 0 && {
|
|
2170
|
+
osv_offset: options.osvOffset
|
|
2171
|
+
},
|
|
2172
|
+
...options.osvSnapshotId !== void 0 && {
|
|
2173
|
+
osv_snapshot_id: options.osvSnapshotId
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
1766
2176
|
});
|
|
1767
2177
|
return ensureOk(result);
|
|
1768
2178
|
}
|
|
1769
2179
|
/**
|
|
1770
|
-
*
|
|
2180
|
+
* Stream every OSV advisory page of one CVE without an aggregate buffer. The first page is the
|
|
2181
|
+
* complete enrichment; later pages repeat the request with the cursor and carry the next
|
|
2182
|
+
* `osv_advisories` slice. A changed or expired snapshot throws `UnexpectedStatus` (409
|
|
2183
|
+
* `snapshot_expired`) instead of restarting after a yield. The caller owns any collection bound;
|
|
2184
|
+
* `osv_advisories_total` is exact.
|
|
2185
|
+
*/
|
|
2186
|
+
async *iterCveOsvPages(cveId, include = chunkTAMKRTM6_cjs.CVE_FULL_WALK) {
|
|
2187
|
+
yield* iterOsvPages(
|
|
2188
|
+
(osvOffset, osvSnapshotId) => this.enrichCveFull(cveId, include, {
|
|
2189
|
+
osvOffset,
|
|
2190
|
+
...osvSnapshotId !== void 0 && { osvSnapshotId }
|
|
2191
|
+
})
|
|
2192
|
+
);
|
|
2193
|
+
}
|
|
2194
|
+
/**
|
|
2195
|
+
* Enrich an IOC against MISP, link to ATT&CK, and add knowledge base context.
|
|
1771
2196
|
*
|
|
1772
2197
|
* @param value Indicator value (hash, IP, domain, URL).
|
|
1773
2198
|
* @param iocType MISP-style attribute type — `ip-dst`, `ip-src`, `domain`,
|
|
1774
2199
|
* `hostname`, `md5`, `sha1`, `sha256`, `url`, etc. Defaults to `ip-dst`.
|
|
1775
|
-
* @param include Override
|
|
2200
|
+
* @param include Override `IOC_FULL_WALK`. `network_context` and `listed_on` are defaults;
|
|
2201
|
+
* `domain_context` and `hashlookup` remain explicit includes.
|
|
1776
2202
|
*/
|
|
1777
|
-
async enrichIocFull(value, iocType = "ip-dst", include =
|
|
1778
|
-
const result = await
|
|
2203
|
+
async enrichIocFull(value, iocType = "ip-dst", include = chunkTAMKRTM6_cjs.IOC_FULL_WALK) {
|
|
2204
|
+
const result = await chunkASYQPVBW_cjs.enrichIoc({
|
|
1779
2205
|
client: this._client,
|
|
1780
2206
|
body: { value, type: iocType, include: [...include] }
|
|
1781
2207
|
});
|
|
@@ -1784,29 +2210,45 @@ var CrawlerClient = class {
|
|
|
1784
2210
|
/**
|
|
1785
2211
|
* Walk CWE → CAPEC → ATT&CK with TIE predictions.
|
|
1786
2212
|
*
|
|
1787
|
-
* @param cweId CWE identifier (e.g. `CWE-79`).
|
|
1788
|
-
* @param
|
|
2213
|
+
* @param cweId CWE identifier (e.g. `CWE-79`). Supply this or `search`.
|
|
2214
|
+
* @param options Optional `search` keyword (discover weaknesses by name) and `include` override.
|
|
1789
2215
|
*/
|
|
1790
|
-
async enrichCweFull(cweId,
|
|
1791
|
-
const result = await
|
|
2216
|
+
async enrichCweFull(cweId = null, options = {}) {
|
|
2217
|
+
const result = await chunkASYQPVBW_cjs.enrichCwe({
|
|
1792
2218
|
client: this._client,
|
|
1793
|
-
body: {
|
|
2219
|
+
body: {
|
|
2220
|
+
cwe_id: cweId ?? void 0,
|
|
2221
|
+
search: options.search,
|
|
2222
|
+
include: [...options.include ?? chunkTAMKRTM6_cjs.CWE_FULL_WALK]
|
|
2223
|
+
}
|
|
1794
2224
|
});
|
|
1795
2225
|
return ensureOk(result);
|
|
1796
2226
|
}
|
|
1797
2227
|
/**
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
2228
|
+
* Enrich one or more ATT&CK techniques with TIE, adversary attribution,
|
|
2229
|
+
* and Navigator JSON.
|
|
2230
|
+
*
|
|
2231
|
+
* @param techniqueIds ATT&CK technique IDs (e.g. `["T1190", "T1059.001"]`). Omit it when
|
|
2232
|
+
* looking up by `assetId`.
|
|
2233
|
+
* @param framework ATT&CK matrix variant — `enterprise`, `ics`, or `mobile`.
|
|
2234
|
+
* @param include Override the default `TECHNIQUE_FULL` chain. `fraud` (opt-in) adds the MITRE
|
|
2235
|
+
* F3 fraud techniques whose borrowed ATT&CK ids resolve to each returned technique; the
|
|
2236
|
+
* other opt-ins are `fight` (FiGHT techniques by id), `lolbas` (facts-only binaries),
|
|
2237
|
+
* `sigma`, `lotl` (LOLDrivers plus the facts-only GTFOBins and HijackLibs rows mapped
|
|
2238
|
+
* onto the technique), `atomic_red_team` (Atomic Red Team tests: name, GUID, platforms,
|
|
2239
|
+
* executor and elevation flag, never a command body), `framework_mappings`, `asset_classes`, `log_sources` and
|
|
2240
|
+
* `analytic_details`.
|
|
2241
|
+
|
|
2242
|
+
* @param assetId ICS asset to look up from (e.g. `"A0002"`) — returns the techniques that
|
|
2243
|
+
* asset's classes target. Requires `framework: "ics"` and is mutually exclusive with
|
|
2244
|
+
* `techniqueIds`: it is a selector in its own right, not an added filter.
|
|
2245
|
+
*/
|
|
2246
|
+
async enrichTechniqueFull(techniqueIds, framework = "enterprise", include = chunkTAMKRTM6_cjs.TECHNIQUE_FULL, assetId) {
|
|
2247
|
+
const result = await chunkASYQPVBW_cjs.enrichTechnique({
|
|
1807
2248
|
client: this._client,
|
|
1808
2249
|
body: {
|
|
1809
|
-
technique_ids: techniqueIds,
|
|
2250
|
+
...techniqueIds !== void 0 && { technique_ids: techniqueIds },
|
|
2251
|
+
...assetId !== void 0 && { asset_id: assetId },
|
|
1810
2252
|
framework,
|
|
1811
2253
|
include: [...include]
|
|
1812
2254
|
}
|
|
@@ -1814,22 +2256,36 @@ var CrawlerClient = class {
|
|
|
1814
2256
|
return ensureOk(result);
|
|
1815
2257
|
}
|
|
1816
2258
|
/**
|
|
1817
|
-
*
|
|
2259
|
+
* Return one page of enriched CVEs for a product/version.
|
|
2260
|
+
* For full log sources, PoCs, Sigma rules, or D3FEND rows, call `enrichCveFull` with the CVE ID,
|
|
2261
|
+
* `techniques`, the base layer, and its `*_full` token.
|
|
1818
2262
|
*
|
|
1819
|
-
* @param product Product name (e.g. `"
|
|
1820
|
-
* @param options Optional
|
|
2263
|
+
* @param product Product name (e.g. `"http_server"`, `"nginx"`).
|
|
2264
|
+
* @param options Optional version, vendor, include, limit, and offset. The full preset defaults to 2 CVEs per page.
|
|
1821
2265
|
*/
|
|
1822
2266
|
async enrichProductFull(product, options = {}) {
|
|
1823
|
-
const result = await
|
|
2267
|
+
const result = await chunkASYQPVBW_cjs.enrichProduct({
|
|
1824
2268
|
client: this._client,
|
|
1825
2269
|
body: {
|
|
1826
2270
|
product,
|
|
1827
2271
|
...options.version !== void 0 && { version: options.version },
|
|
1828
2272
|
...options.vendor !== void 0 && { vendor: options.vendor },
|
|
1829
|
-
|
|
2273
|
+
limit: options.limit ?? 2,
|
|
2274
|
+
...options.offset !== void 0 && { offset: options.offset },
|
|
2275
|
+
...options.snapshotId !== void 0 && {
|
|
2276
|
+
snapshot_id: options.snapshotId
|
|
2277
|
+
},
|
|
2278
|
+
include: [...options.include ?? chunkTAMKRTM6_cjs.PRODUCT_FULL]
|
|
1830
2279
|
}
|
|
1831
2280
|
});
|
|
1832
|
-
return ensureOk(result);
|
|
2281
|
+
return expandCveContext(ensureOk(result));
|
|
2282
|
+
}
|
|
2283
|
+
async *iterProductCves(product, options = {}) {
|
|
2284
|
+
const pages = await collectSnapshotPages(
|
|
2285
|
+
(offset, snapshotId) => this.enrichProductFull(product, { ...options, offset, snapshotId }),
|
|
2286
|
+
(page) => page.cves_next_offset
|
|
2287
|
+
);
|
|
2288
|
+
yield* pages;
|
|
1833
2289
|
}
|
|
1834
2290
|
/**
|
|
1835
2291
|
* Enrich an open-source package — OSV.dev advisories + full CVE enrichment.
|
|
@@ -1844,16 +2300,48 @@ var CrawlerClient = class {
|
|
|
1844
2300
|
* @param options Optional `version` and `include` overrides.
|
|
1845
2301
|
*/
|
|
1846
2302
|
async enrichPackageFull(ecosystem, packageName, options = {}) {
|
|
1847
|
-
const result = await
|
|
2303
|
+
const result = await chunkASYQPVBW_cjs.enrichPackage({
|
|
1848
2304
|
client: this._client,
|
|
1849
2305
|
body: {
|
|
1850
2306
|
ecosystem,
|
|
1851
2307
|
package: packageName,
|
|
1852
2308
|
...options.version !== void 0 && { version: options.version },
|
|
1853
|
-
|
|
2309
|
+
limit: options.limit ?? 5,
|
|
2310
|
+
...options.offset !== void 0 && { offset: options.offset },
|
|
2311
|
+
...options.snapshotId !== void 0 && {
|
|
2312
|
+
snapshot_id: options.snapshotId
|
|
2313
|
+
},
|
|
2314
|
+
include: [...options.include ?? chunkTAMKRTM6_cjs.PACKAGE_FULL]
|
|
1854
2315
|
}
|
|
1855
2316
|
});
|
|
1856
|
-
return ensureOk(result);
|
|
2317
|
+
return expandCveContext(ensureOk(result));
|
|
2318
|
+
}
|
|
2319
|
+
async *iterPackageAdvisories(ecosystem, packageName, options = {}) {
|
|
2320
|
+
let offset = 0;
|
|
2321
|
+
let snapshotId;
|
|
2322
|
+
while (true) {
|
|
2323
|
+
const page = await this.enrichPackageFull(ecosystem, packageName, {
|
|
2324
|
+
...options,
|
|
2325
|
+
offset,
|
|
2326
|
+
snapshotId
|
|
2327
|
+
});
|
|
2328
|
+
if (page.errors?.some(
|
|
2329
|
+
(error) => error.service === "osv" && error.error === "stored_copy_unavailable"
|
|
2330
|
+
)) {
|
|
2331
|
+
throw new Error("stored_copy_unavailable");
|
|
2332
|
+
}
|
|
2333
|
+
if (snapshotId !== void 0 && page.snapshot_id !== snapshotId) {
|
|
2334
|
+
throw new Error("Enrichment returned a different snapshot identifier");
|
|
2335
|
+
}
|
|
2336
|
+
const nextOffset = page.next_offset;
|
|
2337
|
+
if (nextOffset != null && (!page.snapshot_id || !Number.isInteger(nextOffset) || nextOffset <= offset)) {
|
|
2338
|
+
throw new Error("Enrichment returned an invalid package continuation");
|
|
2339
|
+
}
|
|
2340
|
+
yield page;
|
|
2341
|
+
if (nextOffset == null) return;
|
|
2342
|
+
offset = nextOffset;
|
|
2343
|
+
snapshotId = page.snapshot_id ?? void 0;
|
|
2344
|
+
}
|
|
1857
2345
|
}
|
|
1858
2346
|
/**
|
|
1859
2347
|
* Keyword-search the ATT&CK knowledge base for matching techniques.
|
|
@@ -1866,7 +2354,7 @@ var CrawlerClient = class {
|
|
|
1866
2354
|
* @param options Optional `limit` (1-100, default 20).
|
|
1867
2355
|
*/
|
|
1868
2356
|
async searchTechniques(keyword, options = {}) {
|
|
1869
|
-
const result = await
|
|
2357
|
+
const result = await chunkASYQPVBW_cjs.searchCti({
|
|
1870
2358
|
client: this._client,
|
|
1871
2359
|
body: {
|
|
1872
2360
|
query: keyword,
|
|
@@ -1890,12 +2378,12 @@ var CrawlerClient = class {
|
|
|
1890
2378
|
* @param options Optional `search` keyword and `include` override (default `ATLAS_FULL`).
|
|
1891
2379
|
*/
|
|
1892
2380
|
async enrichAtlasFull(techniqueId, options = {}) {
|
|
1893
|
-
const result = await
|
|
2381
|
+
const result = await chunkASYQPVBW_cjs.enrichAtlas({
|
|
1894
2382
|
client: this._client,
|
|
1895
2383
|
body: {
|
|
1896
2384
|
...techniqueId !== void 0 && { technique_id: techniqueId },
|
|
1897
2385
|
...options.search !== void 0 && { search: options.search },
|
|
1898
|
-
include: [...options.include ??
|
|
2386
|
+
include: [...options.include ?? chunkTAMKRTM6_cjs.ATLAS_FULL]
|
|
1899
2387
|
}
|
|
1900
2388
|
});
|
|
1901
2389
|
return ensureOk(result);
|
|
@@ -1908,13 +2396,13 @@ var CrawlerClient = class {
|
|
|
1908
2396
|
* override (default `CAMPAIGN_FULL`).
|
|
1909
2397
|
*/
|
|
1910
2398
|
async enrichCampaignFull(campaignId, options = {}) {
|
|
1911
|
-
const result = await
|
|
2399
|
+
const result = await chunkASYQPVBW_cjs.enrichCampaign({
|
|
1912
2400
|
client: this._client,
|
|
1913
2401
|
body: {
|
|
1914
2402
|
...campaignId !== void 0 && { campaign_id: campaignId },
|
|
1915
2403
|
...options.search !== void 0 && { search: options.search },
|
|
1916
2404
|
framework: options.framework ?? "enterprise",
|
|
1917
|
-
include: [...options.include ??
|
|
2405
|
+
include: [...options.include ?? chunkTAMKRTM6_cjs.CAMPAIGN_FULL]
|
|
1918
2406
|
}
|
|
1919
2407
|
});
|
|
1920
2408
|
return ensureOk(result);
|
|
@@ -1926,12 +2414,32 @@ var CrawlerClient = class {
|
|
|
1926
2414
|
* @param options Optional `search` keyword and `include` override (default `CAPEC_FULL`).
|
|
1927
2415
|
*/
|
|
1928
2416
|
async enrichCapecFull(capecId, options = {}) {
|
|
1929
|
-
const result = await
|
|
2417
|
+
const result = await chunkASYQPVBW_cjs.enrichCapec({
|
|
1930
2418
|
client: this._client,
|
|
1931
2419
|
body: {
|
|
1932
2420
|
...capecId !== void 0 && { capec_id: capecId },
|
|
1933
2421
|
...options.search !== void 0 && { search: options.search },
|
|
1934
|
-
include: [...options.include ??
|
|
2422
|
+
include: [...options.include ?? chunkTAMKRTM6_cjs.CAPEC_FULL]
|
|
2423
|
+
}
|
|
2424
|
+
});
|
|
2425
|
+
return ensureOk(result);
|
|
2426
|
+
}
|
|
2427
|
+
/**
|
|
2428
|
+
* Resolve a CLOAK concealment technique — details and knowledge base context.
|
|
2429
|
+
*
|
|
2430
|
+
* CLOAK objects carry no ATT&CK references, so there is no linked-technique layer:
|
|
2431
|
+
* the response has no `linked_techniques` field at all.
|
|
2432
|
+
*
|
|
2433
|
+
* @param cloakId CLOAK identifier (e.g. `TTP-496`, or a technique slug such as `ta6-te129`).
|
|
2434
|
+
* @param options Optional `search` keyword and `include` override (default `CLOAK_FULL`).
|
|
2435
|
+
*/
|
|
2436
|
+
async enrichCloakFull(cloakId, options = {}) {
|
|
2437
|
+
const result = await chunkASYQPVBW_cjs.enrichCloak({
|
|
2438
|
+
client: this._client,
|
|
2439
|
+
body: {
|
|
2440
|
+
...cloakId !== void 0 && { cloak_id: cloakId },
|
|
2441
|
+
...options.search !== void 0 && { search: options.search },
|
|
2442
|
+
include: [...options.include ?? chunkTAMKRTM6_cjs.CLOAK_FULL]
|
|
1935
2443
|
}
|
|
1936
2444
|
});
|
|
1937
2445
|
return ensureOk(result);
|
|
@@ -1943,29 +2451,55 @@ var CrawlerClient = class {
|
|
|
1943
2451
|
* @param options Optional `search` keyword and `include` override (default `DEFEND_FULL`).
|
|
1944
2452
|
*/
|
|
1945
2453
|
async enrichDefendFull(d3fendId, options = {}) {
|
|
1946
|
-
const result = await
|
|
2454
|
+
const result = await chunkASYQPVBW_cjs.enrichDefend({
|
|
1947
2455
|
client: this._client,
|
|
1948
2456
|
body: {
|
|
1949
2457
|
...d3fendId !== void 0 && { d3fend_id: d3fendId },
|
|
1950
2458
|
...options.search !== void 0 && { search: options.search },
|
|
1951
|
-
include: [...options.include ??
|
|
2459
|
+
include: [...options.include ?? chunkTAMKRTM6_cjs.DEFEND_FULL]
|
|
1952
2460
|
}
|
|
1953
2461
|
});
|
|
1954
2462
|
return ensureOk(result);
|
|
1955
2463
|
}
|
|
1956
2464
|
/**
|
|
1957
|
-
* Walk a DISARM disinformation technique to its
|
|
2465
|
+
* Walk a DISARM disinformation technique to its family links and context.
|
|
2466
|
+
*
|
|
2467
|
+
* DISARM has no course-of-action objects and no ATT&CK-Enterprise-keyed actors/campaigns, so the
|
|
2468
|
+
* response carries the technique, its DISARM family (`relatedDisarmTechniques`), and the
|
|
2469
|
+
* knowledge-base / web / summary context — nothing else.
|
|
1958
2470
|
*
|
|
1959
2471
|
* @param techniqueId DISARM technique ID (e.g. `T0086`).
|
|
1960
2472
|
* @param options Optional `search` keyword and `include` override (default `DISARM_FULL`).
|
|
1961
2473
|
*/
|
|
1962
2474
|
async enrichDisarmFull(techniqueId, options = {}) {
|
|
1963
|
-
const result = await
|
|
2475
|
+
const result = await chunkASYQPVBW_cjs.enrichDisarm({
|
|
1964
2476
|
client: this._client,
|
|
1965
2477
|
body: {
|
|
1966
2478
|
...techniqueId !== void 0 && { technique_id: techniqueId },
|
|
1967
2479
|
...options.search !== void 0 && { search: options.search },
|
|
1968
|
-
include: [...options.include ??
|
|
2480
|
+
include: [...options.include ?? chunkTAMKRTM6_cjs.DISARM_FULL]
|
|
2481
|
+
}
|
|
2482
|
+
});
|
|
2483
|
+
return ensureOk(result);
|
|
2484
|
+
}
|
|
2485
|
+
/**
|
|
2486
|
+
* Walk a MITRE F3 fraud technique to the ATT&CK techniques it borrows.
|
|
2487
|
+
*
|
|
2488
|
+
* F3 borrows real ATT&CK `T####` ids for the techniques it shares with Enterprise
|
|
2489
|
+
* ATT&CK, so a `T`-shaped id resolves here too. Unlike the other framework walks,
|
|
2490
|
+
* calling with neither an id nor `search` is valid — the server answers 200 with
|
|
2491
|
+
* nothing selected rather than rejecting the request.
|
|
2492
|
+
*
|
|
2493
|
+
* @param f3Id F3 identifier (e.g. `F1031`, `F1025.003`).
|
|
2494
|
+
* @param options Optional `search` keyword and `include` override (default `F3_FULL`).
|
|
2495
|
+
*/
|
|
2496
|
+
async enrichF3Full(f3Id, options = {}) {
|
|
2497
|
+
const result = await chunkASYQPVBW_cjs.enrichF3({
|
|
2498
|
+
client: this._client,
|
|
2499
|
+
body: {
|
|
2500
|
+
...f3Id !== void 0 && { f3_id: f3Id },
|
|
2501
|
+
...options.search !== void 0 && { search: options.search },
|
|
2502
|
+
include: [...options.include ?? chunkTAMKRTM6_cjs.F3_FULL]
|
|
1969
2503
|
}
|
|
1970
2504
|
});
|
|
1971
2505
|
return ensureOk(result);
|
|
@@ -1978,47 +2512,65 @@ var CrawlerClient = class {
|
|
|
1978
2512
|
* override (default `GROUP_FULL`).
|
|
1979
2513
|
*/
|
|
1980
2514
|
async enrichGroupFull(groupId, options = {}) {
|
|
1981
|
-
const result = await
|
|
2515
|
+
const result = await chunkASYQPVBW_cjs.enrichGroup({
|
|
1982
2516
|
client: this._client,
|
|
1983
2517
|
body: {
|
|
1984
2518
|
...groupId !== void 0 && { group_id: groupId },
|
|
1985
2519
|
...options.search !== void 0 && { search: options.search },
|
|
1986
2520
|
framework: options.framework ?? "enterprise",
|
|
1987
|
-
|
|
2521
|
+
...options.limit !== void 0 && { limit: options.limit },
|
|
2522
|
+
...options.offset !== void 0 && { offset: options.offset },
|
|
2523
|
+
...options.snapshotId !== void 0 && {
|
|
2524
|
+
snapshot_id: options.snapshotId
|
|
2525
|
+
},
|
|
2526
|
+
include: [...options.include ?? chunkTAMKRTM6_cjs.GROUP_FULL]
|
|
1988
2527
|
}
|
|
1989
2528
|
});
|
|
1990
|
-
|
|
2529
|
+
const page = ensureOk(result);
|
|
2530
|
+
expandGroupCatalogue(
|
|
2531
|
+
page.log_source_catalog,
|
|
2532
|
+
page.log_source_refs,
|
|
2533
|
+
page.group?.techniques
|
|
2534
|
+
);
|
|
2535
|
+
return page;
|
|
2536
|
+
}
|
|
2537
|
+
async *iterGroupPages(groupId, options = {}) {
|
|
2538
|
+
const pages = await collectSnapshotPages(
|
|
2539
|
+
(offset, snapshotId) => this.enrichGroupFull(groupId, { ...options, offset, snapshotId }),
|
|
2540
|
+
(page) => page.techniques_next_offset
|
|
2541
|
+
);
|
|
2542
|
+
yield* pages;
|
|
1991
2543
|
}
|
|
1992
2544
|
/**
|
|
1993
|
-
* Map a region's
|
|
2545
|
+
* Map a region's profile — details plus knowledge base context.
|
|
1994
2546
|
*
|
|
1995
|
-
* @param locationId Region identifier (e.g. `
|
|
2547
|
+
* @param locationId Region identifier (e.g. `US`, or a STIX location ID).
|
|
1996
2548
|
* @param options Optional `search` keyword and `include` override (default `LOCATION_FULL`).
|
|
1997
2549
|
*/
|
|
1998
2550
|
async enrichLocationFull(locationId, options = {}) {
|
|
1999
|
-
const result = await
|
|
2551
|
+
const result = await chunkASYQPVBW_cjs.enrichLocation({
|
|
2000
2552
|
client: this._client,
|
|
2001
2553
|
body: {
|
|
2002
2554
|
...locationId !== void 0 && { location_id: locationId },
|
|
2003
2555
|
...options.search !== void 0 && { search: options.search },
|
|
2004
|
-
include: [...options.include ??
|
|
2556
|
+
include: [...options.include ?? chunkTAMKRTM6_cjs.LOCATION_FULL]
|
|
2005
2557
|
}
|
|
2006
2558
|
});
|
|
2007
2559
|
return ensureOk(result);
|
|
2008
2560
|
}
|
|
2009
2561
|
/**
|
|
2010
|
-
* Map an industry sector's
|
|
2562
|
+
* Map an industry sector's profile — details plus knowledge base context.
|
|
2011
2563
|
*
|
|
2012
|
-
* @param sectorId Sector identifier (e.g. `energy`, or
|
|
2564
|
+
* @param sectorId Sector identifier (e.g. `energy`, or a STIX sector ID).
|
|
2013
2565
|
* @param options Optional `search` keyword and `include` override (default `SECTOR_FULL`).
|
|
2014
2566
|
*/
|
|
2015
2567
|
async enrichSectorFull(sectorId, options = {}) {
|
|
2016
|
-
const result = await
|
|
2568
|
+
const result = await chunkASYQPVBW_cjs.enrichSector({
|
|
2017
2569
|
client: this._client,
|
|
2018
2570
|
body: {
|
|
2019
2571
|
...sectorId !== void 0 && { sector_id: sectorId },
|
|
2020
2572
|
...options.search !== void 0 && { search: options.search },
|
|
2021
|
-
include: [...options.include ??
|
|
2573
|
+
include: [...options.include ?? chunkTAMKRTM6_cjs.SECTOR_FULL]
|
|
2022
2574
|
}
|
|
2023
2575
|
});
|
|
2024
2576
|
return ensureOk(result);
|
|
@@ -2031,13 +2583,13 @@ var CrawlerClient = class {
|
|
|
2031
2583
|
* override (default `SOFTWARE_FULL`).
|
|
2032
2584
|
*/
|
|
2033
2585
|
async enrichSoftwareFull(softwareId, options = {}) {
|
|
2034
|
-
const result = await
|
|
2586
|
+
const result = await chunkASYQPVBW_cjs.enrichSoftware({
|
|
2035
2587
|
client: this._client,
|
|
2036
2588
|
body: {
|
|
2037
2589
|
...softwareId !== void 0 && { software_id: softwareId },
|
|
2038
2590
|
...options.search !== void 0 && { search: options.search },
|
|
2039
2591
|
framework: options.framework ?? "enterprise",
|
|
2040
|
-
include: [...options.include ??
|
|
2592
|
+
include: [...options.include ?? chunkTAMKRTM6_cjs.SOFTWARE_FULL]
|
|
2041
2593
|
}
|
|
2042
2594
|
});
|
|
2043
2595
|
return ensureOk(result);
|
|
@@ -2054,11 +2606,25 @@ var CrawlerClient = class {
|
|
|
2054
2606
|
* @param items Discriminated batch items (`{ type: "cve", cve_id: "..." }`, …).
|
|
2055
2607
|
*/
|
|
2056
2608
|
async enrichBatch(items) {
|
|
2057
|
-
const result = await
|
|
2609
|
+
const result = await chunkASYQPVBW_cjs.enrichBatch({
|
|
2058
2610
|
client: this._client,
|
|
2059
2611
|
body: { items }
|
|
2060
2612
|
});
|
|
2061
|
-
|
|
2613
|
+
const response = ensureOk(result);
|
|
2614
|
+
for (const row of response.results ?? []) {
|
|
2615
|
+
if ((row.type === "product" || row.type === "package") && row.data) {
|
|
2616
|
+
expandCveContext(row.data);
|
|
2617
|
+
}
|
|
2618
|
+
if (row.type === "group" && row.data) {
|
|
2619
|
+
const group = row.data;
|
|
2620
|
+
expandGroupCatalogue(
|
|
2621
|
+
group.log_source_catalog,
|
|
2622
|
+
group.log_source_refs,
|
|
2623
|
+
group.group?.techniques
|
|
2624
|
+
);
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
return response;
|
|
2062
2628
|
}
|
|
2063
2629
|
/**
|
|
2064
2630
|
* Fetch the source of a public proof-of-concept exploit repository.
|
|
@@ -2069,7 +2635,7 @@ var CrawlerClient = class {
|
|
|
2069
2635
|
* @param repoUrl Public repository URL of the PoC.
|
|
2070
2636
|
*/
|
|
2071
2637
|
async enrichPocSource(repoUrl) {
|
|
2072
|
-
const result = await
|
|
2638
|
+
const result = await chunkASYQPVBW_cjs.enrichPocSource({
|
|
2073
2639
|
client: this._client,
|
|
2074
2640
|
body: { repo_url: repoUrl }
|
|
2075
2641
|
});
|
|
@@ -2089,7 +2655,7 @@ var CrawlerClient = class {
|
|
|
2089
2655
|
* @param options `groupIds`, `search` terms, `framework` matrix, and `include` layers.
|
|
2090
2656
|
*/
|
|
2091
2657
|
async assessGroupExposure(options = {}) {
|
|
2092
|
-
const result = await
|
|
2658
|
+
const result = await chunkASYQPVBW_cjs.assessGroupExposure({
|
|
2093
2659
|
client: this._client,
|
|
2094
2660
|
body: {
|
|
2095
2661
|
...options.groupIds !== void 0 && {
|
|
@@ -2097,10 +2663,28 @@ var CrawlerClient = class {
|
|
|
2097
2663
|
},
|
|
2098
2664
|
...options.search !== void 0 && { search: [...options.search] },
|
|
2099
2665
|
framework: options.framework ?? "enterprise",
|
|
2666
|
+
...options.limit !== void 0 && { limit: options.limit },
|
|
2667
|
+
...options.offset !== void 0 && { offset: options.offset },
|
|
2668
|
+
...options.snapshotId !== void 0 && {
|
|
2669
|
+
snapshot_id: options.snapshotId
|
|
2670
|
+
},
|
|
2100
2671
|
...options.include !== void 0 && { include: [...options.include] }
|
|
2101
2672
|
}
|
|
2102
2673
|
});
|
|
2103
|
-
|
|
2674
|
+
const page = ensureOk(result);
|
|
2675
|
+
expandGroupCatalogue(
|
|
2676
|
+
page.log_source_catalog,
|
|
2677
|
+
page.log_source_refs,
|
|
2678
|
+
page.techniques
|
|
2679
|
+
);
|
|
2680
|
+
return page;
|
|
2681
|
+
}
|
|
2682
|
+
async *iterGroupExposurePages(options = {}) {
|
|
2683
|
+
const pages = await collectSnapshotPages(
|
|
2684
|
+
(offset, snapshotId) => this.assessGroupExposure({ ...options, offset, snapshotId }),
|
|
2685
|
+
(page) => page.techniques_next_offset
|
|
2686
|
+
);
|
|
2687
|
+
yield* pages;
|
|
2104
2688
|
}
|
|
2105
2689
|
/**
|
|
2106
2690
|
* Assess a portfolio of indicators — MISP corroboration, linked techniques, attribution.
|
|
@@ -2109,7 +2693,7 @@ var CrawlerClient = class {
|
|
|
2109
2693
|
* @param options Optional `include` layers.
|
|
2110
2694
|
*/
|
|
2111
2695
|
async assessIocPortfolio(indicators, options = {}) {
|
|
2112
|
-
const result = await
|
|
2696
|
+
const result = await chunkASYQPVBW_cjs.assessIocPortfolio({
|
|
2113
2697
|
client: this._client,
|
|
2114
2698
|
body: {
|
|
2115
2699
|
indicators,
|
|
@@ -2125,7 +2709,7 @@ var CrawlerClient = class {
|
|
|
2125
2709
|
* @param options Optional `framework` matrix and `include` layers.
|
|
2126
2710
|
*/
|
|
2127
2711
|
async assessTechniqueCoverage(techniqueIds, options = {}) {
|
|
2128
|
-
const result = await
|
|
2712
|
+
const result = await chunkASYQPVBW_cjs.assessTechniqueCoverage({
|
|
2129
2713
|
client: this._client,
|
|
2130
2714
|
body: {
|
|
2131
2715
|
technique_ids: [...techniqueIds],
|
|
@@ -2138,23 +2722,48 @@ var CrawlerClient = class {
|
|
|
2138
2722
|
/**
|
|
2139
2723
|
* Prioritize a set of CVEs — weaponization, exploit chains, and remediation order.
|
|
2140
2724
|
*
|
|
2725
|
+
* Returns one page. OSV advisories are aggregated across `cveIds` and paged: while
|
|
2726
|
+
* `osv_next_offset` is set, request the next page with that offset and the response's
|
|
2727
|
+
* `osv_snapshot_id`, or stream the whole walk with {@link iterVulnerabilityExposureOsvPages}.
|
|
2728
|
+
*
|
|
2141
2729
|
* @param cveIds CVE identifiers to assess.
|
|
2142
|
-
* @param options Optional `include` layers
|
|
2143
|
-
* tunes the decision to your
|
|
2730
|
+
* @param options Optional `include` layers (a continuation must repeat them; `osv_restricted`
|
|
2731
|
+
* is the licence opt-in), an SSVC `stakeholder` profile that tunes the decision to your
|
|
2732
|
+
* deployment, and the `osvOffset` / `osvSnapshotId` cursor from the previous page.
|
|
2144
2733
|
*/
|
|
2145
2734
|
async assessVulnerabilityExposure(cveIds, options = {}) {
|
|
2146
|
-
const result = await
|
|
2735
|
+
const result = await chunkASYQPVBW_cjs.assessVulnerabilityExposure({
|
|
2147
2736
|
client: this._client,
|
|
2148
2737
|
body: {
|
|
2149
2738
|
cve_ids: [...cveIds],
|
|
2150
2739
|
...options.include !== void 0 && { include: [...options.include] },
|
|
2151
2740
|
...options.stakeholder !== void 0 && {
|
|
2152
2741
|
stakeholder: options.stakeholder
|
|
2742
|
+
},
|
|
2743
|
+
...options.osvOffset !== void 0 && {
|
|
2744
|
+
osv_offset: options.osvOffset
|
|
2745
|
+
},
|
|
2746
|
+
...options.osvSnapshotId !== void 0 && {
|
|
2747
|
+
osv_snapshot_id: options.osvSnapshotId
|
|
2153
2748
|
}
|
|
2154
2749
|
}
|
|
2155
2750
|
});
|
|
2156
2751
|
return ensureOk(result);
|
|
2157
2752
|
}
|
|
2753
|
+
/**
|
|
2754
|
+
* Stream every OSV advisory page of a vulnerability-exposure assessment without an aggregate
|
|
2755
|
+
* buffer. Same contract as {@link iterCveOsvPages}: the first page is the whole assessment, a
|
|
2756
|
+
* changed or expired snapshot throws instead of restarting, and the caller owns any collection bound.
|
|
2757
|
+
*/
|
|
2758
|
+
async *iterVulnerabilityExposureOsvPages(cveIds, options = {}) {
|
|
2759
|
+
yield* iterOsvPages(
|
|
2760
|
+
(osvOffset, osvSnapshotId) => this.assessVulnerabilityExposure(cveIds, {
|
|
2761
|
+
...options,
|
|
2762
|
+
osvOffset,
|
|
2763
|
+
...osvSnapshotId !== void 0 && { osvSnapshotId }
|
|
2764
|
+
})
|
|
2765
|
+
);
|
|
2766
|
+
}
|
|
2158
2767
|
// -- Search ------------------------------------------------------------ //
|
|
2159
2768
|
//
|
|
2160
2769
|
// Search endpoints query a corpus and return matches; they never walk an
|
|
@@ -2170,7 +2779,7 @@ var CrawlerClient = class {
|
|
|
2170
2779
|
* @param options `sources`, `types`, `limit`, `page`, and the `deprecated`/`revoked` filters.
|
|
2171
2780
|
*/
|
|
2172
2781
|
async searchCti(query, options = {}) {
|
|
2173
|
-
const result = await
|
|
2782
|
+
const result = await chunkASYQPVBW_cjs.searchCti({
|
|
2174
2783
|
client: this._client,
|
|
2175
2784
|
body: {
|
|
2176
2785
|
query,
|
|
@@ -2181,7 +2790,8 @@ var CrawlerClient = class {
|
|
|
2181
2790
|
...options.deprecated !== void 0 && {
|
|
2182
2791
|
deprecated: options.deprecated
|
|
2183
2792
|
},
|
|
2184
|
-
...options.revoked !== void 0 && { revoked: options.revoked }
|
|
2793
|
+
...options.revoked !== void 0 && { revoked: options.revoked },
|
|
2794
|
+
...options.include !== void 0 && { include: [...options.include] }
|
|
2185
2795
|
}
|
|
2186
2796
|
});
|
|
2187
2797
|
return ensureOk(result);
|
|
@@ -2195,9 +2805,12 @@ var CrawlerClient = class {
|
|
|
2195
2805
|
*
|
|
2196
2806
|
* @param query Free-text query. Omit it to filter purely on the structured fields.
|
|
2197
2807
|
* @param options Any combination of the corpus filters, plus `sort`, `limit`, `page`.
|
|
2808
|
+
* `include` replaces the server defaults: `details`, `statistics`, `cna`, `epss_reports`,
|
|
2809
|
+
* and `kb_rankings` default on. `kb_rankings` keeps the top 100 rows per KB without yearly
|
|
2810
|
+
* trends; `kb_rankings_full` restores all fetched rows and trends.
|
|
2198
2811
|
*/
|
|
2199
2812
|
async searchCve(query, options = {}) {
|
|
2200
|
-
const result = await
|
|
2813
|
+
const result = await chunkASYQPVBW_cjs.searchCve({
|
|
2201
2814
|
client: this._client,
|
|
2202
2815
|
body: {
|
|
2203
2816
|
...query !== void 0 && { query },
|
|
@@ -2252,10 +2865,12 @@ var CrawlerClient = class {
|
|
|
2252
2865
|
* Search the D3FEND defensive-countermeasure ontology.
|
|
2253
2866
|
*
|
|
2254
2867
|
* @param query Free-text query (e.g. `"network traffic analysis"`).
|
|
2255
|
-
* @param options `d3fendForm` to scope to a tactic/mitigation/artifact, plus `limit`, `page
|
|
2868
|
+
* @param options `d3fendForm` to scope to a tactic/mitigation/artifact, plus `limit`, `page`,
|
|
2869
|
+
* and `include`. `versions` defaults on and attaches each returned technique's revision history.
|
|
2870
|
+
* An explicit include replaces the defaults; pass `[]` to omit all optional layers.
|
|
2256
2871
|
*/
|
|
2257
2872
|
async searchD3fend(query, options = {}) {
|
|
2258
|
-
const result = await
|
|
2873
|
+
const result = await chunkASYQPVBW_cjs.searchD3Fend({
|
|
2259
2874
|
client: this._client,
|
|
2260
2875
|
body: {
|
|
2261
2876
|
query,
|
|
@@ -2263,7 +2878,8 @@ var CrawlerClient = class {
|
|
|
2263
2878
|
d3fend_form: options.d3fendForm
|
|
2264
2879
|
},
|
|
2265
2880
|
limit: options.limit ?? 20,
|
|
2266
|
-
page: options.page ?? 1
|
|
2881
|
+
page: options.page ?? 1,
|
|
2882
|
+
...options.include !== void 0 && { include: [...options.include] }
|
|
2267
2883
|
}
|
|
2268
2884
|
});
|
|
2269
2885
|
return ensureOk(result);
|
|
@@ -2273,10 +2889,12 @@ var CrawlerClient = class {
|
|
|
2273
2889
|
*
|
|
2274
2890
|
* An empty call pages the whole catalog; `cveId` checks one CVE's KEV status.
|
|
2275
2891
|
*
|
|
2276
|
-
* @param options `cveId`, `ransomwareStatus`, `limit`, `page`.
|
|
2892
|
+
* @param options `cveId`, `ransomwareStatus`, `limit`, `page`, and `include`. `statistics`
|
|
2893
|
+
* defaults on for deployment-wide corpus coverage. An explicit include replaces the defaults;
|
|
2894
|
+
* pass `[]` to omit all optional layers.
|
|
2277
2895
|
*/
|
|
2278
2896
|
async searchKev(options = {}) {
|
|
2279
|
-
const result = await
|
|
2897
|
+
const result = await chunkASYQPVBW_cjs.searchKev({
|
|
2280
2898
|
client: this._client,
|
|
2281
2899
|
body: {
|
|
2282
2900
|
...options.cveId !== void 0 && { cve_id: options.cveId },
|
|
@@ -2284,6 +2902,35 @@ var CrawlerClient = class {
|
|
|
2284
2902
|
ransomware_status: options.ransomwareStatus
|
|
2285
2903
|
},
|
|
2286
2904
|
limit: options.limit ?? 50,
|
|
2905
|
+
page: options.page ?? 1,
|
|
2906
|
+
...options.include !== void 0 && { include: [...options.include] }
|
|
2907
|
+
}
|
|
2908
|
+
});
|
|
2909
|
+
return ensureOk(result);
|
|
2910
|
+
}
|
|
2911
|
+
/**
|
|
2912
|
+
* Search the seeded CSAF vendor-advisory corpus.
|
|
2913
|
+
*
|
|
2914
|
+
* Filters combine with AND; this is the door for CVE-less advisories (publisher, sector,
|
|
2915
|
+
* product, CPE, TLP). `total` is the unpaginated match count.
|
|
2916
|
+
*/
|
|
2917
|
+
async searchCsaf(options = {}) {
|
|
2918
|
+
const result = await chunkASYQPVBW_cjs.searchCsaf({
|
|
2919
|
+
client: this._client,
|
|
2920
|
+
body: {
|
|
2921
|
+
...options.cveId !== void 0 && { cve_id: options.cveId },
|
|
2922
|
+
...options.advisoryId !== void 0 && {
|
|
2923
|
+
advisory_id: options.advisoryId
|
|
2924
|
+
},
|
|
2925
|
+
...options.publisher !== void 0 && {
|
|
2926
|
+
publisher: options.publisher
|
|
2927
|
+
},
|
|
2928
|
+
...options.sector !== void 0 && { sector: options.sector },
|
|
2929
|
+
...options.product !== void 0 && { product: options.product },
|
|
2930
|
+
...options.cpe !== void 0 && { cpe: options.cpe },
|
|
2931
|
+
...options.tlp !== void 0 && { tlp: options.tlp },
|
|
2932
|
+
sort: options.sort ?? "newest",
|
|
2933
|
+
limit: options.limit ?? 20,
|
|
2287
2934
|
page: options.page ?? 1
|
|
2288
2935
|
}
|
|
2289
2936
|
});
|
|
@@ -2297,7 +2944,7 @@ var CrawlerClient = class {
|
|
|
2297
2944
|
* weighting (0 = pure vector, 1 = pure keyword), and `limit`.
|
|
2298
2945
|
*/
|
|
2299
2946
|
async searchKnowledgebase(query, options = {}) {
|
|
2300
|
-
const result = await
|
|
2947
|
+
const result = await chunkASYQPVBW_cjs.searchKnowledgebase({
|
|
2301
2948
|
client: this._client,
|
|
2302
2949
|
body: {
|
|
2303
2950
|
query,
|
|
@@ -2311,14 +2958,23 @@ var CrawlerClient = class {
|
|
|
2311
2958
|
return ensureOk(result);
|
|
2312
2959
|
}
|
|
2313
2960
|
/**
|
|
2314
|
-
* Search MISP events and attributes.
|
|
2961
|
+
* Search our curated MISP (public threat feeds) for events and attributes.
|
|
2962
|
+
* Feed list: https://crimsoncrawler.com/docs/guides/data-sources/#our-curated-misp.
|
|
2315
2963
|
*
|
|
2316
2964
|
* @param options Attribute filters (`value`, `typeAttribute`, `category`, `toIds`),
|
|
2317
2965
|
* event filters (`eventId`, `eventinfo`, `tags`, `threatLevelId`, `published`),
|
|
2318
2966
|
* a `dateFrom`/`dateTo` window, plus `limit` and `page`.
|
|
2967
|
+
* `include` takes any of `"sightings"` (asks MISP for the inline `Sighting` array so each
|
|
2968
|
+
* attribute's `sightings[]`/`sighting_count` and each returned event's sightings are real
|
|
2969
|
+
* counts instead of 0), `"event_reports"` (the analyst-written markdown narratives for the
|
|
2970
|
+
* matched events), `"stats"` (per-event attribute/object/sighting counts), `"tags"` (the
|
|
2971
|
+
* instance's tag vocabulary), `"feeds"` (feed previews), `"objects"` (full event bodies with
|
|
2972
|
+
* resolved references), `"misp_events_full"` (full event bodies), and `"version"`. Events
|
|
2973
|
+
* otherwise return summaries; `misp_events_total` is null when unknown.
|
|
2974
|
+
* Omit `include` for event reports, tags and version; pass `[]` to omit them.
|
|
2319
2975
|
*/
|
|
2320
2976
|
async searchMisp(options = {}) {
|
|
2321
|
-
const result = await
|
|
2977
|
+
const result = await chunkASYQPVBW_cjs.searchMisp({
|
|
2322
2978
|
client: this._client,
|
|
2323
2979
|
body: {
|
|
2324
2980
|
...options.value !== void 0 && { value: options.value },
|
|
@@ -2340,6 +2996,7 @@ var CrawlerClient = class {
|
|
|
2340
2996
|
},
|
|
2341
2997
|
...options.dateFrom !== void 0 && { date_from: options.dateFrom },
|
|
2342
2998
|
...options.dateTo !== void 0 && { date_to: options.dateTo },
|
|
2999
|
+
...options.include !== void 0 && { include: [...options.include] },
|
|
2343
3000
|
limit: options.limit ?? 50,
|
|
2344
3001
|
page: options.page ?? 1
|
|
2345
3002
|
}
|
|
@@ -2355,7 +3012,7 @@ var CrawlerClient = class {
|
|
|
2355
3012
|
* @param options Optional `limit` (default 25).
|
|
2356
3013
|
*/
|
|
2357
3014
|
async searchPoc(cveId, options = {}) {
|
|
2358
|
-
const result = await
|
|
3015
|
+
const result = await chunkASYQPVBW_cjs.searchPoc({
|
|
2359
3016
|
client: this._client,
|
|
2360
3017
|
body: {
|
|
2361
3018
|
cve_id: cveId,
|
|
@@ -2373,10 +3030,11 @@ var CrawlerClient = class {
|
|
|
2373
3030
|
* @param options Optional `limit` (default 50).
|
|
2374
3031
|
*/
|
|
2375
3032
|
async searchVendor(vendor, options = {}) {
|
|
2376
|
-
const result = await
|
|
3033
|
+
const result = await chunkASYQPVBW_cjs.searchVendor({
|
|
2377
3034
|
client: this._client,
|
|
2378
3035
|
body: {
|
|
2379
|
-
vendor,
|
|
3036
|
+
vendor: vendor ?? void 0,
|
|
3037
|
+
q: options.q,
|
|
2380
3038
|
limit: options.limit ?? 50
|
|
2381
3039
|
}
|
|
2382
3040
|
});
|
|
@@ -2399,15 +3057,19 @@ var CrawlerClient = class {
|
|
|
2399
3057
|
* report `include` sections, and an SSVC `stakeholder` profile.
|
|
2400
3058
|
*/
|
|
2401
3059
|
async artifactEnrich(options = {}) {
|
|
2402
|
-
const result = await
|
|
3060
|
+
const result = await chunkASYQPVBW_cjs.artifactEnrich({
|
|
2403
3061
|
client: this._client,
|
|
2404
3062
|
body: {
|
|
2405
3063
|
...options.text !== void 0 && { text: options.text },
|
|
3064
|
+
...options.texts !== void 0 && { texts: options.texts },
|
|
2406
3065
|
...options.files !== void 0 && { files: options.files },
|
|
2407
3066
|
...options.formats !== void 0 && { formats: options.formats },
|
|
2408
3067
|
...options.include !== void 0 && { include: [...options.include] },
|
|
2409
3068
|
...options.stakeholder !== void 0 && {
|
|
2410
3069
|
stakeholder: options.stakeholder
|
|
3070
|
+
},
|
|
3071
|
+
...options.attachedArtifactIds !== void 0 && {
|
|
3072
|
+
attached_artifact_ids: options.attachedArtifactIds
|
|
2411
3073
|
}
|
|
2412
3074
|
}
|
|
2413
3075
|
});
|
|
@@ -2419,7 +3081,7 @@ var CrawlerClient = class {
|
|
|
2419
3081
|
* @param enrichmentId The `enrichment_id` returned by {@link artifactEnrich}.
|
|
2420
3082
|
*/
|
|
2421
3083
|
async artifactEnrichStatus(enrichmentId) {
|
|
2422
|
-
const result = await
|
|
3084
|
+
const result = await chunkASYQPVBW_cjs.artifactEnrichStatus({
|
|
2423
3085
|
client: this._client,
|
|
2424
3086
|
path: { enrichment_id: enrichmentId }
|
|
2425
3087
|
});
|
|
@@ -2433,21 +3095,35 @@ var CrawlerClient = class {
|
|
|
2433
3095
|
* fleet-level risk picture.
|
|
2434
3096
|
*
|
|
2435
3097
|
* @param items Assets to enrich, each at minimum `{ product }`.
|
|
2436
|
-
* @param options Optional `attachmentsText
|
|
2437
|
-
*
|
|
3098
|
+
* @param options Optional attachment context — `attachmentsText` (one opaque blob),
|
|
3099
|
+
* `attachmentsTexts` (one `{ text, source_artifact_id?, filename? }` entry per artifact, so
|
|
3100
|
+
* each block keeps its own attribution), `attachedArtifactIds` (the artifacts an opaque
|
|
3101
|
+
* `attachmentsText` came from) and `attachmentsFiles` (raw binary the engine parses) — plus
|
|
3102
|
+
* per-asset CVE `include` layers and `vexOverlay` — an OpenVEX 0.2.0 / CSAF 2.0 VEX
|
|
3103
|
+
* document (text) whose `not_affected`/`fixed` statements mark matching findings
|
|
3104
|
+
* `suppressed_by_vex` (retained + justification, excluded from the actionable counts).
|
|
2438
3105
|
*/
|
|
2439
3106
|
async inventoryEnrich(items, options = {}) {
|
|
2440
|
-
const result = await
|
|
3107
|
+
const result = await chunkASYQPVBW_cjs.inventoryEnrich({
|
|
2441
3108
|
client: this._client,
|
|
2442
3109
|
body: {
|
|
2443
3110
|
items: [...items],
|
|
2444
3111
|
...options.attachmentsText !== void 0 && {
|
|
2445
3112
|
attachments_text: options.attachmentsText
|
|
2446
3113
|
},
|
|
3114
|
+
...options.attachmentsTexts !== void 0 && {
|
|
3115
|
+
attachments_texts: options.attachmentsTexts
|
|
3116
|
+
},
|
|
3117
|
+
...options.attachedArtifactIds !== void 0 && {
|
|
3118
|
+
attached_artifact_ids: options.attachedArtifactIds
|
|
3119
|
+
},
|
|
2447
3120
|
...options.attachmentsFiles !== void 0 && {
|
|
2448
3121
|
attachments_files: options.attachmentsFiles
|
|
2449
3122
|
},
|
|
2450
|
-
...options.include !== void 0 && { include: [...options.include] }
|
|
3123
|
+
...options.include !== void 0 && { include: [...options.include] },
|
|
3124
|
+
...options.vexOverlay !== void 0 && {
|
|
3125
|
+
vex_overlay: { format: "vex", content: options.vexOverlay }
|
|
3126
|
+
}
|
|
2451
3127
|
}
|
|
2452
3128
|
});
|
|
2453
3129
|
return ensureOk(result);
|
|
@@ -2458,13 +3134,58 @@ var CrawlerClient = class {
|
|
|
2458
3134
|
* @param enrichmentId The `enrichment_id` returned by {@link inventoryEnrich}.
|
|
2459
3135
|
*/
|
|
2460
3136
|
async inventoryEnrichStatus(enrichmentId) {
|
|
2461
|
-
const result = await
|
|
3137
|
+
const result = await chunkASYQPVBW_cjs.inventoryEnrichStatus({
|
|
3138
|
+
client: this._client,
|
|
3139
|
+
path: { enrichment_id: enrichmentId }
|
|
3140
|
+
});
|
|
3141
|
+
return ensureOk(result);
|
|
3142
|
+
}
|
|
3143
|
+
/**
|
|
3144
|
+
* Submit a raw security event to the async Event Enricher engine.
|
|
3145
|
+
*
|
|
3146
|
+
* Returns immediately with an `enrichment_id` — poll {@link eventEnrichStatus}
|
|
3147
|
+
* for the result (per-indicator findings + the aggregate event threat
|
|
3148
|
+
* assessment), or use {@link enricher}.`enrichEvent` to run the whole lifecycle.
|
|
3149
|
+
* CC extracts every indicator server-side — you do NOT pre-parse the alert.
|
|
3150
|
+
*
|
|
3151
|
+
* @param event The raw event — a Defender XDR / Sentinel alert JSON, a SIEM/EDR
|
|
3152
|
+
* log line, or any text (≤200,000 chars).
|
|
3153
|
+
* @param options.eventId Optional caller-side event identifier (≤200 chars), echoed back on the result.
|
|
3154
|
+
*/
|
|
3155
|
+
async eventEnrich(event, options = {}) {
|
|
3156
|
+
const result = await chunkASYQPVBW_cjs.eventEnrich({
|
|
3157
|
+
client: this._client,
|
|
3158
|
+
body: {
|
|
3159
|
+
event,
|
|
3160
|
+
...options.eventId !== void 0 && { event_id: options.eventId }
|
|
3161
|
+
}
|
|
3162
|
+
});
|
|
3163
|
+
return ensureOk(result);
|
|
3164
|
+
}
|
|
3165
|
+
/**
|
|
3166
|
+
* Read the progress or result of an event enrichment.
|
|
3167
|
+
*
|
|
3168
|
+
* @param enrichmentId The `enrichment_id` returned by {@link eventEnrich}.
|
|
3169
|
+
*/
|
|
3170
|
+
async eventEnrichStatus(enrichmentId) {
|
|
3171
|
+
const result = await chunkASYQPVBW_cjs.eventEnrichStatus({
|
|
2462
3172
|
client: this._client,
|
|
2463
3173
|
path: { enrichment_id: enrichmentId }
|
|
2464
3174
|
});
|
|
2465
3175
|
return ensureOk(result);
|
|
2466
3176
|
}
|
|
2467
3177
|
};
|
|
3178
|
+
function expandGroupCatalogue(catalog, refs, rows) {
|
|
3179
|
+
if (!catalog || !refs || !rows) return;
|
|
3180
|
+
for (const row of rows) {
|
|
3181
|
+
if (typeof row === "string") continue;
|
|
3182
|
+
const indices = refs[row.technique_id] ?? [];
|
|
3183
|
+
if (indices.some((i) => !Number.isInteger(i) || i < 0 || i >= catalog.length)) {
|
|
3184
|
+
throw new Error("Invalid group log-source catalogue reference");
|
|
3185
|
+
}
|
|
3186
|
+
if (indices.length) row.log_sources = indices.map((i) => catalog[i]);
|
|
3187
|
+
}
|
|
3188
|
+
}
|
|
2468
3189
|
function ensureOk(result) {
|
|
2469
3190
|
if (result.data !== void 0 && result.error === void 0) {
|
|
2470
3191
|
return result.data;
|
|
@@ -2480,20 +3201,21 @@ function ensureOk(result) {
|
|
|
2480
3201
|
|
|
2481
3202
|
// package.json
|
|
2482
3203
|
var package_default = {
|
|
2483
|
-
version: "
|
|
3204
|
+
version: "5.0.1"};
|
|
2484
3205
|
|
|
2485
3206
|
// src/index.ts
|
|
2486
3207
|
var __version__ = package_default.version;
|
|
2487
3208
|
|
|
2488
3209
|
Object.defineProperty(exports, "presets", {
|
|
2489
3210
|
enumerable: true,
|
|
2490
|
-
get: function () { return
|
|
3211
|
+
get: function () { return chunkTAMKRTM6_cjs.presets_exports; }
|
|
2491
3212
|
});
|
|
2492
3213
|
exports.AiReportsApi = AiReportsApi;
|
|
2493
3214
|
exports.ArtifactManagerApi = ArtifactManagerApi;
|
|
2494
3215
|
exports.BASE_URL = BASE_URL;
|
|
2495
3216
|
exports.CrawlerClient = CrawlerClient;
|
|
2496
3217
|
exports.CrawlerClientError = CrawlerClientError;
|
|
3218
|
+
exports.DEFAULT_MAX_RETRIES = DEFAULT_MAX_RETRIES;
|
|
2497
3219
|
exports.DEFAULT_TIMEOUT_MS = DEFAULT_TIMEOUT_MS;
|
|
2498
3220
|
exports.ENV_API_KEY = ENV_API_KEY;
|
|
2499
3221
|
exports.ENV_BASE_URL = ENV_BASE_URL;
|
|
@@ -2501,7 +3223,10 @@ exports.ENV_VERIFY_SSL = ENV_VERIFY_SSL;
|
|
|
2501
3223
|
exports.EnricherApi = EnricherApi;
|
|
2502
3224
|
exports.InventoryManagerApi = InventoryManagerApi;
|
|
2503
3225
|
exports.MissingCredentials = MissingCredentials;
|
|
3226
|
+
exports.TLP_INVALID_MESSAGE = TLP_INVALID_MESSAGE;
|
|
3227
|
+
exports.TLP_VALUES = TLP_VALUES;
|
|
2504
3228
|
exports.UnexpectedStatus = UnexpectedStatus;
|
|
2505
3229
|
exports.__version__ = __version__;
|
|
2506
3230
|
exports.assembleBriefing = assembleBriefing;
|
|
2507
3231
|
exports.ingestScan = ingestScan;
|
|
3232
|
+
exports.validateTlp = validateTlp;
|