@mitre/hdf-validators 3.6.0-rc.5 → 3.7.0-rc.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/README.md +2 -1
- package/dist/index.d.ts +17 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +583 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -101,7 +101,8 @@ if (!baselineResult.valid) {
|
|
|
101
101
|
import { validate } from '@mitre/hdf-validators';
|
|
102
102
|
|
|
103
103
|
const autoResult = validate(someHdfDocument);
|
|
104
|
-
//
|
|
104
|
+
// Determines the document type — Results, Baseline, System, Plan, Amendments,
|
|
105
|
+
// Comparison or Evidence Package — and validates against that schema
|
|
105
106
|
```
|
|
106
107
|
|
|
107
108
|
### Go
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Validation error details
|
|
4
4
|
*/
|
|
5
|
-
interface ValidationError {
|
|
5
|
+
export interface ValidationError {
|
|
6
6
|
field: string;
|
|
7
7
|
message: string;
|
|
8
8
|
value?: unknown;
|
|
@@ -18,7 +18,7 @@ interface ValidationError {
|
|
|
18
18
|
/**
|
|
19
19
|
* Result of schema validation
|
|
20
20
|
*/
|
|
21
|
-
interface ValidationResult {
|
|
21
|
+
export interface ValidationResult {
|
|
22
22
|
valid: boolean;
|
|
23
23
|
errors: ValidationError[];
|
|
24
24
|
getErrorMessage(): string;
|
|
@@ -26,39 +26,44 @@ interface ValidationResult {
|
|
|
26
26
|
/**
|
|
27
27
|
* Validate HDF Results document against schema
|
|
28
28
|
*/
|
|
29
|
-
declare function validateResults(data: unknown): ValidationResult;
|
|
29
|
+
export declare function validateResults(data: unknown): ValidationResult;
|
|
30
|
+
/**
|
|
31
|
+
* Validate a legacy HDF v2 document — the Heimdall/InSpec exec-json shape
|
|
32
|
+
* (profiles[] + platform) SAF converters emit — against the pinned exec-json
|
|
33
|
+
* schema, at the same Ajv rigor as the v3 validators.
|
|
34
|
+
*/
|
|
35
|
+
export declare function validateLegacyV2(data: unknown): ValidationResult;
|
|
30
36
|
/**
|
|
31
37
|
* Validate HDF Baseline document against schema
|
|
32
38
|
*/
|
|
33
|
-
declare function validateBaseline(data: unknown): ValidationResult;
|
|
39
|
+
export declare function validateBaseline(data: unknown): ValidationResult;
|
|
34
40
|
/**
|
|
35
41
|
* Validate HDF Comparison document against schema
|
|
36
42
|
*/
|
|
37
|
-
declare function validateComparison(data: unknown): ValidationResult;
|
|
43
|
+
export declare function validateComparison(data: unknown): ValidationResult;
|
|
38
44
|
/**
|
|
39
45
|
* Validate an HDF Requirement Change Event (one continuous-monitoring wire event) against schema
|
|
40
46
|
*/
|
|
41
|
-
declare function validateRequirementChangeEvent(data: unknown): ValidationResult;
|
|
47
|
+
export declare function validateRequirementChangeEvent(data: unknown): ValidationResult;
|
|
42
48
|
/**
|
|
43
49
|
* Validate HDF System document against schema
|
|
44
50
|
*/
|
|
45
|
-
declare function validateSystem(data: unknown): ValidationResult;
|
|
51
|
+
export declare function validateSystem(data: unknown): ValidationResult;
|
|
46
52
|
/**
|
|
47
53
|
* Validate HDF Plan document against schema
|
|
48
54
|
*/
|
|
49
|
-
declare function validatePlan(data: unknown): ValidationResult;
|
|
55
|
+
export declare function validatePlan(data: unknown): ValidationResult;
|
|
50
56
|
/**
|
|
51
57
|
* Validate HDF Amendments document against schema
|
|
52
58
|
*/
|
|
53
|
-
declare function validateAmendments(data: unknown): ValidationResult;
|
|
59
|
+
export declare function validateAmendments(data: unknown): ValidationResult;
|
|
54
60
|
/**
|
|
55
61
|
* Validate HDF Evidence Package document against schema
|
|
56
62
|
*/
|
|
57
|
-
declare function validateEvidencePackage(data: unknown): ValidationResult;
|
|
63
|
+
export declare function validateEvidencePackage(data: unknown): ValidationResult;
|
|
58
64
|
/**
|
|
59
65
|
* Validate HDF document (auto-detect type based on structure)
|
|
60
66
|
*/
|
|
61
|
-
declare function validate(data: unknown): ValidationResult;
|
|
67
|
+
export declare function validate(data: unknown): ValidationResult;
|
|
62
68
|
//#endregion
|
|
63
|
-
export { ValidationError, ValidationResult, validate, validateAmendments, validateBaseline, validateComparison, validateEvidencePackage, validatePlan, validateRequirementChangeEvent, validateResults, validateSystem };
|
|
64
69
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../typescript/index.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../typescript/index.ts"],"mappings":";;;;iBA8CiB;EACf;EACA;EACA;;;;;;EAMA;;EAEA;;;;;iBAMe;EACf;EACA,QAAQ;EACR;;;;;wBAmNc,gBAAgB,gBAAgB;;;;;;wBAuBhC,iBAAiB,gBAAgB;;;;wBAOjC,iBAAiB,gBAAgB;;;;wBAQjC,mBAAmB,gBAAgB;;;;wBAQnC,+BAA+B,gBAAgB;;;;wBAQ/C,eAAe,gBAAgB;;;;wBAQ/B,aAAa,gBAAgB;;;;wBAQ7B,mBAAmB,gBAAgB;;;;wBAQnC,wBAAwB,gBAAgB;;;;wBAQxC,SAAS,gBAAgB"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,566 @@
|
|
|
1
1
|
import Ajv from "ajv";
|
|
2
2
|
import addFormats from "ajv-formats";
|
|
3
3
|
import { affectedPackageSchema, amendmentsSchema, bomSchema, commonSchema, comparisonSchema, componentSchema, cvssSchema, dataFlowSchema, epssSchema, eventsSchema, extensionsSchema, hdfAmendmentsSchema, hdfBaselineSchema, hdfComparisonSchema, hdfEvidencePackageSchema, hdfPlanSchema, hdfRequirementChangeEventSchema, hdfResultsSchema, hdfSystemSchema, kevSchema, parameterSchema, planSchema, platformSchema, resultSchema, runnerSchema, statisticsSchema, systemSchema, targetSchema } from "@mitre/hdf-schema";
|
|
4
|
+
//#region typescript/legacy-exec-json.schema.json
|
|
5
|
+
var legacy_exec_json_schema_default = {
|
|
6
|
+
type: "object",
|
|
7
|
+
additionalProperties: true,
|
|
8
|
+
required: [
|
|
9
|
+
"platform",
|
|
10
|
+
"profiles",
|
|
11
|
+
"statistics",
|
|
12
|
+
"version"
|
|
13
|
+
],
|
|
14
|
+
properties: {
|
|
15
|
+
"platform": {
|
|
16
|
+
"$ref": "#/definitions/Platform",
|
|
17
|
+
"description": "Information on the platform the run from the tool that generated the findings was from. Example: the name of the operating system."
|
|
18
|
+
},
|
|
19
|
+
"profiles": {
|
|
20
|
+
"type": "array",
|
|
21
|
+
"items": { "$ref": "#/definitions/Exec_JSON_Profile" },
|
|
22
|
+
"description": "Information on the run(s) from the tool that generated the findings. Example: the findings."
|
|
23
|
+
},
|
|
24
|
+
"statistics": {
|
|
25
|
+
"$ref": "#/definitions/Statistics",
|
|
26
|
+
"description": "Statistics for the run(s) from the tool that generated the findings. Example: the runtime duration."
|
|
27
|
+
},
|
|
28
|
+
"version": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "Version number of the tool that generated the findings. Example: '4.18.108' is a version of Chef InSpec."
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
description: "The top level value containing all of the results.",
|
|
34
|
+
title: "Exec JSON Output",
|
|
35
|
+
definitions: {
|
|
36
|
+
"Control_Description": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"additionalProperties": true,
|
|
39
|
+
"required": ["label", "data"],
|
|
40
|
+
"properties": {
|
|
41
|
+
"label": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"description": "The type of description. Examples: 'fix' or 'check'."
|
|
44
|
+
},
|
|
45
|
+
"data": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"description": "The text of the description."
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"description": "A description for a control.",
|
|
51
|
+
"title": "Control Description"
|
|
52
|
+
},
|
|
53
|
+
"Control_Group": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"additionalProperties": true,
|
|
56
|
+
"required": ["id", "controls"],
|
|
57
|
+
"properties": {
|
|
58
|
+
"id": {
|
|
59
|
+
"type": "string",
|
|
60
|
+
"description": "The unique identifier for the group. Example: the relative path to the file specifying the controls."
|
|
61
|
+
},
|
|
62
|
+
"title": {
|
|
63
|
+
"type": ["null", "string"],
|
|
64
|
+
"description": "The title of the group - should be human readable."
|
|
65
|
+
},
|
|
66
|
+
"controls": {
|
|
67
|
+
"type": "array",
|
|
68
|
+
"items": { "type": "string" },
|
|
69
|
+
"description": "The set of controls as specified by their ids in this group. Example: 'V-75443'."
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"description": "Descriptions for controls in a group, such as the list of all the controls.",
|
|
73
|
+
"title": "Control Group"
|
|
74
|
+
},
|
|
75
|
+
"Control_Result": {
|
|
76
|
+
"type": "object",
|
|
77
|
+
"additionalProperties": true,
|
|
78
|
+
"required": ["code_desc", "start_time"],
|
|
79
|
+
"properties": {
|
|
80
|
+
"status": { "anyOf": [{
|
|
81
|
+
"$ref": "#/definitions/Control_Result_Status",
|
|
82
|
+
"description": "The status of this test within the control. Example: 'failed'."
|
|
83
|
+
}, { "type": "null" }] },
|
|
84
|
+
"code_desc": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"description": "A description of this test. Example: 'limits.conf * is expected to include ['hard', 'maxlogins', '10']."
|
|
87
|
+
},
|
|
88
|
+
"run_time": {
|
|
89
|
+
"type": ["number", "null"],
|
|
90
|
+
"description": "The execution time in seconds for the test."
|
|
91
|
+
},
|
|
92
|
+
"start_time": {
|
|
93
|
+
"type": "string",
|
|
94
|
+
"description": "The time at which the test started."
|
|
95
|
+
},
|
|
96
|
+
"resource": {
|
|
97
|
+
"type": ["string", "null"],
|
|
98
|
+
"description": "The resource used in the test. Example: in Inspec, you can use the 'File' resource."
|
|
99
|
+
},
|
|
100
|
+
"message": {
|
|
101
|
+
"type": ["string", "null"],
|
|
102
|
+
"description": "An explanation of the test status - usually only provided when the test fails."
|
|
103
|
+
},
|
|
104
|
+
"skip_message": {
|
|
105
|
+
"type": ["string", "null"],
|
|
106
|
+
"description": "An explanation of the test status if the status was 'skipped."
|
|
107
|
+
},
|
|
108
|
+
"exception": {
|
|
109
|
+
"type": ["string", "null"],
|
|
110
|
+
"description": "The type of exception if an exception was thrown."
|
|
111
|
+
},
|
|
112
|
+
"resource_id": {
|
|
113
|
+
"$comment": "Local deviation from Heimdall's inspecjs schema: real InSpec emits an object-valued resource_id (GitHub #328, ~2% of results); accepted so real docs validate.",
|
|
114
|
+
"type": [
|
|
115
|
+
"string",
|
|
116
|
+
"null",
|
|
117
|
+
"object"
|
|
118
|
+
],
|
|
119
|
+
"description": "The unique identifier of the resource."
|
|
120
|
+
},
|
|
121
|
+
"backtrace": {
|
|
122
|
+
"anyOf": [{
|
|
123
|
+
"type": "array",
|
|
124
|
+
"items": { "type": "string" }
|
|
125
|
+
}, { "type": "null" }],
|
|
126
|
+
"description": "The stacktrace/backtrace of the exception if one occurred."
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"description": "A test within a control and its results and findings such as how long it took to run.",
|
|
130
|
+
"title": "Control Result"
|
|
131
|
+
},
|
|
132
|
+
"Control_Result_Status": {
|
|
133
|
+
"type": "string",
|
|
134
|
+
"enum": [
|
|
135
|
+
"passed",
|
|
136
|
+
"failed",
|
|
137
|
+
"skipped",
|
|
138
|
+
"error"
|
|
139
|
+
],
|
|
140
|
+
"description": "The status of a control. Should be one of 'passed', 'failed', 'skipped', or 'error'.",
|
|
141
|
+
"title": "Control Result Status"
|
|
142
|
+
},
|
|
143
|
+
"Dependency": {
|
|
144
|
+
"type": "object",
|
|
145
|
+
"additionalProperties": true,
|
|
146
|
+
"required": [],
|
|
147
|
+
"properties": {
|
|
148
|
+
"name": {
|
|
149
|
+
"type": ["string", "null"],
|
|
150
|
+
"description": "The name/assigned alias."
|
|
151
|
+
},
|
|
152
|
+
"url": {
|
|
153
|
+
"type": ["string", "null"],
|
|
154
|
+
"description": "The address of the dependency."
|
|
155
|
+
},
|
|
156
|
+
"branch": {
|
|
157
|
+
"type": ["string", "null"],
|
|
158
|
+
"description": "The branch name for a git repo."
|
|
159
|
+
},
|
|
160
|
+
"path": {
|
|
161
|
+
"type": ["string", "null"],
|
|
162
|
+
"description": "The relative path if the dependency is locally available."
|
|
163
|
+
},
|
|
164
|
+
"status_message": {
|
|
165
|
+
"type": ["string", "null"],
|
|
166
|
+
"description": "The reason for the status if it is 'failed' or 'skipped'."
|
|
167
|
+
},
|
|
168
|
+
"status": {
|
|
169
|
+
"type": ["string", "null"],
|
|
170
|
+
"description": "The status. Should be: 'loaded', 'failed', or 'skipped'."
|
|
171
|
+
},
|
|
172
|
+
"git": {
|
|
173
|
+
"type": ["string", "null"],
|
|
174
|
+
"description": "The location of the git repo. Example: 'https://github.com/mitre/canonical-ubuntu-18.04-lts-stig-baseline.git'."
|
|
175
|
+
},
|
|
176
|
+
"supermarket": {
|
|
177
|
+
"type": ["string", "null"],
|
|
178
|
+
"description": "The 'user/profilename' attribute for a Supermarket server."
|
|
179
|
+
},
|
|
180
|
+
"compliance": {
|
|
181
|
+
"type": ["string", "null"],
|
|
182
|
+
"description": "The 'user/profilename' attribute for an Automate server."
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
"description": "A dependency for a profile. Can include relative paths or urls for where to find the dependency.",
|
|
186
|
+
"title": "Dependency"
|
|
187
|
+
},
|
|
188
|
+
"Exec_JSON_Control": {
|
|
189
|
+
"type": "object",
|
|
190
|
+
"additionalProperties": true,
|
|
191
|
+
"$comment": "Local deviation: 'impact' is not required — real InSpec/Heimdall output includes controls that omit it.",
|
|
192
|
+
"required": [
|
|
193
|
+
"id",
|
|
194
|
+
"refs",
|
|
195
|
+
"tags",
|
|
196
|
+
"source_location",
|
|
197
|
+
"results"
|
|
198
|
+
],
|
|
199
|
+
"properties": {
|
|
200
|
+
"id": {
|
|
201
|
+
"type": "string",
|
|
202
|
+
"description": "The id."
|
|
203
|
+
},
|
|
204
|
+
"title": {
|
|
205
|
+
"type": ["null", "string"],
|
|
206
|
+
"description": "The title - is nullable."
|
|
207
|
+
},
|
|
208
|
+
"desc": {
|
|
209
|
+
"type": ["null", "string"],
|
|
210
|
+
"description": "The description for the overarching control."
|
|
211
|
+
},
|
|
212
|
+
"descriptions": {
|
|
213
|
+
"type": ["array", "null"],
|
|
214
|
+
"items": { "$ref": "#/definitions/Control_Description" },
|
|
215
|
+
"description": "A set of additional descriptions. Example: the 'fix' text."
|
|
216
|
+
},
|
|
217
|
+
"impact": {
|
|
218
|
+
"type": "number",
|
|
219
|
+
"minimum": 0,
|
|
220
|
+
"maximum": 1,
|
|
221
|
+
"description": "The impactfulness or severity."
|
|
222
|
+
},
|
|
223
|
+
"refs": {
|
|
224
|
+
"type": "array",
|
|
225
|
+
"items": { "$ref": "#/definitions/Reference" },
|
|
226
|
+
"description": "The set of references to external documents."
|
|
227
|
+
},
|
|
228
|
+
"tags": {
|
|
229
|
+
"type": "object",
|
|
230
|
+
"additionalProperties": true,
|
|
231
|
+
"description": "A set of tags - usually metadata."
|
|
232
|
+
},
|
|
233
|
+
"code": {
|
|
234
|
+
"type": ["string", "null"],
|
|
235
|
+
"description": "The raw source code of the control. Note that if this is an overlay control, it does not include the underlying source code."
|
|
236
|
+
},
|
|
237
|
+
"source_location": {
|
|
238
|
+
"$comment": "Local deviation: real InSpec often emits source_location as a bare string (a path or hostname), not the object form.",
|
|
239
|
+
"anyOf": [{ "$ref": "#/definitions/Source_Location" }, { "type": "string" }],
|
|
240
|
+
"description": "The explicit location of the control within the source code."
|
|
241
|
+
},
|
|
242
|
+
"results": {
|
|
243
|
+
"type": "array",
|
|
244
|
+
"items": { "$ref": "#/definitions/Control_Result" },
|
|
245
|
+
"description": "\n The set of all tests within the control and their results and findings. Example:\n For Chef Inspec, if in the control's code we had the following:\n describe sshd_config do\n its('Port') { should cmp 22 }\n end\n The findings from this block would be appended to the results, as well as those of any other blocks within the control.\n "
|
|
246
|
+
},
|
|
247
|
+
"waiver_data": { "anyOf": [{ "$ref": "#/definitions/Waiver_Data" }, { "type": "null" }] },
|
|
248
|
+
"attestation_data": { "anyOf": [{ "$ref": "#/definitions/Attestation_Data" }, { "type": "null" }] }
|
|
249
|
+
},
|
|
250
|
+
"description": "Describes a control and any findings it has.",
|
|
251
|
+
"title": "Exec JSON Control"
|
|
252
|
+
},
|
|
253
|
+
"Exec_JSON_Profile": {
|
|
254
|
+
"type": "object",
|
|
255
|
+
"additionalProperties": true,
|
|
256
|
+
"required": [
|
|
257
|
+
"name",
|
|
258
|
+
"sha256",
|
|
259
|
+
"supports",
|
|
260
|
+
"attributes",
|
|
261
|
+
"groups",
|
|
262
|
+
"controls"
|
|
263
|
+
],
|
|
264
|
+
"properties": {
|
|
265
|
+
"name": {
|
|
266
|
+
"type": "string",
|
|
267
|
+
"description": "The name - must be unique."
|
|
268
|
+
},
|
|
269
|
+
"title": {
|
|
270
|
+
"type": ["string", "null"],
|
|
271
|
+
"description": "The title - should be human readable."
|
|
272
|
+
},
|
|
273
|
+
"maintainer": {
|
|
274
|
+
"type": ["string", "null"],
|
|
275
|
+
"description": "The maintainer(s)."
|
|
276
|
+
},
|
|
277
|
+
"copyright": {
|
|
278
|
+
"type": ["string", "null"],
|
|
279
|
+
"description": "The copyright holder(s)."
|
|
280
|
+
},
|
|
281
|
+
"copyright_email": {
|
|
282
|
+
"type": ["string", "null"],
|
|
283
|
+
"description": "The email address or other contact information of the copyright holder(s)."
|
|
284
|
+
},
|
|
285
|
+
"depends": {
|
|
286
|
+
"type": ["array", "null"],
|
|
287
|
+
"items": { "$ref": "#/definitions/Dependency" },
|
|
288
|
+
"description": "The set of dependencies this profile depends on. Example: an overlay profile is dependent on another profile."
|
|
289
|
+
},
|
|
290
|
+
"parent_profile": {
|
|
291
|
+
"type": ["string", "null"],
|
|
292
|
+
"description": "The name of the parent profile if the profile is a dependency of another."
|
|
293
|
+
},
|
|
294
|
+
"license": {
|
|
295
|
+
"type": ["string", "null"],
|
|
296
|
+
"description": "The copyright license. Example: the full text or the name, such as 'Apache License, Version 2.0'."
|
|
297
|
+
},
|
|
298
|
+
"summary": {
|
|
299
|
+
"type": ["string", "null"],
|
|
300
|
+
"description": "The summary. Example: the Security Technical Implementation Guide (STIG) header."
|
|
301
|
+
},
|
|
302
|
+
"version": {
|
|
303
|
+
"type": ["string", "null"],
|
|
304
|
+
"description": "The version of the profile."
|
|
305
|
+
},
|
|
306
|
+
"supports": {
|
|
307
|
+
"type": "array",
|
|
308
|
+
"items": { "$ref": "#/definitions/Supported_Platform" },
|
|
309
|
+
"description": "The set of supported platform targets."
|
|
310
|
+
},
|
|
311
|
+
"description": {
|
|
312
|
+
"type": ["string", "null"],
|
|
313
|
+
"description": "The description - should be more detailed than the summary."
|
|
314
|
+
},
|
|
315
|
+
"inspec_version": {
|
|
316
|
+
"type": ["string", "null"],
|
|
317
|
+
"description": "The version of Inspec."
|
|
318
|
+
},
|
|
319
|
+
"sha256": {
|
|
320
|
+
"type": "string",
|
|
321
|
+
"description": "The checksum of the profile."
|
|
322
|
+
},
|
|
323
|
+
"status": {
|
|
324
|
+
"type": ["string", "null"],
|
|
325
|
+
"description": "The status. Example: loaded."
|
|
326
|
+
},
|
|
327
|
+
"status_message": {
|
|
328
|
+
"type": ["string", "null"],
|
|
329
|
+
"description": "The reason for the status. Example: why it was skipped or failed to load."
|
|
330
|
+
},
|
|
331
|
+
"skip_message": {
|
|
332
|
+
"type": ["string", "null"],
|
|
333
|
+
"description": "The reason for skipping if it was skipped."
|
|
334
|
+
},
|
|
335
|
+
"controls": {
|
|
336
|
+
"type": "array",
|
|
337
|
+
"items": { "$ref": "#/definitions/Exec_JSON_Control" },
|
|
338
|
+
"description": "The set of controls including any findings."
|
|
339
|
+
},
|
|
340
|
+
"groups": {
|
|
341
|
+
"type": "array",
|
|
342
|
+
"items": { "$ref": "#/definitions/Control_Group" },
|
|
343
|
+
"description": "A set of descriptions for the control groups. Example: the ids of the controls."
|
|
344
|
+
},
|
|
345
|
+
"attributes": {
|
|
346
|
+
"type": "array",
|
|
347
|
+
"items": {
|
|
348
|
+
"type": "object",
|
|
349
|
+
"additionalProperties": true,
|
|
350
|
+
"description": "An input or attribute used in the run."
|
|
351
|
+
},
|
|
352
|
+
"description": "The input(s) or attribute(s) used in the run."
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
"description": "Information on the set of controls assessed. Example: it can include the name of the Inspec profile and any findings.",
|
|
356
|
+
"title": "Exec JSON Profile"
|
|
357
|
+
},
|
|
358
|
+
"Platform": {
|
|
359
|
+
"type": "object",
|
|
360
|
+
"additionalProperties": true,
|
|
361
|
+
"required": ["name", "release"],
|
|
362
|
+
"properties": {
|
|
363
|
+
"name": {
|
|
364
|
+
"type": "string",
|
|
365
|
+
"description": "The name of the platform this was run on."
|
|
366
|
+
},
|
|
367
|
+
"release": {
|
|
368
|
+
"type": "string",
|
|
369
|
+
"description": "The version of the platform this was run on."
|
|
370
|
+
},
|
|
371
|
+
"target_id": {
|
|
372
|
+
"type": ["string", "null"],
|
|
373
|
+
"description": "The id of the target. Example: the name and version of the operating system were not sufficient to identify the platform so a release identifier can additionally be provided like '21H2' for the release version of MS Windows 10."
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
"description": "Platform information such as its name.",
|
|
377
|
+
"title": "Platform"
|
|
378
|
+
},
|
|
379
|
+
"Reference": {
|
|
380
|
+
"anyOf": [
|
|
381
|
+
{
|
|
382
|
+
"type": "object",
|
|
383
|
+
"required": ["ref"],
|
|
384
|
+
"properties": { "ref": { "type": "string" } },
|
|
385
|
+
"description": "A human readable/meaningful reference. Example: a book title."
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
"type": "object",
|
|
389
|
+
"required": ["url"],
|
|
390
|
+
"properties": { "url": { "type": "string" } },
|
|
391
|
+
"description": "A url pointing at the reference."
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
"type": "object",
|
|
395
|
+
"required": ["uri"],
|
|
396
|
+
"properties": { "uri": { "type": "string" } },
|
|
397
|
+
"description": "A uri pointing at the reference."
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"type": "object",
|
|
401
|
+
"required": ["ref"],
|
|
402
|
+
"properties": { "ref": {
|
|
403
|
+
"type": "array",
|
|
404
|
+
"items": {
|
|
405
|
+
"type": "object",
|
|
406
|
+
"additionalProperties": true
|
|
407
|
+
}
|
|
408
|
+
} },
|
|
409
|
+
"description": ""
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"$comment": "Local deviation: real converter output carries empty {} references.",
|
|
413
|
+
"type": "object",
|
|
414
|
+
"maxProperties": 0
|
|
415
|
+
}
|
|
416
|
+
],
|
|
417
|
+
"description": "A reference to an external document.",
|
|
418
|
+
"title": "Reference"
|
|
419
|
+
},
|
|
420
|
+
"Source_Location": {
|
|
421
|
+
"type": "object",
|
|
422
|
+
"additionalProperties": true,
|
|
423
|
+
"properties": {
|
|
424
|
+
"ref": {
|
|
425
|
+
"type": ["string", "null"],
|
|
426
|
+
"description": "Path to the file that this control originates from."
|
|
427
|
+
},
|
|
428
|
+
"line": {
|
|
429
|
+
"type": ["number", "null"],
|
|
430
|
+
"description": "The line on which this control is located."
|
|
431
|
+
}
|
|
432
|
+
},
|
|
433
|
+
"required": [],
|
|
434
|
+
"description": "The explicit location of the control.",
|
|
435
|
+
"title": "Source Location"
|
|
436
|
+
},
|
|
437
|
+
"Statistic_Block": {
|
|
438
|
+
"type": "object",
|
|
439
|
+
"additionalProperties": true,
|
|
440
|
+
"required": ["total"],
|
|
441
|
+
"properties": { "total": {
|
|
442
|
+
"type": "number",
|
|
443
|
+
"description": "The total. Example: the total number of controls in a given category for a run."
|
|
444
|
+
} },
|
|
445
|
+
"description": "Statistics for a given item, such as the total.",
|
|
446
|
+
"title": "Statistic Block"
|
|
447
|
+
},
|
|
448
|
+
"Statistic_Hash": {
|
|
449
|
+
"type": "object",
|
|
450
|
+
"additionalProperties": true,
|
|
451
|
+
"required": [],
|
|
452
|
+
"properties": {
|
|
453
|
+
"passed": { "anyOf": [{
|
|
454
|
+
"$ref": "#/definitions/Statistic_Block",
|
|
455
|
+
"description": "Statistics for the controls that passed."
|
|
456
|
+
}, { "type": "null" }] },
|
|
457
|
+
"skipped": { "anyOf": [{
|
|
458
|
+
"$ref": "#/definitions/Statistic_Block",
|
|
459
|
+
"description": "Statistics for the controls that were skipped."
|
|
460
|
+
}, { "type": "null" }] },
|
|
461
|
+
"failed": { "anyOf": [{
|
|
462
|
+
"$ref": "#/definitions/Statistic_Block",
|
|
463
|
+
"description": "Statistics for the controls that failed."
|
|
464
|
+
}, { "type": "null" }] }
|
|
465
|
+
},
|
|
466
|
+
"description": "Statistics for the control results.",
|
|
467
|
+
"title": "Statistic Hash"
|
|
468
|
+
},
|
|
469
|
+
"Statistics": {
|
|
470
|
+
"type": "object",
|
|
471
|
+
"additionalProperties": true,
|
|
472
|
+
"required": [],
|
|
473
|
+
"properties": {
|
|
474
|
+
"duration": {
|
|
475
|
+
"type": ["number", "null"],
|
|
476
|
+
"description": "How long (in seconds) this run by the tool was."
|
|
477
|
+
},
|
|
478
|
+
"controls": { "anyOf": [{
|
|
479
|
+
"$ref": "#/definitions/Statistic_Hash",
|
|
480
|
+
"description": "Breakdowns of control statistics by result"
|
|
481
|
+
}, { "type": "null" }] }
|
|
482
|
+
},
|
|
483
|
+
"description": "Statistics for the run(s) such as how long it took.",
|
|
484
|
+
"title": "Statistics"
|
|
485
|
+
},
|
|
486
|
+
"Supported_Platform": {
|
|
487
|
+
"type": "object",
|
|
488
|
+
"additionalProperties": true,
|
|
489
|
+
"required": [],
|
|
490
|
+
"properties": {
|
|
491
|
+
"platform-family": {
|
|
492
|
+
"type": ["string", "null"],
|
|
493
|
+
"description": "The platform family. Example: 'redhat'."
|
|
494
|
+
},
|
|
495
|
+
"platform-name": {
|
|
496
|
+
"type": ["string", "null"],
|
|
497
|
+
"description": "The platform name - can include wildcards. Example: 'debian'."
|
|
498
|
+
},
|
|
499
|
+
"platform": {
|
|
500
|
+
"type": ["string", "null"],
|
|
501
|
+
"description": "The location of the platform. Can be: 'os', 'aws', 'azure', or 'gcp'."
|
|
502
|
+
},
|
|
503
|
+
"release": {
|
|
504
|
+
"type": ["string", "null"],
|
|
505
|
+
"description": "The release of the platform. Example: '20.04' for 'ubuntu'."
|
|
506
|
+
},
|
|
507
|
+
"os-family": {
|
|
508
|
+
"type": ["string", "null"],
|
|
509
|
+
"description": "Deprecated in favor of platform-family."
|
|
510
|
+
},
|
|
511
|
+
"os-name": {
|
|
512
|
+
"type": ["string", "null"],
|
|
513
|
+
"description": "Deprecated in favor of platform-name."
|
|
514
|
+
}
|
|
515
|
+
},
|
|
516
|
+
"description": "A supported platform target. Example: the platform name being 'ubuntu'.",
|
|
517
|
+
"title": "Supported Platform"
|
|
518
|
+
},
|
|
519
|
+
"Waiver_Data": {
|
|
520
|
+
"type": "object",
|
|
521
|
+
"additionalProperties": true,
|
|
522
|
+
"required": [],
|
|
523
|
+
"properties": {
|
|
524
|
+
"expiration_date": { "type": ["string", "null"] },
|
|
525
|
+
"justification": { "type": ["string", "null"] },
|
|
526
|
+
"message": { "type": ["string", "null"] },
|
|
527
|
+
"run": { "type": ["boolean", "null"] },
|
|
528
|
+
"skipped_due_to_waiver": { "type": [
|
|
529
|
+
"boolean",
|
|
530
|
+
"null",
|
|
531
|
+
"string"
|
|
532
|
+
] }
|
|
533
|
+
}
|
|
534
|
+
},
|
|
535
|
+
"Attestation_Status": {
|
|
536
|
+
"type": "string",
|
|
537
|
+
"enum": ["passed", "failed"],
|
|
538
|
+
"description": "The attested status of the control",
|
|
539
|
+
"title": "Control Attestation Status"
|
|
540
|
+
},
|
|
541
|
+
"Attestation_Data": {
|
|
542
|
+
"type": "object",
|
|
543
|
+
"additionalProperties": true,
|
|
544
|
+
"required": [
|
|
545
|
+
"control_id",
|
|
546
|
+
"explanation",
|
|
547
|
+
"frequency",
|
|
548
|
+
"status",
|
|
549
|
+
"updated",
|
|
550
|
+
"updated_by"
|
|
551
|
+
],
|
|
552
|
+
"properties": {
|
|
553
|
+
"control_id": { "type": "string" },
|
|
554
|
+
"explanation": { "type": "string" },
|
|
555
|
+
"frequency": { "type": "string" },
|
|
556
|
+
"status": { "$ref": "#/definitions/Attestation_Status" },
|
|
557
|
+
"updated": { "type": "string" },
|
|
558
|
+
"updated_by": { "type": "string" }
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
//#endregion
|
|
4
564
|
//#region typescript/index.ts
|
|
5
565
|
/**
|
|
6
566
|
* Create and configure Ajv instance with all HDF schemas
|
|
@@ -144,6 +704,28 @@ function createResult(validator, data) {
|
|
|
144
704
|
function validateResults(data) {
|
|
145
705
|
return createResult(getResultsValidator(), data);
|
|
146
706
|
}
|
|
707
|
+
let legacyV2Validator = null;
|
|
708
|
+
function getLegacyV2Validator() {
|
|
709
|
+
if (!legacyV2Validator) {
|
|
710
|
+
const v2ajv = new Ajv({
|
|
711
|
+
allErrors: true,
|
|
712
|
+
verbose: true,
|
|
713
|
+
strict: false,
|
|
714
|
+
validateSchema: false
|
|
715
|
+
});
|
|
716
|
+
addFormats(v2ajv);
|
|
717
|
+
legacyV2Validator = v2ajv.compile(legacy_exec_json_schema_default);
|
|
718
|
+
}
|
|
719
|
+
return legacyV2Validator;
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* Validate a legacy HDF v2 document — the Heimdall/InSpec exec-json shape
|
|
723
|
+
* (profiles[] + platform) SAF converters emit — against the pinned exec-json
|
|
724
|
+
* schema, at the same Ajv rigor as the v3 validators.
|
|
725
|
+
*/
|
|
726
|
+
function validateLegacyV2(data) {
|
|
727
|
+
return createResult(getLegacyV2Validator(), data);
|
|
728
|
+
}
|
|
147
729
|
/**
|
|
148
730
|
* Validate HDF Baseline document against schema
|
|
149
731
|
*/
|
|
@@ -207,6 +789,6 @@ function validate(data) {
|
|
|
207
789
|
return resultsResult;
|
|
208
790
|
}
|
|
209
791
|
//#endregion
|
|
210
|
-
export { validate, validateAmendments, validateBaseline, validateComparison, validateEvidencePackage, validatePlan, validateRequirementChangeEvent, validateResults, validateSystem };
|
|
792
|
+
export { validate, validateAmendments, validateBaseline, validateComparison, validateEvidencePackage, validateLegacyV2, validatePlan, validateRequirementChangeEvent, validateResults, validateSystem };
|
|
211
793
|
|
|
212
794
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../typescript/index.ts"],"sourcesContent":["import Ajv, { type ValidateFunction, type ErrorObject } from 'ajv';\nimport addFormats from 'ajv-formats';\n\n// Named JS-object schema imports — the schemas are inlined into\n// @mitre/hdf-schema's dist/index.js at build time, so downstream consumers\n// never see raw JSON imports. Works uniformly in raw Node ESM, Vite/Nuxt,\n// webpack, esbuild — no consumer-side noExternal configuration required.\nimport {\n hdfResultsSchema,\n hdfBaselineSchema,\n hdfComparisonSchema,\n hdfSystemSchema,\n hdfPlanSchema,\n hdfAmendmentsSchema,\n hdfEvidencePackageSchema,\n hdfRequirementChangeEventSchema,\n commonSchema,\n eventsSchema,\n extensionsSchema,\n platformSchema,\n resultSchema,\n runnerSchema,\n statisticsSchema,\n targetSchema,\n parameterSchema,\n systemSchema,\n planSchema,\n amendmentsSchema,\n comparisonSchema,\n componentSchema,\n dataFlowSchema,\n cvssSchema,\n epssSchema,\n kevSchema,\n affectedPackageSchema,\n bomSchema,\n} from '@mitre/hdf-schema';\n\n/**\n * Validation error details\n */\nexport interface ValidationError {\n field: string;\n message: string;\n value?: unknown;\n /**\n * The JSON Schema keyword that failed ('type', 'required', 'format', ...).\n * Surfaced so a caller can act on the KIND of violation — the converters\n * reject a wrongly-typed field without rejecting a merely sparse document.\n */\n keyword?: string;\n /** For a failed `format`, which format was expected. */\n format?: string;\n}\n\n/**\n * Result of schema validation\n */\nexport interface ValidationResult {\n valid: boolean;\n errors: ValidationError[];\n getErrorMessage(): string;\n}\n\n/**\n * Create and configure Ajv instance with all HDF schemas\n */\nfunction createValidator(): Ajv {\n const ajv = new Ajv({\n allErrors: true,\n verbose: true,\n strict: false,\n validateFormats: true,\n validateSchema: false // Skip meta-schema validation for performance\n });\n\n // Add format validators (date-time, uri, etc.)\n addFormats(ajv);\n // ajv-formats follows the RFC 3339 note allowing a space where the T belongs;\n // HDF's canonical timestamp does not, and the Go peer rejects it. Requiring the\n // separator keeps the shipped validators on one answer — both languages' verdicts\n // are pinned by ../testdata/shipped-format-cases.json.\n const registeredDateTime = ajv.formats['date-time'] as { validate: (v: string) => boolean };\n ajv.addFormat('date-time', {\n type: 'string',\n validate: (v: string) => /^\\d{4}-\\d{2}-\\d{2}[Tt]/.test(v) && registeredDateTime.validate(v),\n });\n\n // Add all primitive schemas so they can be referenced via $ref\n ajv.addSchema(commonSchema);\n ajv.addSchema(platformSchema);\n ajv.addSchema(resultSchema);\n ajv.addSchema(runnerSchema);\n ajv.addSchema(statisticsSchema);\n ajv.addSchema(targetSchema);\n ajv.addSchema(parameterSchema);\n ajv.addSchema(cvssSchema); // CVE-ecosystem primitives: referenced by Evaluated_Requirement + overrides\n ajv.addSchema(epssSchema);\n ajv.addSchema(kevSchema);\n ajv.addSchema(affectedPackageSchema);\n ajv.addSchema(bomSchema); // referenced by Base_Component.boms[]\n ajv.addSchema(amendmentsSchema); // before extensions (extensions $refs amendments Override_Type)\n ajv.addSchema(extensionsSchema);\n ajv.addSchema(systemSchema);\n ajv.addSchema(planSchema);\n ajv.addSchema(comparisonSchema);\n ajv.addSchema(eventsSchema); // change-event envelope (referenced by hdf-requirement-change-event)\n ajv.addSchema(componentSchema);\n ajv.addSchema(dataFlowSchema);\n\n // Register top-level schemas so cross-schema $refs resolve.\n // The comparison primitive references hdf-results#/$defs/Evaluated_Requirement,\n // so hdf-results must be registered before compiling comparison.\n // Schemas are compiled lazily (in getXxxValidator) for performance.\n ajv.addSchema(hdfResultsSchema);\n ajv.addSchema(hdfBaselineSchema);\n ajv.addSchema(hdfComparisonSchema);\n ajv.addSchema(hdfSystemSchema);\n ajv.addSchema(hdfPlanSchema);\n ajv.addSchema(hdfAmendmentsSchema);\n ajv.addSchema(hdfRequirementChangeEventSchema);\n ajv.addSchema(hdfEvidencePackageSchema);\n\n return ajv;\n}\n\n// Singleton Ajv instance\nconst ajv = createValidator();\n\n// Compile schemas once (lazy initialization)\nlet resultsValidator: ValidateFunction | null = null;\nlet baselineValidator: ValidateFunction | null = null;\nlet comparisonValidator: ValidateFunction | null = null;\nlet systemValidator: ValidateFunction | null = null;\nlet planValidator: ValidateFunction | null = null;\nlet amendmentsValidator: ValidateFunction | null = null;\nlet evidencePackageValidator: ValidateFunction | null = null;\nlet requirementChangeEventValidator: ValidateFunction | null = null;\n\nfunction getResultsValidator(): ValidateFunction {\n if (!resultsValidator) {\n resultsValidator = ajv.compile(hdfResultsSchema);\n }\n return resultsValidator;\n}\n\nfunction getBaselineValidator(): ValidateFunction {\n if (!baselineValidator) {\n baselineValidator = ajv.compile(hdfBaselineSchema);\n }\n return baselineValidator;\n}\n\nfunction getComparisonValidator(): ValidateFunction {\n if (!comparisonValidator) {\n comparisonValidator = ajv.compile(hdfComparisonSchema);\n }\n return comparisonValidator;\n}\n\nfunction getRequirementChangeEventValidator(): ValidateFunction {\n if (!requirementChangeEventValidator) {\n requirementChangeEventValidator = ajv.compile(hdfRequirementChangeEventSchema);\n }\n return requirementChangeEventValidator;\n}\n\nfunction getSystemValidator(): ValidateFunction {\n if (!systemValidator) {\n systemValidator = ajv.compile(hdfSystemSchema);\n }\n return systemValidator;\n}\n\nfunction getPlanValidator(): ValidateFunction {\n if (!planValidator) {\n planValidator = ajv.compile(hdfPlanSchema);\n }\n return planValidator;\n}\n\nfunction getAmendmentsValidator(): ValidateFunction {\n if (!amendmentsValidator) {\n amendmentsValidator = ajv.compile(hdfAmendmentsSchema);\n }\n return amendmentsValidator;\n}\n\nfunction getEvidencePackageValidator(): ValidateFunction {\n if (!evidencePackageValidator) {\n evidencePackageValidator = ajv.compile(hdfEvidencePackageSchema);\n }\n return evidencePackageValidator;\n}\n\n/**\n * Convert Ajv errors to ValidationError format\n */\nfunction formatErrors(errors: ErrorObject[] | null | undefined): ValidationError[] {\n if (!errors || errors.length === 0) {\n return [];\n }\n\n return errors.map(err => {\n // Clean up field path (remove leading slash, use dot notation)\n let field = err.instancePath\n .replace(/^\\//, '')\n .replace(/\\//g, '.');\n\n // If field is empty, use the data path from the error\n if (!field && err.schemaPath) {\n const pathParts = err.schemaPath.split('/');\n field = pathParts[pathParts.length - 1] || '(root)';\n }\n\n // Build message\n let message = err.message || 'validation failed';\n if (err.params) {\n // Add parameter info for more context\n if ('missingProperty' in err.params) {\n field = field ? `${field}.${err.params.missingProperty}` : err.params.missingProperty;\n message = 'is required';\n } else if ('additionalProperty' in err.params) {\n field = field ? `${field}.${err.params.additionalProperty}` : err.params.additionalProperty;\n message = 'is not allowed';\n } else if ('limit' in err.params) {\n message = `${message} (limit: ${err.params.limit})`;\n }\n }\n\n return {\n field: field || '(root)',\n keyword: err.keyword,\n ...(err.keyword === 'format' && err.params && 'format' in err.params\n ? { format: String((err.params as { format: unknown }).format) }\n : {}),\n message,\n value: err.data\n };\n });\n}\n\n/**\n * Create ValidationResult from validator output\n */\nfunction createResult(validator: ValidateFunction, data: unknown): ValidationResult {\n const valid = validator(data);\n\n const errors = formatErrors(validator.errors);\n\n return {\n valid: valid === true,\n errors,\n getErrorMessage(): string {\n if (this.valid) {\n return '';\n }\n return this.errors\n .map(e => {\n if (e.field === '(root)') {\n return e.message;\n }\n return `${e.field}: ${e.message}`;\n })\n .join('; ');\n }\n };\n}\n\n/**\n * Validate HDF Results document against schema\n */\nexport function validateResults(data: unknown): ValidationResult {\n const validator = getResultsValidator();\n return createResult(validator, data);\n}\n\n/**\n * Validate HDF Baseline document against schema\n */\nexport function validateBaseline(data: unknown): ValidationResult {\n const validator = getBaselineValidator();\n return createResult(validator, data);\n}\n\n/**\n * Validate HDF Comparison document against schema\n */\nexport function validateComparison(data: unknown): ValidationResult {\n const validator = getComparisonValidator();\n return createResult(validator, data);\n}\n\n/**\n * Validate an HDF Requirement Change Event (one continuous-monitoring wire event) against schema\n */\nexport function validateRequirementChangeEvent(data: unknown): ValidationResult {\n const validator = getRequirementChangeEventValidator();\n return createResult(validator, data);\n}\n\n/**\n * Validate HDF System document against schema\n */\nexport function validateSystem(data: unknown): ValidationResult {\n const validator = getSystemValidator();\n return createResult(validator, data);\n}\n\n/**\n * Validate HDF Plan document against schema\n */\nexport function validatePlan(data: unknown): ValidationResult {\n const validator = getPlanValidator();\n return createResult(validator, data);\n}\n\n/**\n * Validate HDF Amendments document against schema\n */\nexport function validateAmendments(data: unknown): ValidationResult {\n const validator = getAmendmentsValidator();\n return createResult(validator, data);\n}\n\n/**\n * Validate HDF Evidence Package document against schema\n */\nexport function validateEvidencePackage(data: unknown): ValidationResult {\n const validator = getEvidencePackageValidator();\n return createResult(validator, data);\n}\n\n/**\n * Validate HDF document (auto-detect type based on structure)\n */\nexport function validate(data: unknown): ValidationResult {\n if (typeof data === 'object' && data !== null) {\n const obj = data as Record<string, unknown>;\n\n // HDF Results has 'baselines' array at root\n if ('baselines' in obj) {\n return validateResults(data);\n }\n\n // HDF Baseline has 'name' and 'requirements' at root\n if ('name' in obj && 'requirements' in obj) {\n return validateBaseline(data);\n }\n\n // HDF System has 'name' and 'components' at root\n if ('name' in obj && 'components' in obj) {\n return validateSystem(data);\n }\n\n // HDF Plan has 'name' and 'assessments' at root\n if ('name' in obj && 'assessments' in obj) {\n return validatePlan(data);\n }\n\n // HDF Amendments has 'name' and 'overrides' at root\n if ('name' in obj && 'overrides' in obj) {\n return validateAmendments(data);\n }\n\n // HDF Comparison has 'requirementDiffs' at root (unique discriminator)\n if ('requirementDiffs' in obj) {\n return validateComparison(data);\n }\n\n // HDF Evidence Package has 'name' and 'contents' at root\n if ('name' in obj && 'contents' in obj) {\n return validateEvidencePackage(data);\n }\n }\n\n // Cannot determine type, try results first (most common)\n const resultsResult = validateResults(data);\n if (resultsResult.valid) {\n return resultsResult;\n }\n\n const baselineResult = validateBaseline(data);\n if (baselineResult.valid) {\n return baselineResult;\n }\n\n return resultsResult;\n}\n"],"mappings":";;;;;;;AAmEA,SAAS,kBAAuB;CAC9B,MAAM,MAAM,IAAI,IAAI;EAClB,WAAW;EACX,SAAS;EACT,QAAQ;EACR,iBAAiB;EACjB,gBAAgB;CAClB,CAAC;CAGD,WAAW,GAAG;CAKd,MAAM,qBAAqB,IAAI,QAAQ;CACvC,IAAI,UAAU,aAAa;EACzB,MAAM;EACN,WAAW,MAAc,yBAAyB,KAAK,CAAC,KAAK,mBAAmB,SAAS,CAAC;CAC5F,CAAC;CAGD,IAAI,UAAU,YAAY;CAC1B,IAAI,UAAU,cAAc;CAC5B,IAAI,UAAU,YAAY;CAC1B,IAAI,UAAU,YAAY;CAC1B,IAAI,UAAU,gBAAgB;CAC9B,IAAI,UAAU,YAAY;CAC1B,IAAI,UAAU,eAAe;CAC7B,IAAI,UAAU,UAAU;CACxB,IAAI,UAAU,UAAU;CACxB,IAAI,UAAU,SAAS;CACvB,IAAI,UAAU,qBAAqB;CACnC,IAAI,UAAU,SAAS;CACvB,IAAI,UAAU,gBAAgB;CAC9B,IAAI,UAAU,gBAAgB;CAC9B,IAAI,UAAU,YAAY;CAC1B,IAAI,UAAU,UAAU;CACxB,IAAI,UAAU,gBAAgB;CAC9B,IAAI,UAAU,YAAY;CAC1B,IAAI,UAAU,eAAe;CAC7B,IAAI,UAAU,cAAc;CAM5B,IAAI,UAAU,gBAAgB;CAC9B,IAAI,UAAU,iBAAiB;CAC/B,IAAI,UAAU,mBAAmB;CACjC,IAAI,UAAU,eAAe;CAC7B,IAAI,UAAU,aAAa;CAC3B,IAAI,UAAU,mBAAmB;CACjC,IAAI,UAAU,+BAA+B;CAC7C,IAAI,UAAU,wBAAwB;CAEtC,OAAO;AACT;AAGA,MAAM,MAAM,gBAAgB;AAG5B,IAAI,mBAA4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,MAAiC;CAE9D,OAAO,aADW,mBACU,GAAG,IAAI;AACrC;;;;AAKA,SAAgB,aAAa,MAAiC;CAE5D,OAAO,aADW,iBACU,GAAG,IAAI;AACrC;;;;AAKA,SAAgB,mBAAmB,MAAiC;CAElE,OAAO,aADW,uBACU,GAAG,IAAI;AACrC;;;;AAKA,SAAgB,wBAAwB,MAAiC;CAEvE,OAAO,aADW,4BACU,GAAG,IAAI;AACrC;;;;AAKA,SAAgB,SAAS,MAAiC;CACxD,IAAI,OAAO,SAAS,YAAY,SAAS,MAAM;EAC7C,MAAM,MAAM;EAGZ,IAAI,eAAe,KACjB,OAAO,gBAAgB,IAAI;EAI7B,IAAI,UAAU,OAAO,kBAAkB,KACrC,OAAO,iBAAiB,IAAI;EAI9B,IAAI,UAAU,OAAO,gBAAgB,KACnC,OAAO,eAAe,IAAI;EAI5B,IAAI,UAAU,OAAO,iBAAiB,KACpC,OAAO,aAAa,IAAI;EAI1B,IAAI,UAAU,OAAO,eAAe,KAClC,OAAO,mBAAmB,IAAI;EAIhC,IAAI,sBAAsB,KACxB,OAAO,mBAAmB,IAAI;EAIhC,IAAI,UAAU,OAAO,cAAc,KACjC,OAAO,wBAAwB,IAAI;CAEvC;CAGA,MAAM,gBAAgB,gBAAgB,IAAI;CAC1C,IAAI,cAAc,OAChB,OAAO;CAGT,MAAM,iBAAiB,iBAAiB,IAAI;CAC5C,IAAI,eAAe,OACjB,OAAO;CAGT,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["legacyV2Schema"],"sources":["../typescript/legacy-exec-json.schema.json","../typescript/index.ts"],"sourcesContent":["","import Ajv, { type ValidateFunction, type ErrorObject } from 'ajv';\nimport addFormats from 'ajv-formats';\n\n// Pinned HDF v2 (Heimdall/InSpec exec-json) schema — sourced from heimdall2\n// inspecjs (see ../go/legacy/PROVENANCE.md). Byte-identical to the Go-embedded\n// copy at ../go/legacy/exec-json.schema.json, pinned by a parity test.\nimport legacyV2Schema from './legacy-exec-json.schema.json';\n\n// Named JS-object schema imports — the schemas are inlined into\n// @mitre/hdf-schema's dist/index.js at build time, so downstream consumers\n// never see raw JSON imports. Works uniformly in raw Node ESM, Vite/Nuxt,\n// webpack, esbuild — no consumer-side noExternal configuration required.\nimport {\n hdfResultsSchema,\n hdfBaselineSchema,\n hdfComparisonSchema,\n hdfSystemSchema,\n hdfPlanSchema,\n hdfAmendmentsSchema,\n hdfEvidencePackageSchema,\n hdfRequirementChangeEventSchema,\n commonSchema,\n eventsSchema,\n extensionsSchema,\n platformSchema,\n resultSchema,\n runnerSchema,\n statisticsSchema,\n targetSchema,\n parameterSchema,\n systemSchema,\n planSchema,\n amendmentsSchema,\n comparisonSchema,\n componentSchema,\n dataFlowSchema,\n cvssSchema,\n epssSchema,\n kevSchema,\n affectedPackageSchema,\n bomSchema,\n} from '@mitre/hdf-schema';\n\n/**\n * Validation error details\n */\nexport interface ValidationError {\n field: string;\n message: string;\n value?: unknown;\n /**\n * The JSON Schema keyword that failed ('type', 'required', 'format', ...).\n * Surfaced so a caller can act on the KIND of violation — the converters\n * reject a wrongly-typed field without rejecting a merely sparse document.\n */\n keyword?: string;\n /** For a failed `format`, which format was expected. */\n format?: string;\n}\n\n/**\n * Result of schema validation\n */\nexport interface ValidationResult {\n valid: boolean;\n errors: ValidationError[];\n getErrorMessage(): string;\n}\n\n/**\n * Create and configure Ajv instance with all HDF schemas\n */\nfunction createValidator(): Ajv {\n const ajv = new Ajv({\n allErrors: true,\n verbose: true,\n strict: false,\n validateFormats: true,\n validateSchema: false // Skip meta-schema validation for performance\n });\n\n // Add format validators (date-time, uri, etc.)\n addFormats(ajv);\n // ajv-formats follows the RFC 3339 note allowing a space where the T belongs;\n // HDF's canonical timestamp does not, and the Go peer rejects it. Requiring the\n // separator keeps the shipped validators on one answer — both languages' verdicts\n // are pinned by ../testdata/shipped-format-cases.json.\n const registeredDateTime = ajv.formats['date-time'] as { validate: (v: string) => boolean };\n ajv.addFormat('date-time', {\n type: 'string',\n validate: (v: string) => /^\\d{4}-\\d{2}-\\d{2}[Tt]/.test(v) && registeredDateTime.validate(v),\n });\n\n // Add all primitive schemas so they can be referenced via $ref\n ajv.addSchema(commonSchema);\n ajv.addSchema(platformSchema);\n ajv.addSchema(resultSchema);\n ajv.addSchema(runnerSchema);\n ajv.addSchema(statisticsSchema);\n ajv.addSchema(targetSchema);\n ajv.addSchema(parameterSchema);\n ajv.addSchema(cvssSchema); // CVE-ecosystem primitives: referenced by Evaluated_Requirement + overrides\n ajv.addSchema(epssSchema);\n ajv.addSchema(kevSchema);\n ajv.addSchema(affectedPackageSchema);\n ajv.addSchema(bomSchema); // referenced by Base_Component.boms[]\n ajv.addSchema(amendmentsSchema); // before extensions (extensions $refs amendments Override_Type)\n ajv.addSchema(extensionsSchema);\n ajv.addSchema(systemSchema);\n ajv.addSchema(planSchema);\n ajv.addSchema(comparisonSchema);\n ajv.addSchema(eventsSchema); // change-event envelope (referenced by hdf-requirement-change-event)\n ajv.addSchema(componentSchema);\n ajv.addSchema(dataFlowSchema);\n\n // Register top-level schemas so cross-schema $refs resolve.\n // The comparison primitive references hdf-results#/$defs/Evaluated_Requirement,\n // so hdf-results must be registered before compiling comparison.\n // Schemas are compiled lazily (in getXxxValidator) for performance.\n ajv.addSchema(hdfResultsSchema);\n ajv.addSchema(hdfBaselineSchema);\n ajv.addSchema(hdfComparisonSchema);\n ajv.addSchema(hdfSystemSchema);\n ajv.addSchema(hdfPlanSchema);\n ajv.addSchema(hdfAmendmentsSchema);\n ajv.addSchema(hdfRequirementChangeEventSchema);\n ajv.addSchema(hdfEvidencePackageSchema);\n\n return ajv;\n}\n\n// Singleton Ajv instance\nconst ajv = createValidator();\n\n// Compile schemas once (lazy initialization)\nlet resultsValidator: ValidateFunction | null = null;\nlet baselineValidator: ValidateFunction | null = null;\nlet comparisonValidator: ValidateFunction | null = null;\nlet systemValidator: ValidateFunction | null = null;\nlet planValidator: ValidateFunction | null = null;\nlet amendmentsValidator: ValidateFunction | null = null;\nlet evidencePackageValidator: ValidateFunction | null = null;\nlet requirementChangeEventValidator: ValidateFunction | null = null;\n\nfunction getResultsValidator(): ValidateFunction {\n if (!resultsValidator) {\n resultsValidator = ajv.compile(hdfResultsSchema);\n }\n return resultsValidator;\n}\n\nfunction getBaselineValidator(): ValidateFunction {\n if (!baselineValidator) {\n baselineValidator = ajv.compile(hdfBaselineSchema);\n }\n return baselineValidator;\n}\n\nfunction getComparisonValidator(): ValidateFunction {\n if (!comparisonValidator) {\n comparisonValidator = ajv.compile(hdfComparisonSchema);\n }\n return comparisonValidator;\n}\n\nfunction getRequirementChangeEventValidator(): ValidateFunction {\n if (!requirementChangeEventValidator) {\n requirementChangeEventValidator = ajv.compile(hdfRequirementChangeEventSchema);\n }\n return requirementChangeEventValidator;\n}\n\nfunction getSystemValidator(): ValidateFunction {\n if (!systemValidator) {\n systemValidator = ajv.compile(hdfSystemSchema);\n }\n return systemValidator;\n}\n\nfunction getPlanValidator(): ValidateFunction {\n if (!planValidator) {\n planValidator = ajv.compile(hdfPlanSchema);\n }\n return planValidator;\n}\n\nfunction getAmendmentsValidator(): ValidateFunction {\n if (!amendmentsValidator) {\n amendmentsValidator = ajv.compile(hdfAmendmentsSchema);\n }\n return amendmentsValidator;\n}\n\nfunction getEvidencePackageValidator(): ValidateFunction {\n if (!evidencePackageValidator) {\n evidencePackageValidator = ajv.compile(hdfEvidencePackageSchema);\n }\n return evidencePackageValidator;\n}\n\n/**\n * Convert Ajv errors to ValidationError format\n */\nfunction formatErrors(errors: ErrorObject[] | null | undefined): ValidationError[] {\n if (!errors || errors.length === 0) {\n return [];\n }\n\n return errors.map(err => {\n // Clean up field path (remove leading slash, use dot notation)\n let field = err.instancePath\n .replace(/^\\//, '')\n .replace(/\\//g, '.');\n\n // If field is empty, use the data path from the error\n if (!field && err.schemaPath) {\n const pathParts = err.schemaPath.split('/');\n field = pathParts[pathParts.length - 1] || '(root)';\n }\n\n // Build message\n let message = err.message || 'validation failed';\n if (err.params) {\n // Add parameter info for more context\n if ('missingProperty' in err.params) {\n field = field ? `${field}.${err.params.missingProperty}` : err.params.missingProperty;\n message = 'is required';\n } else if ('additionalProperty' in err.params) {\n field = field ? `${field}.${err.params.additionalProperty}` : err.params.additionalProperty;\n message = 'is not allowed';\n } else if ('limit' in err.params) {\n message = `${message} (limit: ${err.params.limit})`;\n }\n }\n\n return {\n field: field || '(root)',\n keyword: err.keyword,\n ...(err.keyword === 'format' && err.params && 'format' in err.params\n ? { format: String((err.params as { format: unknown }).format) }\n : {}),\n message,\n value: err.data\n };\n });\n}\n\n/**\n * Create ValidationResult from validator output\n */\nfunction createResult(validator: ValidateFunction, data: unknown): ValidationResult {\n const valid = validator(data);\n\n const errors = formatErrors(validator.errors);\n\n return {\n valid: valid === true,\n errors,\n getErrorMessage(): string {\n if (this.valid) {\n return '';\n }\n return this.errors\n .map(e => {\n if (e.field === '(root)') {\n return e.message;\n }\n return `${e.field}: ${e.message}`;\n })\n .join('; ');\n }\n };\n}\n\n/**\n * Validate HDF Results document against schema\n */\nexport function validateResults(data: unknown): ValidationResult {\n const validator = getResultsValidator();\n return createResult(validator, data);\n}\n\n// Legacy HDF v2 (Heimdall/InSpec exec-json) uses its own Ajv instance: the pinned\n// exec-json schema is self-contained and unrelated to the HDF v3 schemas, so it\n// stays isolated from the shared HDF validator.\nlet legacyV2Validator: ValidateFunction | null = null;\nfunction getLegacyV2Validator(): ValidateFunction {\n if (!legacyV2Validator) {\n const v2ajv = new Ajv({ allErrors: true, verbose: true, strict: false, validateSchema: false });\n addFormats(v2ajv);\n legacyV2Validator = v2ajv.compile(legacyV2Schema);\n }\n return legacyV2Validator;\n}\n\n/**\n * Validate a legacy HDF v2 document — the Heimdall/InSpec exec-json shape\n * (profiles[] + platform) SAF converters emit — against the pinned exec-json\n * schema, at the same Ajv rigor as the v3 validators.\n */\nexport function validateLegacyV2(data: unknown): ValidationResult {\n return createResult(getLegacyV2Validator(), data);\n}\n\n/**\n * Validate HDF Baseline document against schema\n */\nexport function validateBaseline(data: unknown): ValidationResult {\n const validator = getBaselineValidator();\n return createResult(validator, data);\n}\n\n/**\n * Validate HDF Comparison document against schema\n */\nexport function validateComparison(data: unknown): ValidationResult {\n const validator = getComparisonValidator();\n return createResult(validator, data);\n}\n\n/**\n * Validate an HDF Requirement Change Event (one continuous-monitoring wire event) against schema\n */\nexport function validateRequirementChangeEvent(data: unknown): ValidationResult {\n const validator = getRequirementChangeEventValidator();\n return createResult(validator, data);\n}\n\n/**\n * Validate HDF System document against schema\n */\nexport function validateSystem(data: unknown): ValidationResult {\n const validator = getSystemValidator();\n return createResult(validator, data);\n}\n\n/**\n * Validate HDF Plan document against schema\n */\nexport function validatePlan(data: unknown): ValidationResult {\n const validator = getPlanValidator();\n return createResult(validator, data);\n}\n\n/**\n * Validate HDF Amendments document against schema\n */\nexport function validateAmendments(data: unknown): ValidationResult {\n const validator = getAmendmentsValidator();\n return createResult(validator, data);\n}\n\n/**\n * Validate HDF Evidence Package document against schema\n */\nexport function validateEvidencePackage(data: unknown): ValidationResult {\n const validator = getEvidencePackageValidator();\n return createResult(validator, data);\n}\n\n/**\n * Validate HDF document (auto-detect type based on structure)\n */\nexport function validate(data: unknown): ValidationResult {\n if (typeof data === 'object' && data !== null) {\n const obj = data as Record<string, unknown>;\n\n // HDF Results has 'baselines' array at root\n if ('baselines' in obj) {\n return validateResults(data);\n }\n\n // HDF Baseline has 'name' and 'requirements' at root\n if ('name' in obj && 'requirements' in obj) {\n return validateBaseline(data);\n }\n\n // HDF System has 'name' and 'components' at root\n if ('name' in obj && 'components' in obj) {\n return validateSystem(data);\n }\n\n // HDF Plan has 'name' and 'assessments' at root\n if ('name' in obj && 'assessments' in obj) {\n return validatePlan(data);\n }\n\n // HDF Amendments has 'name' and 'overrides' at root\n if ('name' in obj && 'overrides' in obj) {\n return validateAmendments(data);\n }\n\n // HDF Comparison has 'requirementDiffs' at root (unique discriminator)\n if ('requirementDiffs' in obj) {\n return validateComparison(data);\n }\n\n // HDF Evidence Package has 'name' and 'contents' at root\n if ('name' in obj && 'contents' in obj) {\n return validateEvidencePackage(data);\n }\n }\n\n // Cannot determine type, try results first (most common)\n const resultsResult = validateResults(data);\n if (resultsResult.valid) {\n return resultsResult;\n }\n\n const baselineResult = validateBaseline(data);\n if (baselineResult.valid) {\n return baselineResult;\n }\n\n return resultsResult;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACwEA,SAAS,kBAAuB;CAC9B,MAAM,MAAM,IAAI,IAAI;EAClB,WAAW;EACX,SAAS;EACT,QAAQ;EACR,iBAAiB;EACjB,gBAAgB;CAClB,CAAC;CAGD,WAAW,GAAG;CAKd,MAAM,qBAAqB,IAAI,QAAQ;CACvC,IAAI,UAAU,aAAa;EACzB,MAAM;EACN,WAAW,MAAc,yBAAyB,KAAK,CAAC,KAAK,mBAAmB,SAAS,CAAC;CAC5F,CAAC;CAGD,IAAI,UAAU,YAAY;CAC1B,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C;CAElE,OAAO,aADW,uBACU,GAAG,IAAI;AACrC;;;;AAKA,SAAgB,wBAAwB,MAAiC;CAEvE,OAAO,aADW,4BACU,GAAG,IAAI;AACrC;;;;AAKA,SAAgB,SAAS,MAAiC;CACxD,IAAI,OAAO,SAAS,YAAY,SAAS,MAAM;EAC7C,MAAM,MAAM;EAGZ,IAAI,eAAe,KACjB,OAAO,gBAAgB,IAAI;EAI7B,IAAI,UAAU,OAAO,kBAAkB,KACrC,OAAO,iBAAiB,IAAI;EAI9B,IAAI,UAAU,OAAO,gBAAgB,KACnC,OAAO,eAAe,IAAI;EAI5B,IAAI,UAAU,OAAO,iBAAiB,KACpC,OAAO,aAAa,IAAI;EAI1B,IAAI,UAAU,OAAO,eAAe,KAClC,OAAO,mBAAmB,IAAI;EAIhC,IAAI,sBAAsB,KACxB,OAAO,mBAAmB,IAAI;EAIhC,IAAI,UAAU,OAAO,cAAc,KACjC,OAAO,wBAAwB,IAAI;CAEvC;CAGA,MAAM,gBAAgB,gBAAgB,IAAI;CAC1C,IAAI,cAAc,OAChB,OAAO;CAGT,MAAM,iBAAiB,iBAAiB,IAAI;CAC5C,IAAI,eAAe,OACjB,OAAO;CAGT,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mitre/hdf-validators",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0-rc.1",
|
|
4
4
|
"description": "JSON Schema validation for HDF documents (Results and Baselines)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"ajv": "^8.17.1",
|
|
29
29
|
"ajv-formats": "^3.0.1",
|
|
30
|
-
"@mitre/hdf-schema": "^3.
|
|
30
|
+
"@mitre/hdf-schema": "^3.7.0-rc.1"
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|
|
33
33
|
"node": ">=22.0.0"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@stryker-mutator/core": "^9.5.1",
|
|
43
43
|
"@stryker-mutator/vitest-runner": "^9.5.1",
|
|
44
|
-
"@mitre/hdf-fixtures": "^3.
|
|
44
|
+
"@mitre/hdf-fixtures": "^3.7.0-rc.1"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "tsdown",
|