Skip to content

Commit

Permalink
Add 'inventory-item-has-hardware-model' constraints and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabeblis committed Jan 9, 2025
1 parent 18a02c9 commit 4c0efa1
Show file tree
Hide file tree
Showing 6 changed files with 42 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 @@ -121,6 +121,7 @@ Examples:
| interconnection-security |
| inventory-item-allows-authenticated-scan |
| inventory-item-and-component-has-public |
| inventory-item-has-hardware-model |
| inventory-item-has-valid-mac-address |
| inventory-item-has-vendor-name |
| inventory-item-or-component-has-asset-id |
Expand Down Expand Up @@ -376,6 +377,8 @@ Examples:
| inventory-item-allows-authenticated-scan-PASS.yaml |
| inventory-item-and-component-has-public-FAIL.yaml |
| inventory-item-and-component-has-public-PASS.yaml |
| inventory-item-has-hardware-model-FAIL.yaml |
| inventory-item-has-hardware-model-PASS.yaml |
| inventory-item-has-valid-mac-address-FAIL.yaml |
| inventory-item-has-valid-mac-address-PASS.yaml |
| inventory-item-has-vendor-name-FAIL.yaml |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2305,6 +2305,7 @@ approved.</p>
<description>
<p>Legacy Example (No implemented-component).</p>
</description>
<prop name="hardware-model" value="model"/>
<prop name="asset-id" value="unique-asset-ID-01"/>
<prop name="ipv4-address" value="10.1.1.1"/>
<prop name="ipv6-address" value="2001:db8:3333:4444:5555:6666:7777:8888"/>
Expand Down Expand Up @@ -2359,6 +2360,7 @@ approved.</p>
<description>
<p>Component Inventory Example</p>
</description>
<prop name="hardware-model" value="model"/>
<prop name="asset-id" value="unique-asset-ID-02"/>
<prop name="ipv4-address" value="10.2.2.2"/>
<prop name="ipv6-address" value="0000:0000:0000:0000:0000:ffff:0a02:0202"/>
Expand Down Expand Up @@ -2398,6 +2400,7 @@ approved.</p>
<description>
<p>None.</p>
</description>
<prop name="hardware-model" value="model"/>
<prop name="asset-id" value="unique-asset-ID-03"/>
<prop name="asset-type" value="web-server"/>
<prop name="virtual" value="yes"/>
Expand All @@ -2414,6 +2417,7 @@ approved.</p>
<description>
<p>None.</p>
</description>
<prop name="hardware-model" value="model"/>
<prop name="asset-id" value="unique-asset-ID-04"/>
<prop name="asset-type" value="appliance"/>
<prop name="virtual" value="yes"/>
Expand All @@ -2429,6 +2433,7 @@ approved.</p>
<description>
<p>None.</p>
</description>
<prop name="hardware-model" value="model"/>
<prop name="asset-id" value="unique-asset-ID-05"/>
<prop name="asset-type" value="firewall"/>
<prop name="ipv4-address" value="10.5.5.5"/>
Expand All @@ -2444,6 +2449,7 @@ approved.</p>
<description>
<p>None.</p>
</description>
<prop name="hardware-model" value="model"/>
<prop name="asset-id" value="unique-asset-ID-06"/>
<prop name="ipv4-address" value="10.6.6.6"/>
<prop name="ipv6-address" value="0000:0000:0000:0000:0000:ffff:0a06:0606"/>
Expand All @@ -2462,6 +2468,7 @@ approved.</p>
<description>
<p>None.</p>
</description>
<prop name="hardware-model" value="model"/>
<prop name="asset-id" value="unique-asset-ID-07"/>
<prop name="asset-type" value="switch"/>
<prop name="ipv4-address" value="10.7.7.7"/>
Expand All @@ -2477,6 +2484,7 @@ approved.</p>
<description>
<p>None.</p>
</description>
<prop name="hardware-model" value="model"/>
<prop name="asset-id" value="unique-asset-ID-08"/>
<prop name="asset-type" value="web-server"/>
<prop name="ipv4-address" value="10.8.8.8"/>
Expand All @@ -2495,6 +2503,7 @@ approved.</p>
<description>
<p>Email-Service</p>
</description>
<prop name="hardware-model" value="model"/>
<prop name="asset-id" value="unique-asset-ID-09"/>
<prop name="asset-type" value="email-server"/>
<prop name="ipv4-address" value="10.10.10.100"/>
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="hardware-model" value="model"/> Missing "hardware-model" 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 @@ -663,6 +663,11 @@
<metapath target="/system-security-plan/system-implementation/inventory-item"/>
<constraints>
<let var ="component-uuid" expression="implemented-component/@component-uuid"/>
<expect id="inventory-item-has-hardware-model" target="." test="count(prop[@name='hardware-model' ]) >= 1 or count(../component[@uuid=$component-uuid]/prop[@name='hardware-model' ]) >= 1" level="ERROR">
<formal-name>Inventory Item Has Hardware Model</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 provide the hardware model either in the inventory item itself or within the linked component.</message>
</expect>
<expect id="inventory-item-has-valid-mac-address" target=".[prop[@name='mac-address']]/prop[@name='mac-address']" test="matches(@value, '^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})|([0-9a-fA-F]{4}\\.[0-9a-fA-F]{4}\\.[0-9a-fA-F]{4})$')" level="ERROR">
<formal-name>Inventory Item Has Valid Mac Address</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-hardware-model
description: >-
This test case validates the behavior of constraint
inventory-item-has-hardware-model
content: ../content/ssp-inventory-item-has-hardware-model-INVALID.xml
expectations:
- constraint-id: inventory-item-has-hardware-model
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-hardware-model
description: >-
This test case validates the behavior of constraint
inventory-item-has-hardware-model
content: ../../../content/rev5/examples/ssp/xml/fedramp-ssp-example.oscal.xml
expectations:
- constraint-id: inventory-item-has-hardware-model
result: pass

0 comments on commit 4c0efa1

Please sign in to comment.