@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.ts CHANGED
@@ -19,10 +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?: { [key: string]: any };
25
+ extensions?: Extensions;
26
26
  /**
27
27
  * Optional references to external artifacts (CTI/STIX, BOMs, advisories, runbooks, or any
28
28
  * URI-addressable artifact) relevant to this assessment as a whole. Inert context; see
@@ -101,9 +101,10 @@ export interface EvaluatedBaseline {
101
101
  */
102
102
  description?: string;
103
103
  /**
104
- * Reserved for tool-specific baseline metadata not defined in the HDF standard.
104
+ * Producer data outside the HDF model that belongs to this baseline rather than to the
105
+ * document, and the pre-converted source artifact(s) this baseline was built from.
105
106
  */
106
- extensions?: { [key: string]: any };
107
+ extensions?: Extensions;
107
108
  /**
108
109
  * A set of descriptions for the requirement groups.
109
110
  */
@@ -242,6 +243,52 @@ export interface Dependency {
242
243
  [property: string]: any;
243
244
  }
244
245
 
246
+ /**
247
+ * Carrier for data outside the HDF model: `passthrough` for producer data HDF does not model,
248
+ * `rawSourceArtifacts` for the pre-converted input(s). CLOSED: these two members are the whole of
249
+ * it. A key HDF does not define goes inside `passthrough` — that is what `passthrough` is for — so
250
+ * `extensions` never becomes a second, unnamed schema that consumers must reverse-engineer from the
251
+ * producers that happen to write it. Closed with `additionalProperties` rather than the house
252
+ * `unevaluatedProperties` because this definition composes nothing, and the shipped Go validator is
253
+ * a draft-07 engine that does not implement `unevaluatedProperties` — a closure only one of the two
254
+ * validators enforces is not a closure. Declared on every HDF document type that carries a producer
255
+ * envelope (`generator` / `integrity`), and on `Evaluated_Baseline`, so one rule governs both
256
+ * sites.
257
+ */
258
+ export interface Extensions {
259
+ /**
260
+ * Catch-all for producer data that HDF does not model — the role heimdall2's
261
+ * `passthrough.auxiliary_data` played: fields a converter deliberately carried but had no
262
+ * home for.
263
+ *
264
+ * Deliberately permissive: unenumerated properties are accepted by design, with no shape
265
+ * imposed on them. HDF neither reads nor interprets what is here. It is the ONLY permissive
266
+ * surface in `extensions` — everything HDF does not define belongs here rather than beside
267
+ * it.
268
+ *
269
+ * This is NOT where the pre-converted source artifact goes. v2 put it here only because
270
+ * nothing else had room; `rawSourceArtifacts` is its home now, and it gives the bytes a
271
+ * checksum, a media type and a reference contract that an untyped object cannot.
272
+ *
273
+ * For data that belongs to one requirement rather than to the document, use that object's
274
+ * own fields — a document-level bag cannot say which requirement it describes.
275
+ */
276
+ passthrough?: { [key: string]: any };
277
+ /**
278
+ * The input(s) this document was converted from, verbatim.
279
+ *
280
+ * An array because a conversion can consume more than one artifact — the OSCAL profile path
281
+ * takes a profile and a catalog. Every other converter takes one input, and an array of one
282
+ * costs nothing.
283
+ *
284
+ * Populating this is required of ingest converters by policy, enforced by the converter
285
+ * contract and test harness rather than by a schema `required`: a tool that emits HDF
286
+ * natively has no source artifact, and requiring the field would make valid native HDF
287
+ * invalid.
288
+ */
289
+ rawSourceArtifacts?: ExternalReference[];
290
+ }
291
+
245
292
  /**
246
293
  * A generalized reference to any external artifact by identity and/or location, modeled on the STIX
247
294
  * 2.1 `external_references` common property. Purpose-agnostic: cite a CVE, an ATT&CK technique, a
@@ -249,8 +296,11 @@ export interface Dependency {
249
296
  * HDF reference category. `sourceName` names the system; `externalId` cites by id within that
250
297
  * system; `href` locates it. `sourceName` + `externalId` is equivalently a URN
251
298
  * (`urn:<sourceName>:<externalId>`, RFC 8141), so the by-identity and by-location forms stay
252
- * interconvertible. A reference is inert context: it overrides nothing, so it carries only
253
- * 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.
254
304
  */
255
305
  export interface ExternalReference {
256
306
  /**
@@ -263,18 +313,36 @@ export interface ExternalReference {
263
313
  */
264
314
  addedBy?: Identity;
265
315
  /**
266
- * Integrity hash of the referenced artifact. Reuses the HDF `Checksum` primitive (not STIX
267
- * `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.
268
320
  */
269
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;
270
334
  /**
271
335
  * Human-readable description of what is referenced. Satisfies the at-least-one rule on its
272
336
  * own when neither id nor href is available.
273
337
  */
274
338
  description?: string;
275
339
  /**
276
- * Optional lossless embedded copy of the referenced artifact — the raw STIX object, EPSS
277
- * 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.
278
346
  *
279
347
  * Composes with `href`/`externalId` (which point at the artifact) and `checksum` (which
280
348
  * ties the copy to the source): a single entry can both point and embed.
@@ -283,6 +351,15 @@ export interface ExternalReference {
283
351
  * fields — so this does not duplicate the source ontology (e.g. STIX rides here unchanged).
284
352
  */
285
353
  document?: { [key: string]: any };
354
+ /**
355
+ * How to read `content` back into the artifact's bytes. 'utf-8' for text (XML, CSV, NDJSON,
356
+ * plain text, JavaScript-wrapped JSON); 'base64' for anything that is not valid UTF-8
357
+ * text.
358
+ *
359
+ * Required whenever `content` is present, and meaningless without it — an embedded copy
360
+ * whose encoding a consumer has to guess is not lossless.
361
+ */
362
+ encoding?: ExternalReferenceEncoding;
286
363
  /**
287
364
  * Identifier of the artifact within `sourceName` (e.g., 'CVE-2021-44228' for source 'cve',
288
365
  * 'T1059' for 'mitre-att&ck'). Cite by id without needing a URL. Together with `sourceName`
@@ -291,8 +368,8 @@ export interface ExternalReference {
291
368
  externalId?: string;
292
369
  /**
293
370
  * Location of the artifact. `uri-reference` (not `uri`) so a bare internal
294
- * `#fragment`/`#uuid` reference is expressible alongside absolute URLs.
295
- * `checksum`/`mediaType` apply only to a retrievable `href`.
371
+ * `#fragment`/`#uuid` reference is expressible alongside absolute URLs. Set it only when
372
+ * the location is meaningful to a reader — never a producer's local filesystem path.
296
373
  */
297
374
  href?: string;
298
375
  /**
@@ -309,8 +386,9 @@ export interface ExternalReference {
309
386
  */
310
387
  kind?: string;
311
388
  /**
312
- * IANA media type of the referenced artifact when retrievable (RFC 6838), e.g.,
313
- * 'application/json'. Meaningful only with `href`.
389
+ * IANA media type of the artifact (RFC 6838), e.g., 'application/json', 'application/xml',
390
+ * 'text/csv'. Applies both to an artifact retrievable at `href` and to one embedded here in
391
+ * `content` or `document`.
314
392
  */
315
393
  mediaType?: string;
316
394
  /**
@@ -393,8 +471,9 @@ export interface Checksum {
393
471
  }
394
472
 
395
473
  /**
396
- * Supported cryptographic hash algorithms for checksums and integrity verification. blake3 covers
397
- * container-image and other artifact digests that use it.
474
+ * Cryptographic hash algorithms a checksum or integrity record may name. blake3 covers
475
+ * container-image and other artifact digests that use it. HDF tooling verifies every algorithm in
476
+ * this enum, so any of them may be recorded where the checksum needs to be verifiable.
398
477
  */
399
478
  export enum HashAlgorithm {
400
479
  Blake3 = "blake3",
@@ -403,6 +482,21 @@ export enum HashAlgorithm {
403
482
  Sha512 = "sha512",
404
483
  }
405
484
 
485
+ /**
486
+ * How to read `content` back into the artifact's bytes. 'utf-8' for text (XML, CSV, NDJSON,
487
+ * plain text, JavaScript-wrapped JSON); 'base64' for anything that is not valid UTF-8
488
+ * text.
489
+ *
490
+ * Required whenever `content` is present, and meaningless without it — an embedded copy
491
+ * whose encoding a consumer has to guess is not lossless.
492
+ *
493
+ * How to read `content`: 'utf-8' for text, 'base64' for bytes that are not valid UTF-8 text.
494
+ */
495
+ export enum ExternalReferenceEncoding {
496
+ Base64 = "base64",
497
+ UTF8 = "utf-8",
498
+ }
499
+
406
500
  /**
407
501
  * Describes a group of requirements, such as those defined in a single file.
408
502
  */
@@ -1325,6 +1419,13 @@ export interface RequirementResult {
1325
1419
  * explain why a test was not applicable or not reviewed.
1326
1420
  */
1327
1421
  message?: string;
1422
+ /**
1423
+ * The source tool's own record for this result, carrying every field the record had.
1424
+ * Complete, not necessarily byte-exact: see Raw_Source_Record.content for the producer and
1425
+ * consumer obligations, and extensions.rawSourceArtifacts[] when byte-exact carriage is
1426
+ * required.
1427
+ */
1428
+ rawSourceRecord?: RawSourceRecord;
1328
1429
  /**
1329
1430
  * The resource used in the test. Example: 'file', 'command', 'service'.
1330
1431
  */
@@ -1348,6 +1449,67 @@ export interface RequirementResult {
1348
1449
  [property: string]: any;
1349
1450
  }
1350
1451
 
1452
+ /**
1453
+ * The source tool's own record for this result — the one entry in the converter's input that
1454
+ * produced it, complete though not necessarily byte-for-byte (see `content`). SCOPED TO THE RESULT
1455
+ * DELIBERATELY. For a vulnerability scanner the native record is one (vulnerability, package) pair,
1456
+ * which is exactly one result: a CVE reported against two packages yields two entries whose records
1457
+ * differ only in the package they matched. Held on the requirement instead, those two records would
1458
+ * collide, and merging entries that share an id would have to discard one — so the result is not
1459
+ * merely an available home but the correct one. Distinct from `extensions.rawSourceArtifacts[]`,
1460
+ * which carries whole input artifacts: this carries the one record inside one of them, and
1461
+ * `pointer` ties the two together. A consumer that wants the whole input reads the artifact; one
1462
+ * that wants provenance for a single finding reads this. Distinct from `code`, which means the code
1463
+ * that ran to evaluate the requirement — an InSpec control's source, or a check reference. A
1464
+ * serialized finding is not code, and putting one there overloaded a field whose meaning came from
1465
+ * InSpec. CLOSED, and deliberately not a passthrough bag: three required members and an optional
1466
+ * pointer are the whole of it. Producer data that HDF does not model belongs in
1467
+ * `extensions.passthrough`, which is document-scoped and permissive by design; this field is
1468
+ * neither. Closed with `additionalProperties` rather than the house `unevaluatedProperties` because
1469
+ * this definition composes nothing, and the shipped Go validator is a draft-07 engine that does not
1470
+ * implement `unevaluatedProperties` — a closure only one of the two validators enforces is not a
1471
+ * closure.
1472
+ */
1473
+ export interface RawSourceRecord {
1474
+ /**
1475
+ * The source tool's own record for this result, carrying every field the record had.
1476
+ *
1477
+ * COMPLETE, NOT NECESSARILY BYTE-EXACT. A producer SHOULD write the record's bytes
1478
+ * unchanged where it can. A producer that cannot — notably one implemented in two languages
1479
+ * whose JSON serializers disagree on key order, HTML escaping and number rendering, and
1480
+ * which therefore MUST canonicalize to stay byte-identical with its twin — MAY write a
1481
+ * canonically serialized form instead. Such a form preserves every field and value but not
1482
+ * the original key order, insignificant whitespace, or duplicate keys. A consumer MUST
1483
+ * therefore compare records by parsing them, not by comparing bytes, and MUST NOT checksum
1484
+ * this field and expect the result to match a checksum of the input.
1485
+ *
1486
+ * For carriage that IS byte-exact, use `extensions.rawSourceArtifacts[]`, which forbids a
1487
+ * parsed `document` precisely so the bytes and their checksum survive; `pointer` ties this
1488
+ * record to its position within that artifact.
1489
+ */
1490
+ content: string;
1491
+ /**
1492
+ * How to read `content`: 'utf-8' for text, 'base64' for bytes that are not valid UTF-8 text.
1493
+ */
1494
+ encoding: ExternalReferenceEncoding;
1495
+ /**
1496
+ * The record's IANA media type — the type of this record, which for a fragment of a larger
1497
+ * artifact may be narrower than the artifact's own. Example: 'application/json' for one
1498
+ * match object out of a JSON report.
1499
+ */
1500
+ mediaType: string;
1501
+ /**
1502
+ * Where this record sits inside the artifact it came from, as a JSON Pointer (RFC 6901) for
1503
+ * JSON sources or an XPath for XML ones. Example: '/matches/3'.
1504
+ *
1505
+ * Optional, and the link that makes carriage verifiable rather than merely present: with it
1506
+ * a consumer can confirm the record really is the subtree of
1507
+ * `extensions.rawSourceArtifacts[]` it claims to be. Omit it when the source's shape gives
1508
+ * a record no addressable location.
1509
+ */
1510
+ pointer?: string;
1511
+ }
1512
+
1351
1513
  /**
1352
1514
  * Severity rating for a requirement. Typically derived from the numeric impact score.
1353
1515
  */
@@ -2372,6 +2534,11 @@ export interface HDFBaseline {
2372
2534
  * The set of dependencies this baseline depends on.
2373
2535
  */
2374
2536
  depends?: Dependency[];
2537
+ /**
2538
+ * Producer data outside the HDF model, and the pre-converted source artifact(s) this
2539
+ * baseline was converted from.
2540
+ */
2541
+ extensions?: Extensions;
2375
2542
  /**
2376
2543
  * The tool that generated this file.
2377
2544
  */
@@ -2576,9 +2743,10 @@ export interface HDFComparison {
2576
2743
  */
2577
2744
  drift?: RequirementDiff[];
2578
2745
  /**
2579
- * Reserved for tool-specific data not defined in the HDF standard.
2746
+ * Producer data outside the HDF model, and the pre-converted source artifact(s) this
2747
+ * comparison was derived from.
2580
2748
  */
2581
- extensions?: { [key: string]: any };
2749
+ extensions?: Extensions;
2582
2750
  /**
2583
2751
  * Optional references to external artifacts relevant to this comparison (CTI/STIX,
2584
2752
  * advisories, or any URI-addressable artifact). Inert context; see External_Reference.
@@ -3365,6 +3533,11 @@ export interface HDFSystem {
3365
3533
  * Description of the system's purpose and mission.
3366
3534
  */
3367
3535
  description?: string;
3536
+ /**
3537
+ * Producer data outside the HDF model, and the pre-converted source artifact(s) this system
3538
+ * document was converted from.
3539
+ */
3540
+ extensions?: Extensions;
3368
3541
  /**
3369
3542
  * Optional references to external artifacts describing this system's threat environment or
3370
3543
  * context (CTI/STIX, BOMs, advisories, or any URI-addressable artifact). Inert context; see
@@ -3553,6 +3726,11 @@ export interface HDFPlan {
3553
3726
  * Description of the plan's purpose and scope.
3554
3727
  */
3555
3728
  description?: string;
3729
+ /**
3730
+ * Producer data outside the HDF model, and the pre-converted source artifact(s) this plan
3731
+ * was converted from.
3732
+ */
3733
+ extensions?: Extensions;
3556
3734
  /**
3557
3735
  * Optional references to external artifacts relevant to this assessment plan (CTI/STIX,
3558
3736
  * advisories, methodology docs, or any URI-addressable artifact). Inert context; see
@@ -3713,6 +3891,12 @@ export interface HDFAmendments {
3713
3891
  * Description of the amendments' purpose and scope.
3714
3892
  */
3715
3893
  description?: string;
3894
+ /**
3895
+ * Producer data outside the HDF model, and the pre-converted source artifact(s) these
3896
+ * amendments were converted from — the VEX family and oscal-poam-to-hdf all emit this
3897
+ * document type.
3898
+ */
3899
+ extensions?: Extensions;
3716
3900
  /**
3717
3901
  * Information about the tool that generated this document.
3718
3902
  */
@@ -3890,6 +4074,11 @@ export interface HDFEvidencePackage {
3890
4074
  * Description of the evidence package's purpose and scope.
3891
4075
  */
3892
4076
  description?: string;
4077
+ /**
4078
+ * Producer data outside the HDF model, and the pre-converted source artifact(s) this
4079
+ * package was assembled from.
4080
+ */
4081
+ extensions?: Extensions;
3893
4082
  /**
3894
4083
  * References to external native-format evidence (log/telemetry corpora and other artifacts)
3895
4084
  * carried by URI + integrity hash + format discriminator, without recreating the data
@@ -4024,7 +4213,17 @@ export interface ContentReference {
4024
4213
  */
4025
4214
  type: ContentType;
4026
4215
  /**
4027
- * URI to the document. Can be a relative path or absolute URL.
4216
+ * A uri-reference whose DECODED form is a path relative to the package document's own
4217
+ * directory — that is what the reference MEANS, independently of any one consumer.
4218
+ * Percent-escapes are part of the encoding, not the name: `my%20scans/q4.json` and `my
4219
+ * scans/q4.json` name the same file, and the escaped spelling is the one this field's
4220
+ * format admits. A consumer decodes before it resolves, never after, because decoding can
4221
+ * produce a parent traversal that containment must then see. It is never fetched: there is
4222
+ * no network retrieval anywhere in evidence handling. `uri-reference` admits shapes other
4223
+ * than a relative path and they stay schema-valid; how a consumer resolves one, and what it
4224
+ * does when it cannot, is that consumer's own contract. An artifact deliberately held
4225
+ * elsewhere belongs in externalEvidence[], which references it by URI and checksum without
4226
+ * retrieving it.
4028
4227
  */
4029
4228
  uri: string;
4030
4229
  [property: string]: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mitre/hdf-schema",
3
- "version": "3.7.2",
3
+ "version": "3.8.0-next.42532249979.1",
4
4
  "description": "JSON schemas and multi-language type definitions for Heimdall Data Format (HDF)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -63,9 +63,9 @@
63
63
  "author": "MITRE Corporation",
64
64
  "license": "Apache-2.0",
65
65
  "dependencies": {
66
+ "@mitre/hdf-utilities": "3.8.0-next.42532249979.1",
66
67
  "ajv": "^8.17.0",
67
- "ajv-formats": "^3.0.0",
68
- "@mitre/hdf-utilities": "^3.7.2"
68
+ "ajv-formats": "^3.0.0"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@hyperjump/json-schema": "^1.17.2",