@mitre/hdf-extension-graph 3.0.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md ADDED
@@ -0,0 +1,55 @@
1
+ # License
2
+
3
+ Copyright © 2025 The MITRE Corporation.
4
+
5
+ Approved for Public Release; Distribution Unlimited. Case Number 18-3678.
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License"); you may
8
+ not use this file except in compliance with the License. You may obtain a
9
+ copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
+ License for the specific language governing permissions and limitations
17
+ under the License.
18
+
19
+ ## Redistribution Terms
20
+
21
+ Redistribution and use in source and binary forms, with or without
22
+ modification, are permitted provided that the following conditions are
23
+ met:
24
+
25
+ - Redistributions of source code must retain the above copyright/digital
26
+ rights legend, this list of conditions and the following Notice.
27
+ - Redistributions in binary form must reproduce the above
28
+ copyright/digital rights legend, this list of conditions and the
29
+ following Notice in the documentation and/or other materials provided
30
+ with the distribution.
31
+ - Neither the name of The MITRE Corporation nor the names of its contributors
32
+ may be used to endorse or promote products derived from this software
33
+ without specific prior written permission.
34
+
35
+ ## Notice
36
+
37
+ The MITRE Corporation grants permission to reproduce, distribute, modify, and
38
+ otherwise use this software to the extent permitted by the licensed terms
39
+ provided in the LICENSE file included with this project.
40
+
41
+ This software was produced by The MITRE Corporation for the U.S. Government
42
+ under contract. As such the U.S. Government has certain use and data
43
+ rights in this software. No use other than those granted to the U.S.
44
+ Government, or to those acting on behalf of the U.S. Government, under
45
+ these contract arrangements is authorized without the express written
46
+ permission of The MITRE Corporation.
47
+
48
+ Some files in this codebase were generated by generative AI, under the
49
+ direction and review of The MITRE Corporation employees, for the purpose of
50
+ development efficiency. All AI-generated code functionality was validated
51
+ by standard quality and assurance testing.
52
+
53
+ For further information, please contact The MITRE Corporation,
54
+ Contracts Management Office, 7515 Colshire Drive, McLean, VA 22102-7539,
55
+ (703) 983-6000.
package/README.md CHANGED
@@ -1,8 +1,20 @@
1
1
  # @mitre/hdf-extension-graph
2
2
 
3
- Bidirectional extension graph processing for HDF baseline hierarchies. Builds a navigable graph from `HdfResults` files that reveals how baselines (profiles) and requirements (controls) relate across extension/overlay layers.
3
+ Bidirectional extension graph processing for HDF baseline hierarchies.
4
4
 
5
- Ports the algorithm from Heimdall2's `context.ts` to the HDF v2 schema.
5
+ ## Why this exists
6
+
7
+ HDF baseline documents can represent 'overlay' structures that form extension chains of parent baselines and their children. For example, a DISA STIG baseline defines hundreds of requirements; an organizational overlay on that DISA baseline can modify a subset for organization-specific policies; a project overlay can further tighten thresholds for a specific system. When an HDF results file contains multiple baselines linked via `parentBaseline`, understanding what each layer changed requires walking these chains bidirectionally.
8
+
9
+ Without this library, answering "did this overlay change the impact of SV-238196, or inherit it unchanged?" requires manually cross-referencing requirements across baselines by ID. The extension graph provides:
10
+
11
+ - **`root`** — jump from any overlay requirement to the original base definition
12
+ - **`modifications`** — which fields (impact, title, severity, effectiveImpact, disposition) an overlay changed relative to its parent
13
+ - **`isRedundant`** — whether an overlay re-declares a control without actually changing it
14
+ - **`fullCode`** — the complete code from all layers in one string
15
+ - **`extensionChain`** — the ordered list of baselines from root to leaf
16
+
17
+ This is the same graph algorithm that powers Heimdall's control detail panel, extracted as a standalone library.
6
18
 
7
19
  ## Installation
8
20
 
@@ -139,6 +151,11 @@ interface Modification {
139
151
  }
140
152
  ```
141
153
 
154
+ ## Notes
155
+
156
+ - **TypeScript only** — there is no Go implementation of hdf-extension-graph.
157
+ - The HDF schemas consumed by this package are documented at <https://mitre.github.io/hdf-libs/schemas/>.
158
+
142
159
  ## License
143
160
 
144
161
  Apache-2.0
package/dist/index.d.ts CHANGED
@@ -1,72 +1,74 @@
1
- import type { HdfResults, EvaluatedBaseline, EvaluatedRequirement } from '@mitre/hdf-schema';
1
+ import { EvaluatedBaseline, EvaluatedRequirement, HdfResults } from "@mitre/hdf-schema";
2
+
3
+ //#region src/index.d.ts
2
4
  /** A detected change between an overlay requirement and its parent. */
3
- export interface Modification {
4
- field: string;
5
- originalValue: unknown;
6
- newValue: unknown;
7
- inBaseline: string;
5
+ interface Modification {
6
+ field: string;
7
+ originalValue: unknown;
8
+ newValue: unknown;
9
+ inBaseline: string;
8
10
  }
9
11
  /**
10
12
  * Wraps an EvaluatedRequirement with bidirectional extension links
11
13
  * and derived properties for navigating extension chains.
12
14
  */
13
- export declare class ContextualizedRequirement {
14
- /** The original requirement data. */
15
- readonly data: EvaluatedRequirement;
16
- /** The baseline this requirement belongs to. */
17
- readonly sourcedFrom: ContextualizedBaseline;
18
- /** Requirements in parent baselines that this requirement extends (overlays). */
19
- readonly extendsFrom: ContextualizedRequirement[];
20
- /** Requirements in child baselines that extend this requirement. */
21
- readonly extendedBy: ContextualizedRequirement[];
22
- constructor(data: EvaluatedRequirement, sourcedFrom: ContextualizedBaseline);
23
- /** The root (base) requirement at the bottom of the extension chain. */
24
- get root(): ContextualizedRequirement;
25
- /** True if this overlay adds no new code (empty/undefined or matches root). */
26
- get isRedundant(): boolean;
27
- /**
28
- * Full code concatenated from all layers, with baseline name headers.
29
- * Skips redundant overlay layers. Returns empty string if no code exists.
30
- */
31
- get fullCode(): string;
32
- /** Ordered chain of baselines from root to this requirement's baseline. */
33
- get extensionChain(): ContextualizedBaseline[];
34
- /** Fields that differ between this requirement and its immediate parent. */
35
- get modifications(): Modification[];
15
+ declare class ContextualizedRequirement {
16
+ /** The original requirement data. */
17
+ readonly data: EvaluatedRequirement;
18
+ /** The baseline this requirement belongs to. */
19
+ readonly sourcedFrom: ContextualizedBaseline;
20
+ /** Requirements in parent baselines that this requirement extends (overlays). */
21
+ readonly extendsFrom: ContextualizedRequirement[];
22
+ /** Requirements in child baselines that extend this requirement. */
23
+ readonly extendedBy: ContextualizedRequirement[];
24
+ constructor(data: EvaluatedRequirement, sourcedFrom: ContextualizedBaseline);
25
+ /** The root (base) requirement at the bottom of the extension chain. */
26
+ get root(): ContextualizedRequirement;
27
+ /** True if this overlay adds no new code (empty/undefined or matches root). */
28
+ get isRedundant(): boolean;
29
+ /**
30
+ * Full code concatenated from all layers, with baseline name headers.
31
+ * Skips redundant overlay layers. Returns empty string if no code exists.
32
+ */
33
+ get fullCode(): string;
34
+ /** Ordered chain of baselines from root to this requirement's baseline. */
35
+ get extensionChain(): ContextualizedBaseline[];
36
+ /** Fields that differ between this requirement and its immediate parent. */
37
+ get modifications(): Modification[];
36
38
  }
37
39
  /**
38
40
  * Wraps an EvaluatedBaseline with bidirectional extension links
39
41
  * and contextualized requirements.
40
42
  */
41
- export declare class ContextualizedBaseline {
42
- /** The original baseline data. */
43
- readonly data: EvaluatedBaseline;
44
- /** The HdfResults this baseline was sourced from. */
45
- readonly sourcedFrom: HdfResults;
46
- /** Parent baselines that this baseline extends. */
47
- readonly extendsFrom: ContextualizedBaseline[];
48
- /** Child baselines that extend this baseline. */
49
- readonly extendedBy: ContextualizedBaseline[];
50
- /** Contextualized wrappers for each requirement in this baseline. */
51
- readonly requirements: ContextualizedRequirement[];
52
- constructor(data: EvaluatedBaseline, sourcedFrom: HdfResults);
43
+ declare class ContextualizedBaseline {
44
+ /** The original baseline data. */
45
+ readonly data: EvaluatedBaseline;
46
+ /** The HdfResults this baseline was sourced from. */
47
+ readonly sourcedFrom: HdfResults;
48
+ /** Parent baselines that this baseline extends. */
49
+ readonly extendsFrom: ContextualizedBaseline[];
50
+ /** Child baselines that extend this baseline. */
51
+ readonly extendedBy: ContextualizedBaseline[];
52
+ /** Contextualized wrappers for each requirement in this baseline. */
53
+ readonly requirements: ContextualizedRequirement[];
54
+ constructor(data: EvaluatedBaseline, sourcedFrom: HdfResults);
53
55
  }
54
56
  /**
55
57
  * A bidirectional extension graph built from an HDF Results file.
56
58
  * Contains all baselines and requirements with their extension relationships.
57
59
  */
58
- export declare class ExtensionGraph {
59
- /** All contextualized baselines in the graph. */
60
- readonly baselines: readonly ContextualizedBaseline[];
61
- /** All contextualized requirements across all baselines. */
62
- readonly requirements: readonly ContextualizedRequirement[];
63
- constructor(baselines: readonly ContextualizedBaseline[], requirements: readonly ContextualizedRequirement[]);
64
- /** Find a baseline by name. Returns undefined if not found. */
65
- findBaseline(name: string): ContextualizedBaseline | undefined;
66
- /** Find all requirements with the given id across all baselines. */
67
- findRequirements(id: string): ContextualizedRequirement[];
68
- /** Baselines that have no parent (root of extension chains). */
69
- get rootBaselines(): ContextualizedBaseline[];
60
+ declare class ExtensionGraph {
61
+ /** All contextualized baselines in the graph. */
62
+ readonly baselines: readonly ContextualizedBaseline[];
63
+ /** All contextualized requirements across all baselines. */
64
+ readonly requirements: readonly ContextualizedRequirement[];
65
+ constructor(baselines: readonly ContextualizedBaseline[], requirements: readonly ContextualizedRequirement[]);
66
+ /** Find a baseline by name. Returns undefined if not found. */
67
+ findBaseline(name: string): ContextualizedBaseline | undefined;
68
+ /** Find all requirements with the given id across all baselines. */
69
+ findRequirements(id: string): ContextualizedRequirement[];
70
+ /** Baselines that have no parent (root of extension chains). */
71
+ get rootBaselines(): ContextualizedBaseline[];
70
72
  }
71
73
  /**
72
74
  * Build a bidirectional extension graph from an HDF Results file.
@@ -77,5 +79,7 @@ export declare class ExtensionGraph {
77
79
  * 3. Collect all requirements into a flat array
78
80
  * 4. Link requirements by id matching across linked baselines
79
81
  */
80
- export declare function buildExtensionGraph(results: HdfResults): ExtensionGraph;
82
+ declare function buildExtensionGraph(results: HdfResults): ExtensionGraph;
83
+ //#endregion
84
+ export { ContextualizedBaseline, ContextualizedRequirement, ExtensionGraph, Modification, buildExtensionGraph };
81
85
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,oBA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Cb,WAAA,EAAa,sBAAA;EAlCD;EAAA,SAqCZ,UAAA,EAAY,sBAAA;EArCY;EAAA,SAwCxB,YAAA,EAAc,yBAAA;cAEX,IAAA,EAAM,iBAAA,EAAmB,WAAA,EAAa,UAAA;AAAA;;;;;cAavC,cAAA;EAbO;EAAA,SAeT,SAAA,WAAoB,sBAAA;EAf+B;EAAA,SAkBnD,YAAA,WAAuB,yBAAA;cAG9B,SAAA,WAAoB,sBAAA,IACpB,YAAA,WAAuB,yBAAA;EApCV;EA2Cf,YAAA,CAAa,IAAA,WAAe,sBAAA;EAxCN;EA6CtB,gBAAA,CAAiB,EAAA,WAAa,yBAAA;EA1CR;EAAA,IA+ClB,aAAA,CAAA,GAAiB,sBAAA;AAAA;;;;;;;;;;iBAcP,mBAAA,CAAoB,OAAA,EAAS,UAAA,GAAa,cAAA"}
package/dist/index.js CHANGED
@@ -1,171 +1,148 @@
1
+ //#region src/index.ts
1
2
  /** Fields compared for modification detection between overlay and parent. */
2
- const TRACKED_FIELDS = ['impact', 'title', 'severity'];
3
+ const TRACKED_FIELDS = [
4
+ "impact",
5
+ "title",
6
+ "severity",
7
+ "effectiveImpact",
8
+ "disposition"
9
+ ];
3
10
  /**
4
- * Wraps an EvaluatedRequirement with bidirectional extension links
5
- * and derived properties for navigating extension chains.
6
- */
7
- export class ContextualizedRequirement {
8
- constructor(data, sourcedFrom) {
9
- /** Requirements in parent baselines that this requirement extends (overlays). */
10
- this.extendsFrom = [];
11
- /** Requirements in child baselines that extend this requirement. */
12
- this.extendedBy = [];
13
- this.data = data;
14
- this.sourcedFrom = sourcedFrom;
15
- }
16
- /** The root (base) requirement at the bottom of the extension chain. */
17
- get root() {
18
- if (this.extendsFrom.length === 0) {
19
- return this;
20
- }
21
- // Walk to the first parent's root (first match, like Heimdall2)
22
- return this.extendsFrom[0].root;
23
- }
24
- /** True if this overlay adds no new code (empty/undefined or matches root). */
25
- get isRedundant() {
26
- if (this.extendsFrom.length === 0) {
27
- return false;
28
- }
29
- const code = this.data.code;
30
- if (!code) {
31
- return true;
32
- }
33
- return code === this.root.data.code;
34
- }
35
- /**
36
- * Full code concatenated from all layers, with baseline name headers.
37
- * Skips redundant overlay layers. Returns empty string if no code exists.
38
- */
39
- get fullCode() {
40
- if (this.isRedundant && this.extendsFrom.length > 0) {
41
- return this.extendsFrom[0].fullCode;
42
- }
43
- const code = this.data.code;
44
- if (!code) {
45
- return '';
46
- }
47
- const header = `# ${this.sourcedFrom.data.name}\n${code}`;
48
- if (this.extendsFrom.length === 0) {
49
- return header;
50
- }
51
- const parentCode = this.extendsFrom[0].fullCode;
52
- return parentCode ? `${header}\n\n${parentCode}` : header;
53
- }
54
- /** Ordered chain of baselines from root to this requirement's baseline. */
55
- get extensionChain() {
56
- if (this.extendsFrom.length === 0) {
57
- return [this.sourcedFrom];
58
- }
59
- return [...this.extendsFrom[0].extensionChain, this.sourcedFrom];
60
- }
61
- /** Fields that differ between this requirement and its immediate parent. */
62
- get modifications() {
63
- if (this.extendsFrom.length === 0) {
64
- return [];
65
- }
66
- const parent = this.extendsFrom[0];
67
- const mods = [];
68
- for (const field of TRACKED_FIELDS) {
69
- const parentVal = parent.data[field];
70
- const thisVal = this.data[field];
71
- if (parentVal !== thisVal) {
72
- mods.push({
73
- field,
74
- originalValue: parentVal,
75
- newValue: thisVal,
76
- inBaseline: this.sourcedFrom.data.name,
77
- });
78
- }
79
- }
80
- return mods;
81
- }
82
- }
11
+ * Wraps an EvaluatedRequirement with bidirectional extension links
12
+ * and derived properties for navigating extension chains.
13
+ */
14
+ var ContextualizedRequirement = class {
15
+ constructor(data, sourcedFrom) {
16
+ this.extendsFrom = [];
17
+ this.extendedBy = [];
18
+ this.data = data;
19
+ this.sourcedFrom = sourcedFrom;
20
+ }
21
+ /** The root (base) requirement at the bottom of the extension chain. */
22
+ get root() {
23
+ if (this.extendsFrom.length === 0) return this;
24
+ return this.extendsFrom[0].root;
25
+ }
26
+ /** True if this overlay adds no new code (empty/undefined or matches root). */
27
+ get isRedundant() {
28
+ if (this.extendsFrom.length === 0) return false;
29
+ const code = this.data.code;
30
+ if (!code) return true;
31
+ return code === this.root.data.code;
32
+ }
33
+ /**
34
+ * Full code concatenated from all layers, with baseline name headers.
35
+ * Skips redundant overlay layers. Returns empty string if no code exists.
36
+ */
37
+ get fullCode() {
38
+ if (this.isRedundant && this.extendsFrom.length > 0) return this.extendsFrom[0].fullCode;
39
+ const code = this.data.code;
40
+ if (!code) return "";
41
+ const header = `# ${this.sourcedFrom.data.name}\n${code}`;
42
+ if (this.extendsFrom.length === 0) return header;
43
+ const parentCode = this.extendsFrom[0].fullCode;
44
+ return parentCode ? `${header}\n\n${parentCode}` : header;
45
+ }
46
+ /** Ordered chain of baselines from root to this requirement's baseline. */
47
+ get extensionChain() {
48
+ if (this.extendsFrom.length === 0) return [this.sourcedFrom];
49
+ return [...this.extendsFrom[0].extensionChain, this.sourcedFrom];
50
+ }
51
+ /** Fields that differ between this requirement and its immediate parent. */
52
+ get modifications() {
53
+ if (this.extendsFrom.length === 0) return [];
54
+ const parent = this.extendsFrom[0];
55
+ const mods = [];
56
+ for (const field of TRACKED_FIELDS) {
57
+ const parentVal = parent.data[field];
58
+ const thisVal = this.data[field];
59
+ if (parentVal !== thisVal) mods.push({
60
+ field,
61
+ originalValue: parentVal,
62
+ newValue: thisVal,
63
+ inBaseline: this.sourcedFrom.data.name
64
+ });
65
+ }
66
+ return mods;
67
+ }
68
+ };
83
69
  /**
84
- * Wraps an EvaluatedBaseline with bidirectional extension links
85
- * and contextualized requirements.
86
- */
87
- export class ContextualizedBaseline {
88
- constructor(data, sourcedFrom) {
89
- /** Parent baselines that this baseline extends. */
90
- this.extendsFrom = [];
91
- /** Child baselines that extend this baseline. */
92
- this.extendedBy = [];
93
- this.data = data;
94
- this.sourcedFrom = sourcedFrom;
95
- this.requirements = data.requirements.map((req) => new ContextualizedRequirement(req, this));
96
- }
97
- }
70
+ * Wraps an EvaluatedBaseline with bidirectional extension links
71
+ * and contextualized requirements.
72
+ */
73
+ var ContextualizedBaseline = class {
74
+ constructor(data, sourcedFrom) {
75
+ this.extendsFrom = [];
76
+ this.extendedBy = [];
77
+ this.data = data;
78
+ this.sourcedFrom = sourcedFrom;
79
+ this.requirements = data.requirements.map((req) => new ContextualizedRequirement(req, this));
80
+ }
81
+ };
98
82
  /**
99
- * A bidirectional extension graph built from an HDF Results file.
100
- * Contains all baselines and requirements with their extension relationships.
101
- */
102
- export class ExtensionGraph {
103
- constructor(baselines, requirements) {
104
- this.baselines = baselines;
105
- this.requirements = requirements;
106
- }
107
- /** Find a baseline by name. Returns undefined if not found. */
108
- findBaseline(name) {
109
- return this.baselines.find((b) => b.data.name === name);
110
- }
111
- /** Find all requirements with the given id across all baselines. */
112
- findRequirements(id) {
113
- return this.requirements.filter((r) => r.data.id === id);
114
- }
115
- /** Baselines that have no parent (root of extension chains). */
116
- get rootBaselines() {
117
- return this.baselines.filter((b) => !b.data.parentBaseline);
118
- }
119
- }
83
+ * A bidirectional extension graph built from an HDF Results file.
84
+ * Contains all baselines and requirements with their extension relationships.
85
+ */
86
+ var ExtensionGraph = class {
87
+ constructor(baselines, requirements) {
88
+ this.baselines = baselines;
89
+ this.requirements = requirements;
90
+ }
91
+ /** Find a baseline by name. Returns undefined if not found. */
92
+ findBaseline(name) {
93
+ return this.baselines.find((b) => b.data.name === name);
94
+ }
95
+ /** Find all requirements with the given id across all baselines. */
96
+ findRequirements(id) {
97
+ return this.requirements.filter((r) => r.data.id === id);
98
+ }
99
+ /** Baselines that have no parent (root of extension chains). */
100
+ get rootBaselines() {
101
+ return this.baselines.filter((b) => !b.data.parentBaseline);
102
+ }
103
+ };
120
104
  /**
121
- * Build a bidirectional extension graph from an HDF Results file.
122
- *
123
- * Four phases:
124
- * 1. Wrap each EvaluatedBaseline in a ContextualizedBaseline
125
- * 2. Link baselines via parentBaseline name matching (bidirectional)
126
- * 3. Collect all requirements into a flat array
127
- * 4. Link requirements by id matching across linked baselines
128
- */
129
- export function buildExtensionGraph(results) {
130
- // Phase 1: Wrap baselines
131
- const baselineMap = new Map();
132
- const baselines = [];
133
- for (const baseline of results.baselines) {
134
- const ctx = new ContextualizedBaseline(baseline, results);
135
- baselines.push(ctx);
136
- baselineMap.set(baseline.name, ctx);
137
- }
138
- // Phase 2: Link baselines via parentBaseline
139
- for (const ctx of baselines) {
140
- const parentName = ctx.data.parentBaseline;
141
- if (parentName) {
142
- const parent = baselineMap.get(parentName);
143
- if (parent) {
144
- ctx.extendsFrom.push(parent);
145
- parent.extendedBy.push(ctx);
146
- }
147
- }
148
- }
149
- // Phase 3: Collect all requirements
150
- const allRequirements = [];
151
- for (const ctx of baselines) {
152
- allRequirements.push(...ctx.requirements);
153
- }
154
- // Phase 4: Link requirements by id across linked baselines
155
- for (const ctx of baselines) {
156
- if (ctx.extendsFrom.length === 0) {
157
- continue;
158
- }
159
- for (const childReq of ctx.requirements) {
160
- for (const parentBaseline of ctx.extendsFrom) {
161
- const parentReq = parentBaseline.requirements.find((r) => r.data.id === childReq.data.id);
162
- if (parentReq) {
163
- childReq.extendsFrom.push(parentReq);
164
- parentReq.extendedBy.push(childReq);
165
- }
166
- }
167
- }
168
- }
169
- return new ExtensionGraph(baselines, allRequirements);
105
+ * Build a bidirectional extension graph from an HDF Results file.
106
+ *
107
+ * Four phases:
108
+ * 1. Wrap each EvaluatedBaseline in a ContextualizedBaseline
109
+ * 2. Link baselines via parentBaseline name matching (bidirectional)
110
+ * 3. Collect all requirements into a flat array
111
+ * 4. Link requirements by id matching across linked baselines
112
+ */
113
+ function buildExtensionGraph(results) {
114
+ const baselineMap = /* @__PURE__ */ new Map();
115
+ const baselines = [];
116
+ for (const baseline of results.baselines) {
117
+ const ctx = new ContextualizedBaseline(baseline, results);
118
+ baselines.push(ctx);
119
+ baselineMap.set(baseline.name, ctx);
120
+ }
121
+ for (const ctx of baselines) {
122
+ const parentName = ctx.data.parentBaseline;
123
+ if (parentName) {
124
+ const parent = baselineMap.get(parentName);
125
+ if (parent) {
126
+ ctx.extendsFrom.push(parent);
127
+ parent.extendedBy.push(ctx);
128
+ }
129
+ }
130
+ }
131
+ const allRequirements = [];
132
+ for (const ctx of baselines) allRequirements.push(...ctx.requirements);
133
+ for (const ctx of baselines) {
134
+ if (ctx.extendsFrom.length === 0) continue;
135
+ for (const childReq of ctx.requirements) for (const parentBaseline of ctx.extendsFrom) {
136
+ const parentReq = parentBaseline.requirements.find((r) => r.data.id === childReq.data.id);
137
+ if (parentReq) {
138
+ childReq.extendsFrom.push(parentReq);
139
+ parentReq.extendedBy.push(childReq);
140
+ }
141
+ }
142
+ }
143
+ return new ExtensionGraph(baselines, allRequirements);
170
144
  }
145
+ //#endregion
146
+ export { ContextualizedBaseline, ContextualizedRequirement, ExtensionGraph, buildExtensionGraph };
147
+
171
148
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,6EAA6E;AAC7E,MAAM,cAAc,GAAsB,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAU,CAAC;AAUnF;;;GAGG;AACH,MAAM,OAAO,yBAAyB;IAapC,YAAY,IAA0B,EAAE,WAAmC;QAN3E,iFAAiF;QACxE,gBAAW,GAAgC,EAAE,CAAC;QAEvD,oEAAoE;QAC3D,eAAU,GAAgC,EAAE,CAAC;QAGpD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,wEAAwE;IACxE,IAAI,IAAI;QACN,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,gEAAgE;QAChE,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAE,CAAC,IAAI,CAAC;IACnC,CAAC;IAED,+EAA+E;IAC/E,IAAI,WAAW;QACb,IAAI,IA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{ HdfResults, EvaluatedBaseline, EvaluatedRequirement } from '@mitre/hdf-schema';\n\n/** Fields compared for modification detection between overlay and parent. */\nconst TRACKED_FIELDS: readonly (string & keyof EvaluatedRequirement)[] = ['impact', 'title', 'severity', 'effectiveImpact', 'disposition'];\n\n/** A detected change between an overlay requirement and its parent. */\nexport interface Modification {\n field: string;\n originalValue: unknown;\n newValue: unknown;\n inBaseline: string;\n}\n\n/**\n * Wraps an EvaluatedRequirement with bidirectional extension links\n * and derived properties for navigating extension chains.\n */\nexport class ContextualizedRequirement {\n /** The original requirement data. */\n readonly data: EvaluatedRequirement;\n\n /** The baseline this requirement belongs to. */\n readonly sourcedFrom: ContextualizedBaseline;\n\n /** Requirements in parent baselines that this requirement extends (overlays). */\n readonly extendsFrom: ContextualizedRequirement[] = [];\n\n /** Requirements in child baselines that extend this requirement. */\n readonly extendedBy: ContextualizedRequirement[] = [];\n\n constructor(data: EvaluatedRequirement, sourcedFrom: ContextualizedBaseline) {\n this.data = data;\n this.sourcedFrom = sourcedFrom;\n }\n\n /** The root (base) requirement at the bottom of the extension chain. */\n get root(): ContextualizedRequirement {\n if (this.extendsFrom.length === 0) {\n return this;\n }\n // Walk to the first parent's root (first match, like Heimdall2)\n return this.extendsFrom[0]!.root;\n }\n\n /** True if this overlay adds no new code (empty/undefined or matches root). */\n get isRedundant(): boolean {\n if (this.extendsFrom.length === 0) {\n return false;\n }\n const code = this.data.code;\n if (!code) {\n return true;\n }\n return code === this.root.data.code;\n }\n\n /**\n * Full code concatenated from all layers, with baseline name headers.\n * Skips redundant overlay layers. Returns empty string if no code exists.\n */\n get fullCode(): string {\n if (this.isRedundant && this.extendsFrom.length > 0) {\n return this.extendsFrom[0]!.fullCode;\n }\n const code = this.data.code;\n if (!code) {\n return '';\n }\n const header = `# ${this.sourcedFrom.data.name}\\n${code}`;\n if (this.extendsFrom.length === 0) {\n return header;\n }\n const parentCode = this.extendsFrom[0]!.fullCode;\n return parentCode ? `${header}\\n\\n${parentCode}` : header;\n }\n\n /** Ordered chain of baselines from root to this requirement's baseline. */\n get extensionChain(): ContextualizedBaseline[] {\n if (this.extendsFrom.length === 0) {\n return [this.sourcedFrom];\n }\n return [...this.extendsFrom[0]!.extensionChain, this.sourcedFrom];\n }\n\n /** Fields that differ between this requirement and its immediate parent. */\n get modifications(): Modification[] {\n if (this.extendsFrom.length === 0) {\n return [];\n }\n const parent = this.extendsFrom[0]!;\n const mods: Modification[] = [];\n for (const field of TRACKED_FIELDS) {\n const parentVal = (parent.data as Record<string, unknown>)[field];\n const thisVal = (this.data as Record<string, unknown>)[field];\n if (parentVal !== thisVal) {\n mods.push({\n field,\n originalValue: parentVal,\n newValue: thisVal,\n inBaseline: this.sourcedFrom.data.name,\n });\n }\n }\n return mods;\n }\n}\n\n/**\n * Wraps an EvaluatedBaseline with bidirectional extension links\n * and contextualized requirements.\n */\nexport class ContextualizedBaseline {\n /** The original baseline data. */\n readonly data: EvaluatedBaseline;\n\n /** The HdfResults this baseline was sourced from. */\n readonly sourcedFrom: HdfResults;\n\n /** Parent baselines that this baseline extends. */\n readonly extendsFrom: ContextualizedBaseline[] = [];\n\n /** Child baselines that extend this baseline. */\n readonly extendedBy: ContextualizedBaseline[] = [];\n\n /** Contextualized wrappers for each requirement in this baseline. */\n readonly requirements: ContextualizedRequirement[];\n\n constructor(data: EvaluatedBaseline, sourcedFrom: HdfResults) {\n this.data = data;\n this.sourcedFrom = sourcedFrom;\n this.requirements = data.requirements.map(\n (req) => new ContextualizedRequirement(req, this)\n );\n }\n}\n\n/**\n * A bidirectional extension graph built from an HDF Results file.\n * Contains all baselines and requirements with their extension relationships.\n */\nexport class ExtensionGraph {\n /** All contextualized baselines in the graph. */\n readonly baselines: readonly ContextualizedBaseline[];\n\n /** All contextualized requirements across all baselines. */\n readonly requirements: readonly ContextualizedRequirement[];\n\n constructor(\n baselines: readonly ContextualizedBaseline[],\n requirements: readonly ContextualizedRequirement[]\n ) {\n this.baselines = baselines;\n this.requirements = requirements;\n }\n\n /** Find a baseline by name. Returns undefined if not found. */\n findBaseline(name: string): ContextualizedBaseline | undefined {\n return this.baselines.find((b) => b.data.name === name);\n }\n\n /** Find all requirements with the given id across all baselines. */\n findRequirements(id: string): ContextualizedRequirement[] {\n return this.requirements.filter((r) => r.data.id === id);\n }\n\n /** Baselines that have no parent (root of extension chains). */\n get rootBaselines(): ContextualizedBaseline[] {\n return this.baselines.filter((b) => !b.data.parentBaseline);\n }\n}\n\n/**\n * Build a bidirectional extension graph from an HDF Results file.\n *\n * Four phases:\n * 1. Wrap each EvaluatedBaseline in a ContextualizedBaseline\n * 2. Link baselines via parentBaseline name matching (bidirectional)\n * 3. Collect all requirements into a flat array\n * 4. Link requirements by id matching across linked baselines\n */\nexport function buildExtensionGraph(results: HdfResults): ExtensionGraph {\n // Phase 1: Wrap baselines\n const baselineMap = new Map<string, ContextualizedBaseline>();\n const baselines: ContextualizedBaseline[] = [];\n\n for (const baseline of results.baselines) {\n const ctx = new ContextualizedBaseline(baseline, results);\n baselines.push(ctx);\n baselineMap.set(baseline.name, ctx);\n }\n\n // Phase 2: Link baselines via parentBaseline\n for (const ctx of baselines) {\n const parentName = ctx.data.parentBaseline;\n if (parentName) {\n const parent = baselineMap.get(parentName);\n if (parent) {\n ctx.extendsFrom.push(parent);\n parent.extendedBy.push(ctx);\n }\n }\n }\n\n // Phase 3: Collect all requirements\n const allRequirements: ContextualizedRequirement[] = [];\n for (const ctx of baselines) {\n allRequirements.push(...ctx.requirements);\n }\n\n // Phase 4: Link requirements by id across linked baselines\n for (const ctx of baselines) {\n if (ctx.extendsFrom.length === 0) {\n continue;\n }\n for (const childReq of ctx.requirements) {\n for (const parentBaseline of ctx.extendsFrom) {\n const parentReq = parentBaseline.requirements.find(\n (r) => r.data.id === childReq.data.id\n );\n if (parentReq) {\n childReq.extendsFrom.push(parentReq);\n parentReq.extendedBy.push(childReq);\n }\n }\n }\n }\n\n return new ExtensionGraph(baselines, allRequirements);\n}\n"],"mappings":";;AAGA,MAAM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AAI,aAAa;GAC5C,MAAM,YAAY,eAAe,aAAa,MAC3C,MAAM,EAAE,KAAK,OAAO,SAAS,KAAK,GACpC;AACD,OAAI,WAAW;AACb,aAAS,YAAY,KAAK,UAAU;AACpC,cAAU,WAAW,KAAK,SAAS;;;;AAM3C,QAAO,IAAI,eAAe,WAAW,gBAAgB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mitre/hdf-extension-graph",
3
- "version": "3.0.1",
3
+ "version": "3.1.0",
4
4
  "description": "Bidirectional extension graph processing for HDF profile/baseline hierarchies",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -10,24 +10,13 @@
10
10
  "types": "./dist/index.d.ts",
11
11
  "exports": {
12
12
  ".": {
13
- "import": "./dist/index.js",
14
- "types": "./dist/index.d.ts"
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js"
15
15
  }
16
16
  },
17
17
  "files": [
18
18
  "dist"
19
19
  ],
20
- "scripts": {
21
- "build": "pnpm clean && tsc",
22
- "clean": "rimraf dist",
23
- "test": "pnpm run test:ts",
24
- "test:ts": "vitest run",
25
- "test:watch": "vitest",
26
- "test:coverage": "vitest run --coverage",
27
- "type-check": "tsc --noEmit",
28
- "lint": "eslint src test",
29
- "lint:fix": "eslint src test --fix"
30
- },
31
20
  "repository": {
32
21
  "type": "git",
33
22
  "url": "https://github.com/mitre/hdf-libs.git",
@@ -36,10 +25,10 @@
36
25
  "author": "MITRE Corporation",
37
26
  "license": "Apache-2.0",
38
27
  "dependencies": {
39
- "@mitre/hdf-schema": "workspace:*"
28
+ "@mitre/hdf-schema": "^3.1.0"
40
29
  },
41
30
  "engines": {
42
- "node": ">=20.0.0"
31
+ "node": ">=22.0.0"
43
32
  },
44
33
  "keywords": [
45
34
  "hdf",
@@ -48,5 +37,16 @@
48
37
  "overlay",
49
38
  "profile",
50
39
  "graph"
51
- ]
52
- }
40
+ ],
41
+ "scripts": {
42
+ "build": "tsdown",
43
+ "clean": "rimraf dist",
44
+ "test": "pnpm run test:ts",
45
+ "test:ts": "vitest run",
46
+ "test:watch": "vitest",
47
+ "test:coverage": "vitest run --coverage",
48
+ "type-check": "tsc --noEmit",
49
+ "lint": "eslint src test",
50
+ "lint:fix": "eslint src test --fix"
51
+ }
52
+ }