Skip to content

Commit

Permalink
Add 'inventory-item-not-system-or-validation' constraint and tests (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabeblis authored Jan 31, 2025
1 parent 8c9fa76 commit 830ecb2
Show file tree
Hide file tree
Showing 5 changed files with 37 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 @@ -134,6 +134,7 @@ Examples:
| inventory-item-has-scan-type |
| inventory-item-has-valid-mac-address |
| inventory-item-has-vendor-name |
| inventory-item-not-system-or-validation |
| inventory-item-or-component-has-asset-id |
| inventory-item-or-component-has-virtual |
| inventory-item-public |
Expand Down Expand Up @@ -415,6 +416,8 @@ Examples:
| inventory-item-has-valid-mac-address-PASS.yaml |
| inventory-item-has-vendor-name-FAIL.yaml |
| inventory-item-has-vendor-name-PASS.yaml |
| inventory-item-not-system-or-validation-FAIL.yaml |
| inventory-item-not-system-or-validation-PASS.yaml |
| inventory-item-or-component-has-asset-id-FAIL.yaml |
| inventory-item-or-component-has-asset-id-PASS.yaml |
| inventory-item-public-FAIL.yaml |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<system-security-plan xmlns="http://csrc.nist.gov/ns/oscal/1.0" uuid="11111111-2222-4000-8000-000000000000">
<system-implementation>
<!-- Component type shouldn't be "system" or "validation". -->
<component uuid="11111111-2222-4000-8000-009000500006" type="system">
</component>
<inventory-item uuid="11111111-2222-4000-8000-011000000001">
<implemented-component component-uuid="11111111-2222-4000-8000-009000500006">
</implemented-component>
</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 @@ -746,6 +746,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>In a FedRAMP SSP, each inventory item MUST include the vendor name in the inventory item itself or within the linked component.</message>
</expect>
<expect id="inventory-item-not-system-or-validation" target="." test="not(../component[@uuid=$component-uuid]/@type=('system','validation'))" level="ERROR">
<formal-name>Inventory Item Not System or Validation</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, an inventory item MUST NOT reference a "system" or "validation" component.</message>
</expect>
<expect id="inventory-item-or-component-has-virtual" target="." test="count(prop[@name='virtual']) = 1 or count(../component[@uuid=$component-uuid]/prop[@name='virtual']) = 1" level="ERROR">
<formal-name>Inventory Item or Component Has Virtual</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-not-system-or-validation
description: >-
This test case validates the behavior of constraint
inventory-item-not-system-or-validation
content: ../content/ssp-inventory-item-not-system-or-validation-INVALID.xml
expectations:
- constraint-id: inventory-item-not-system-or-validation
result: fail
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
test-case:
name: Positive Test for inventory-item-not-system-or-validation
description: >-
This test case validates the behavior of constraint
inventory-item-not-system-or-validation
content: ../../../content/rev5/examples/ssp/xml/fedramp-ssp-example.oscal.xml
expectations:
- constraint-id: inventory-item-not-system-or-validation
result: pass

0 comments on commit 830ecb2

Please sign in to comment.