@mitre/hdf-schema 3.7.2 → 3.8.0-next.42532249979.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/dist/ts/hdf.d.ts CHANGED
@@ -19,12 +19,10 @@ export interface HDFResults {
19
19
  */
20
20
  derivation?: Derivation;
21
21
  /**
22
- * Reserved for tool-specific data not defined in the HDF standard. Use this to preserve
23
- * original tool output, auxiliary data, or custom metadata.
22
+ * Producer data outside the HDF model, and the pre-converted source artifact(s) these
23
+ * results were converted from.
24
24
  */
25
- extensions?: {
26
- [key: string]: any;
27
- };
25
+ extensions?: Extensions;
28
26
  /**
29
27
  * Optional references to external artifacts (CTI/STIX, BOMs, advisories, runbooks, or any
30
28
  * URI-addressable artifact) relevant to this assessment as a whole. Inert context; see
@@ -102,11 +100,10 @@ export interface EvaluatedBaseline {
102
100
  */
103
101
  description?: string;
104
102
  /**
105
- * Reserved for tool-specific baseline metadata not defined in the HDF standard.
103
+ * Producer data outside the HDF model that belongs to this baseline rather than to the
104
+ * document, and the pre-converted source artifact(s) this baseline was built from.
106
105
  */
107
- extensions?: {
108
- [key: string]: any;
109
- };
106
+ extensions?: Extensions;
110
107
  /**
111
108
  * A set of descriptions for the requirement groups.
112
109
  */
@@ -245,6 +242,53 @@ export interface Dependency {
245
242
  url?: string;
246
243
  [property: string]: any;
247
244
  }
245
+ /**
246
+ * Carrier for data outside the HDF model: `passthrough` for producer data HDF does not model,
247
+ * `rawSourceArtifacts` for the pre-converted input(s). CLOSED: these two members are the whole of
248
+ * it. A key HDF does not define goes inside `passthrough` — that is what `passthrough` is for — so
249
+ * `extensions` never becomes a second, unnamed schema that consumers must reverse-engineer from the
250
+ * producers that happen to write it. Closed with `additionalProperties` rather than the house
251
+ * `unevaluatedProperties` because this definition composes nothing, and the shipped Go validator is
252
+ * a draft-07 engine that does not implement `unevaluatedProperties` — a closure only one of the two
253
+ * validators enforces is not a closure. Declared on every HDF document type that carries a producer
254
+ * envelope (`generator` / `integrity`), and on `Evaluated_Baseline`, so one rule governs both
255
+ * sites.
256
+ */
257
+ export interface Extensions {
258
+ /**
259
+ * Catch-all for producer data that HDF does not model — the role heimdall2's
260
+ * `passthrough.auxiliary_data` played: fields a converter deliberately carried but had no
261
+ * home for.
262
+ *
263
+ * Deliberately permissive: unenumerated properties are accepted by design, with no shape
264
+ * imposed on them. HDF neither reads nor interprets what is here. It is the ONLY permissive
265
+ * surface in `extensions` — everything HDF does not define belongs here rather than beside
266
+ * it.
267
+ *
268
+ * This is NOT where the pre-converted source artifact goes. v2 put it here only because
269
+ * nothing else had room; `rawSourceArtifacts` is its home now, and it gives the bytes a
270
+ * checksum, a media type and a reference contract that an untyped object cannot.
271
+ *
272
+ * For data that belongs to one requirement rather than to the document, use that object's
273
+ * own fields — a document-level bag cannot say which requirement it describes.
274
+ */
275
+ passthrough?: {
276
+ [key: string]: any;
277
+ };
278
+ /**
279
+ * The input(s) this document was converted from, verbatim.
280
+ *
281
+ * An array because a conversion can consume more than one artifact — the OSCAL profile path
282
+ * takes a profile and a catalog. Every other converter takes one input, and an array of one
283
+ * costs nothing.
284
+ *
285
+ * Populating this is required of ingest converters by policy, enforced by the converter
286
+ * contract and test harness rather than by a schema `required`: a tool that emits HDF
287
+ * natively has no source artifact, and requiring the field would make valid native HDF
288
+ * invalid.
289
+ */
290
+ rawSourceArtifacts?: ExternalReference[];
291
+ }
248
292
  /**
249
293
  * A generalized reference to any external artifact by identity and/or location, modeled on the STIX
250
294
  * 2.1 `external_references` common property. Purpose-agnostic: cite a CVE, an ATT&CK technique, a
@@ -252,8 +296,11 @@ export interface Dependency {
252
296
  * HDF reference category. `sourceName` names the system; `externalId` cites by id within that
253
297
  * system; `href` locates it. `sourceName` + `externalId` is equivalently a URN
254
298
  * (`urn:<sourceName>:<externalId>`, RFC 8141), so the by-identity and by-location forms stay
255
- * interconvertible. A reference is inert context: it overrides nothing, so it carries only
256
- * lightweight optional `addedBy`/`addedAt` attribution, never override machinery.
299
+ * interconvertible. An entry may also carry the artifact itself rather than point at it: `document`
300
+ * for a JSON object, `content` + `encoding` for anything else. Embedding satisfies the at-least-one
301
+ * rule on its own, so an artifact with no meaningful public location needs no synthetic `href`. A
302
+ * reference is inert context: it overrides nothing, so it carries only lightweight optional
303
+ * `addedBy`/`addedAt` attribution, never override machinery.
257
304
  */
258
305
  export interface ExternalReference {
259
306
  /**
@@ -266,18 +313,36 @@ export interface ExternalReference {
266
313
  */
267
314
  addedBy?: Identity;
268
315
  /**
269
- * Integrity hash of the referenced artifact. Reuses the HDF `Checksum` primitive (not STIX
270
- * `hashes`). Meaningful only with a retrievable `href`.
316
+ * Integrity hash of the artifact. Reuses the HDF `Checksum` primitive (not STIX `hashes`).
317
+ * Applies both to an artifact retrievable at `href` and to one embedded here in `content`
318
+ * or `document` — beside embedded bytes it is what makes the copy verifiable rather than
319
+ * merely present.
271
320
  */
272
321
  checksum?: Checksum;
322
+ /**
323
+ * Optional lossless embedded copy of the artifact's bytes as a string, for artifacts
324
+ * `document` cannot hold: XML, CSV, NDJSON, plain text, a JSON array, or bytes that are not
325
+ * valid UTF-8 text at all.
326
+ *
327
+ * `encoding` states how to read it back and is required alongside it. Set `mediaType` so a
328
+ * consumer knows what the bytes are, and `checksum` so the copy can be verified against the
329
+ * source.
330
+ *
331
+ * Carried verbatim — never reformatted, re-indented, or re-serialized.
332
+ */
333
+ content?: string;
273
334
  /**
274
335
  * Human-readable description of what is referenced. Satisfies the at-least-one rule on its
275
336
  * own when neither id nor href is available.
276
337
  */
277
338
  description?: string;
278
339
  /**
279
- * Optional lossless embedded copy of the referenced artifact — the raw STIX object, EPSS
280
- * record, advisory, or annotation payload — preserved verbatim.
340
+ * Optional lossless embedded copy of the referenced artifact as a JSON object — the raw
341
+ * STIX object, EPSS record, advisory, or annotation payload — preserved verbatim.
342
+ *
343
+ * JSON objects only. An artifact that is not a JSON object (XML, CSV, NDJSON, plain text, a
344
+ * JSON array, or bytes that are not text at all) embeds through `content` + `encoding`
345
+ * instead.
281
346
  *
282
347
  * Composes with `href`/`externalId` (which point at the artifact) and `checksum` (which
283
348
  * ties the copy to the source): a single entry can both point and embed.
@@ -288,6 +353,15 @@ export interface ExternalReference {
288
353
  document?: {
289
354
  [key: string]: any;
290
355
  };
356
+ /**
357
+ * How to read `content` back into the artifact's bytes. 'utf-8' for text (XML, CSV, NDJSON,
358
+ * plain text, JavaScript-wrapped JSON); 'base64' for anything that is not valid UTF-8
359
+ * text.
360
+ *
361
+ * Required whenever `content` is present, and meaningless without it — an embedded copy
362
+ * whose encoding a consumer has to guess is not lossless.
363
+ */
364
+ encoding?: ExternalReferenceEncoding;
291
365
  /**
292
366
  * Identifier of the artifact within `sourceName` (e.g., 'CVE-2021-44228' for source 'cve',
293
367
  * 'T1059' for 'mitre-att&ck'). Cite by id without needing a URL. Together with `sourceName`
@@ -296,8 +370,8 @@ export interface ExternalReference {
296
370
  externalId?: string;
297
371
  /**
298
372
  * Location of the artifact. `uri-reference` (not `uri`) so a bare internal
299
- * `#fragment`/`#uuid` reference is expressible alongside absolute URLs.
300
- * `checksum`/`mediaType` apply only to a retrievable `href`.
373
+ * `#fragment`/`#uuid` reference is expressible alongside absolute URLs. Set it only when
374
+ * the location is meaningful to a reader — never a producer's local filesystem path.
301
375
  */
302
376
  href?: string;
303
377
  /**
@@ -314,8 +388,9 @@ export interface ExternalReference {
314
388
  */
315
389
  kind?: string;
316
390
  /**
317
- * IANA media type of the referenced artifact when retrievable (RFC 6838), e.g.,
318
- * 'application/json'. Meaningful only with `href`.
391
+ * IANA media type of the artifact (RFC 6838), e.g., 'application/json', 'application/xml',
392
+ * 'text/csv'. Applies both to an artifact retrievable at `href` and to one embedded here in
393
+ * `content` or `document`.
319
394
  */
320
395
  mediaType?: string;
321
396
  /**
@@ -394,8 +469,9 @@ export interface Checksum {
394
469
  [property: string]: any;
395
470
  }
396
471
  /**
397
- * Supported cryptographic hash algorithms for checksums and integrity verification. blake3 covers
398
- * container-image and other artifact digests that use it.
472
+ * Cryptographic hash algorithms a checksum or integrity record may name. blake3 covers
473
+ * container-image and other artifact digests that use it. HDF tooling verifies every algorithm in
474
+ * this enum, so any of them may be recorded where the checksum needs to be verifiable.
399
475
  */
400
476
  export declare enum HashAlgorithm {
401
477
  Blake3 = "blake3",
@@ -403,6 +479,20 @@ export declare enum HashAlgorithm {
403
479
  Sha384 = "sha384",
404
480
  Sha512 = "sha512"
405
481
  }
482
+ /**
483
+ * How to read `content` back into the artifact's bytes. 'utf-8' for text (XML, CSV, NDJSON,
484
+ * plain text, JavaScript-wrapped JSON); 'base64' for anything that is not valid UTF-8
485
+ * text.
486
+ *
487
+ * Required whenever `content` is present, and meaningless without it — an embedded copy
488
+ * whose encoding a consumer has to guess is not lossless.
489
+ *
490
+ * How to read `content`: 'utf-8' for text, 'base64' for bytes that are not valid UTF-8 text.
491
+ */
492
+ export declare enum ExternalReferenceEncoding {
493
+ Base64 = "base64",
494
+ UTF8 = "utf-8"
495
+ }
406
496
  /**
407
497
  * Describes a group of requirements, such as those defined in a single file.
408
498
  */
@@ -1303,6 +1393,13 @@ export interface RequirementResult {
1303
1393
  * explain why a test was not applicable or not reviewed.
1304
1394
  */
1305
1395
  message?: string;
1396
+ /**
1397
+ * The source tool's own record for this result, carrying every field the record had.
1398
+ * Complete, not necessarily byte-exact: see Raw_Source_Record.content for the producer and
1399
+ * consumer obligations, and extensions.rawSourceArtifacts[] when byte-exact carriage is
1400
+ * required.
1401
+ */
1402
+ rawSourceRecord?: RawSourceRecord;
1306
1403
  /**
1307
1404
  * The resource used in the test. Example: 'file', 'command', 'service'.
1308
1405
  */
@@ -1325,6 +1422,66 @@ export interface RequirementResult {
1325
1422
  status: ResultStatus;
1326
1423
  [property: string]: any;
1327
1424
  }
1425
+ /**
1426
+ * The source tool's own record for this result — the one entry in the converter's input that
1427
+ * produced it, complete though not necessarily byte-for-byte (see `content`). SCOPED TO THE RESULT
1428
+ * DELIBERATELY. For a vulnerability scanner the native record is one (vulnerability, package) pair,
1429
+ * which is exactly one result: a CVE reported against two packages yields two entries whose records
1430
+ * differ only in the package they matched. Held on the requirement instead, those two records would
1431
+ * collide, and merging entries that share an id would have to discard one — so the result is not
1432
+ * merely an available home but the correct one. Distinct from `extensions.rawSourceArtifacts[]`,
1433
+ * which carries whole input artifacts: this carries the one record inside one of them, and
1434
+ * `pointer` ties the two together. A consumer that wants the whole input reads the artifact; one
1435
+ * that wants provenance for a single finding reads this. Distinct from `code`, which means the code
1436
+ * that ran to evaluate the requirement — an InSpec control's source, or a check reference. A
1437
+ * serialized finding is not code, and putting one there overloaded a field whose meaning came from
1438
+ * InSpec. CLOSED, and deliberately not a passthrough bag: three required members and an optional
1439
+ * pointer are the whole of it. Producer data that HDF does not model belongs in
1440
+ * `extensions.passthrough`, which is document-scoped and permissive by design; this field is
1441
+ * neither. Closed with `additionalProperties` rather than the house `unevaluatedProperties` because
1442
+ * this definition composes nothing, and the shipped Go validator is a draft-07 engine that does not
1443
+ * implement `unevaluatedProperties` — a closure only one of the two validators enforces is not a
1444
+ * closure.
1445
+ */
1446
+ export interface RawSourceRecord {
1447
+ /**
1448
+ * The source tool's own record for this result, carrying every field the record had.
1449
+ *
1450
+ * COMPLETE, NOT NECESSARILY BYTE-EXACT. A producer SHOULD write the record's bytes
1451
+ * unchanged where it can. A producer that cannot — notably one implemented in two languages
1452
+ * whose JSON serializers disagree on key order, HTML escaping and number rendering, and
1453
+ * which therefore MUST canonicalize to stay byte-identical with its twin — MAY write a
1454
+ * canonically serialized form instead. Such a form preserves every field and value but not
1455
+ * the original key order, insignificant whitespace, or duplicate keys. A consumer MUST
1456
+ * therefore compare records by parsing them, not by comparing bytes, and MUST NOT checksum
1457
+ * this field and expect the result to match a checksum of the input.
1458
+ *
1459
+ * For carriage that IS byte-exact, use `extensions.rawSourceArtifacts[]`, which forbids a
1460
+ * parsed `document` precisely so the bytes and their checksum survive; `pointer` ties this
1461
+ * record to its position within that artifact.
1462
+ */
1463
+ content: string;
1464
+ /**
1465
+ * How to read `content`: 'utf-8' for text, 'base64' for bytes that are not valid UTF-8 text.
1466
+ */
1467
+ encoding: ExternalReferenceEncoding;
1468
+ /**
1469
+ * The record's IANA media type — the type of this record, which for a fragment of a larger
1470
+ * artifact may be narrower than the artifact's own. Example: 'application/json' for one
1471
+ * match object out of a JSON report.
1472
+ */
1473
+ mediaType: string;
1474
+ /**
1475
+ * Where this record sits inside the artifact it came from, as a JSON Pointer (RFC 6901) for
1476
+ * JSON sources or an XPath for XML ones. Example: '/matches/3'.
1477
+ *
1478
+ * Optional, and the link that makes carriage verifiable rather than merely present: with it
1479
+ * a consumer can confirm the record really is the subtree of
1480
+ * `extensions.rawSourceArtifacts[]` it claims to be. Omit it when the source's shape gives
1481
+ * a record no addressable location.
1482
+ */
1483
+ pointer?: string;
1484
+ }
1328
1485
  /**
1329
1486
  * Severity rating for a requirement. Typically derived from the numeric impact score.
1330
1487
  */
@@ -2328,6 +2485,11 @@ export interface HDFBaseline {
2328
2485
  * The set of dependencies this baseline depends on.
2329
2486
  */
2330
2487
  depends?: Dependency[];
2488
+ /**
2489
+ * Producer data outside the HDF model, and the pre-converted source artifact(s) this
2490
+ * baseline was converted from.
2491
+ */
2492
+ extensions?: Extensions;
2331
2493
  /**
2332
2494
  * The tool that generated this file.
2333
2495
  */
@@ -2536,11 +2698,10 @@ export interface HDFComparison {
2536
2698
  */
2537
2699
  drift?: RequirementDiff[];
2538
2700
  /**
2539
- * Reserved for tool-specific data not defined in the HDF standard.
2701
+ * Producer data outside the HDF model, and the pre-converted source artifact(s) this
2702
+ * comparison was derived from.
2540
2703
  */
2541
- extensions?: {
2542
- [key: string]: any;
2543
- };
2704
+ extensions?: Extensions;
2544
2705
  /**
2545
2706
  * Optional references to external artifacts relevant to this comparison (CTI/STIX,
2546
2707
  * advisories, or any URI-addressable artifact). Inert context; see External_Reference.
@@ -3303,6 +3464,11 @@ export interface HDFSystem {
3303
3464
  * Description of the system's purpose and mission.
3304
3465
  */
3305
3466
  description?: string;
3467
+ /**
3468
+ * Producer data outside the HDF model, and the pre-converted source artifact(s) this system
3469
+ * document was converted from.
3470
+ */
3471
+ extensions?: Extensions;
3306
3472
  /**
3307
3473
  * Optional references to external artifacts describing this system's threat environment or
3308
3474
  * context (CTI/STIX, BOMs, advisories, or any URI-addressable artifact). Inert context; see
@@ -3486,6 +3652,11 @@ export interface HDFPlan {
3486
3652
  * Description of the plan's purpose and scope.
3487
3653
  */
3488
3654
  description?: string;
3655
+ /**
3656
+ * Producer data outside the HDF model, and the pre-converted source artifact(s) this plan
3657
+ * was converted from.
3658
+ */
3659
+ extensions?: Extensions;
3489
3660
  /**
3490
3661
  * Optional references to external artifacts relevant to this assessment plan (CTI/STIX,
3491
3662
  * advisories, methodology docs, or any URI-addressable artifact). Inert context; see
@@ -3647,6 +3818,12 @@ export interface HDFAmendments {
3647
3818
  * Description of the amendments' purpose and scope.
3648
3819
  */
3649
3820
  description?: string;
3821
+ /**
3822
+ * Producer data outside the HDF model, and the pre-converted source artifact(s) these
3823
+ * amendments were converted from — the VEX family and oscal-poam-to-hdf all emit this
3824
+ * document type.
3825
+ */
3826
+ extensions?: Extensions;
3650
3827
  /**
3651
3828
  * Information about the tool that generated this document.
3652
3829
  */
@@ -3824,6 +4001,11 @@ export interface HDFEvidencePackage {
3824
4001
  * Description of the evidence package's purpose and scope.
3825
4002
  */
3826
4003
  description?: string;
4004
+ /**
4005
+ * Producer data outside the HDF model, and the pre-converted source artifact(s) this
4006
+ * package was assembled from.
4007
+ */
4008
+ extensions?: Extensions;
3827
4009
  /**
3828
4010
  * References to external native-format evidence (log/telemetry corpora and other artifacts)
3829
4011
  * carried by URI + integrity hash + format discriminator, without recreating the data
@@ -3957,7 +4139,17 @@ export interface ContentReference {
3957
4139
  */
3958
4140
  type: ContentType;
3959
4141
  /**
3960
- * URI to the document. Can be a relative path or absolute URL.
4142
+ * A uri-reference whose DECODED form is a path relative to the package document's own
4143
+ * directory — that is what the reference MEANS, independently of any one consumer.
4144
+ * Percent-escapes are part of the encoding, not the name: `my%20scans/q4.json` and `my
4145
+ * scans/q4.json` name the same file, and the escaped spelling is the one this field's
4146
+ * format admits. A consumer decodes before it resolves, never after, because decoding can
4147
+ * produce a parent traversal that containment must then see. It is never fetched: there is
4148
+ * no network retrieval anywhere in evidence handling. `uri-reference` admits shapes other
4149
+ * than a relative path and they stay schema-valid; how a consumer resolves one, and what it
4150
+ * does when it cannot, is that consumer's own contract. An artifact deliberately held
4151
+ * elsewhere belongs in externalEvidence[], which references it by URI and checksum without
4152
+ * retrieving it.
3961
4153
  */
3962
4154
  uri: string;
3963
4155
  [property: string]: any;
package/dist/ts/hdf.js CHANGED
@@ -18,8 +18,9 @@ export var IdentityType;
18
18
  IdentityType["Username"] = "username";
19
19
  })(IdentityType || (IdentityType = {}));
20
20
  /**
21
- * Supported cryptographic hash algorithms for checksums and integrity verification. blake3 covers
22
- * container-image and other artifact digests that use it.
21
+ * Cryptographic hash algorithms a checksum or integrity record may name. blake3 covers
22
+ * container-image and other artifact digests that use it. HDF tooling verifies every algorithm in
23
+ * this enum, so any of them may be recorded where the checksum needs to be verifiable.
23
24
  */
24
25
  export var HashAlgorithm;
25
26
  (function (HashAlgorithm) {
@@ -28,6 +29,21 @@ export var HashAlgorithm;
28
29
  HashAlgorithm["Sha384"] = "sha384";
29
30
  HashAlgorithm["Sha512"] = "sha512";
30
31
  })(HashAlgorithm || (HashAlgorithm = {}));
32
+ /**
33
+ * How to read `content` back into the artifact's bytes. 'utf-8' for text (XML, CSV, NDJSON,
34
+ * plain text, JavaScript-wrapped JSON); 'base64' for anything that is not valid UTF-8
35
+ * text.
36
+ *
37
+ * Required whenever `content` is present, and meaningless without it — an embedded copy
38
+ * whose encoding a consumer has to guess is not lossless.
39
+ *
40
+ * How to read `content`: 'utf-8' for text, 'base64' for bytes that are not valid UTF-8 text.
41
+ */
42
+ export var ExternalReferenceEncoding;
43
+ (function (ExternalReferenceEncoding) {
44
+ ExternalReferenceEncoding["Base64"] = "base64";
45
+ ExternalReferenceEncoding["UTF8"] = "utf-8";
46
+ })(ExternalReferenceEncoding || (ExternalReferenceEncoding = {}));
31
47
  /**
32
48
  * Comparison operator for evaluating the input value against observed values. Numeric:
33
49
  * eq/ne/lt/le/gt/ge. String: eq/ne/contains/matches. Collection: in/notIn.