Skip to content

Commit bbc8649

Browse files
authored
Update OSCAL part names and subclass reqs into items (#452)
* Bump oscal-club action to v2.0.2 Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]> * Update oscal names and reclass ctls to items This PR updates the names of the OSCAL parts to use the valid names according to the nested levels. We also now subclass each control item to its own part. Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]> --------- Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
1 parent bcb8c33 commit bbc8649

File tree

2 files changed

+46
-31
lines changed

2 files changed

+46
-31
lines changed

.github/workflows/oscal-check.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
./go-oscal validate --input-file oscal-sample.json
5151
5252
- name: Validate Catalog with oscal-club/NIST CLI
53-
uses: oscal-club/oscal-cli-action@1a210b84bc1fd6adf15c9cf0d46a51d15a3d8301 # v2.0.1
53+
uses: oscal-club/oscal-cli-action@b5b0c80a1a158797bea4475d13d12c494b56019b # v2.0.2
5454
with:
5555
args: catalog validate oscal-sample.json
5656

cmd/pkg/baseline/generator_oscal.go

Lines changed: 45 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -51,50 +51,65 @@ func (g *Generator) ExportOSCAL(b *types.Baseline, w io.Writer) error {
5151
Class: "OSPS",
5252
Controls: nil,
5353
ID: b.ControlFamilyIDs[family.Title],
54-
Title: family.Description,
54+
Parts: &[]oscal.Part{
55+
{
56+
Name: "overview",
57+
Prose: family.Description,
58+
},
59+
},
60+
Title: family.Title,
5561
}
5662

5763
controls := []oscal.Control{}
5864
for _, control := range family.Controls {
59-
parts := []oscal.Part{}
65+
// Create the new OSCAL control.
66+
newOscalCtl := oscal.Control{
67+
Class: b.ControlFamilyIDs[family.Title],
68+
ID: control.Id,
69+
Title: strings.TrimSpace(control.Id), // For some reason, control.Title is the full description
70+
Links: &[]oscal.Link{
71+
{
72+
Href: fmt.Sprintf(controlHREF, VersionOSPS, strings.ToLower(control.Id)),
73+
Rel: "canonical",
74+
},
75+
},
76+
// The main prose of the control lives in the statement part
77+
Parts: &[]oscal.Part{
78+
{
79+
ID: control.Id + "_smt",
80+
Name: "statement",
81+
Ns: OpenSSFNS,
82+
Prose: control.Title,
83+
},
84+
{
85+
ID: control.Id + "_obj",
86+
Name: "objective",
87+
Ns: OpenSSFNS,
88+
Prose: control.Objective,
89+
},
90+
},
91+
}
92+
93+
items := []oscal.Part{}
6094
for _, ar := range control.AssessmentRequirements {
61-
parts = append(parts, oscal.Part{
62-
Class: control.Id,
95+
items = append(items, oscal.Part{
6396
ID: ar.Id,
64-
Name: ar.Id,
65-
Ns: "",
97+
Name: "item",
98+
Ns: OpenSSFNS,
99+
Prose: ar.Text,
100+
Title: ar.Id,
66101
Parts: &[]oscal.Part{
67102
{
68-
ID: ar.Id + ".R",
69-
Name: "recommendation",
70-
Ns: OpenSSFNS,
103+
ID: ar.Id + "_obj",
104+
Name: "assessment-objective",
71105
Prose: ar.Recommendation,
72-
Links: &[]oscal.Link{
73-
{
74-
Href: fmt.Sprintf(controlHREF, VersionOSPS, ar.Id),
75-
Rel: "canonical",
76-
},
77-
},
78106
},
79107
},
80-
Prose: ar.Text,
81-
Title: "",
82108
})
83109
}
84110

85-
newCtl := oscal.Control{
86-
Class: b.ControlFamilyIDs[family.Title],
87-
ID: control.Id,
88-
Links: &[]oscal.Link{
89-
{
90-
Href: fmt.Sprintf(controlHREF, VersionOSPS, strings.ToLower(control.Id)),
91-
Rel: "canonical",
92-
},
93-
},
94-
Parts: &parts,
95-
Title: strings.TrimSpace(control.Title),
96-
}
97-
controls = append(controls, newCtl)
111+
(*newOscalCtl.Parts)[0].Parts = &items
112+
controls = append(controls, newOscalCtl)
98113
}
99114

100115
group.Controls = &controls

0 commit comments

Comments
 (0)