Skip to content

Commit

Permalink
Add 'inventory-item-has-is-scanned' constraint and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabeblis committed Jan 10, 2025
1 parent 60ba7f7 commit bcacba4
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions features/fedramp_extensions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ Examples:
| inventory-item-allows-authenticated-scan |
| inventory-item-and-component-has-public |
| inventory-item-has-function |
| inventory-item-has-is-scanned |
| inventory-item-has-scan-type |
| inventory-item-has-valid-mac-address |
| inventory-item-has-vendor-name |
Expand Down Expand Up @@ -390,6 +391,8 @@ Examples:
| inventory-item-and-component-has-public-PASS.yaml |
| inventory-item-has-function-FAIL.yaml |
| inventory-item-has-function-PASS.yaml |
| inventory-item-has-is-scanned-FAIL.yaml |
| inventory-item-has-is-scanned-PASS.yaml |
| inventory-item-has-scan-type-FAIL.yaml |
| inventory-item-has-scan-type-PASS.yaml |
| inventory-item-has-valid-mac-address-FAIL.yaml |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2375,6 +2375,7 @@ approved.</p>
<prop name="fqdn" value="dns.name"/>
<prop name="uri" value="uniform.resource.locator"/>
<prop name="netbios-name" value="netbios-name"/>
<prop name="is-scanned" value="yes"/>
<!-- patch-level applies to component, not inventory-item -->
<!-- <prop name="patch-level" value="Patch-Level"/> -->
<prop name="baseline-configuration-name" value="Baseline Configuration Name"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<system-security-plan xmlns="http://csrc.nist.gov/ns/oscal/1.0" uuid="11111111-2222-4000-8000-000000000000">
<system-implementation>
<inventory-item uuid="11111111-2222-4000-8000-011000000001">
<!-- <prop name="is-scanned" value="yes"/> Missing "is-scanned" prop -->
</inventory-item>
</system-implementation>
</system-security-plan>
5 changes: 5 additions & 0 deletions src/validations/constraints/fedramp-external-constraints.xml
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,11 @@
<prop namespace="https://docs.oasis-open.org/sarif/sarif/v2.1.0" name="help-url" value="https://automate.fedramp.gov/documentation/ssp/5-attachments/#system-inventory-approach"/>
<message>Every inventory-item MUST provide remarks to describe the function of the item, either within the inventory-item itself, or within the component linked by the inventory-item.</message>
</expect>
<expect id="inventory-item-has-is-scanned" target="." test="count(prop[@name='is-scanned']) = 1 or count(../component[@uuid=$component-uuid]/prop[@name='is-scanned']) = 1" level="ERROR">
<formal-name>Inventory Item Has Is-Scanned</formal-name>
<prop namespace="https://docs.oasis-open.org/sarif/sarif/v2.1.0" name="help-url" value="https://automate.fedramp.gov/documentation/ssp/5-attachments/#system-inventory-approach"/>
<message>In a FedRAMP SSP, each inventory item MUST state if it is included in scans either in the inventory item itself or within the linked component.</message>
</expect>
<expect id="inventory-item-has-scan-type" target="." test="count(prop[@name='scan-type' and @ns='http://fedramp.gov/ns/oscal']) >= 1 or count($implemented-component/prop[@name='scan-type' and @ns='http://fedramp.gov/ns/oscal']) >= 1" level="ERROR">
<formal-name>Inventory Item Has Scan Type</formal-name>
<prop namespace="https://docs.oasis-open.org/sarif/sarif/v2.1.0" name="help-url" value="https://automate.fedramp.gov/documentation/ssp/5-attachments/#system-inventory-approach"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
test-case:
name: Negative Test for inventory-item-has-is-scanned
description: >-
This test case validates the behavior of constraint
inventory-item-has-is-scanned
content: ../content/ssp-inventory-item-has-is-scanned-INVALID.xml
expectations:
- constraint-id: inventory-item-has-is-scanned
result: fail
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
test-case:
name: Positive Test for inventory-item-has-is-scanned
description: >-
This test case validates the behavior of constraint
inventory-item-has-is-scanned
content: ../../../content/rev5/examples/ssp/xml/fedramp-ssp-example.oscal.xml
expectations:
- constraint-id: inventory-item-has-is-scanned
result: pass

0 comments on commit bcacba4

Please sign in to comment.