From 2b00ff6b872d139712aee34c3ebc5a816f02a7f5 Mon Sep 17 00:00:00 2001 From: Gabeblis Date: Tue, 14 Jan 2025 09:45:55 -0500 Subject: [PATCH] Add 'inventory-item-or-component-has-virtual' constraint and tests (#1055) --- features/fedramp_extensions.feature | 3 +++ ...tory-item-or-component-has-virtual-INVALID.xml | 12 ++++++++++++ .../constraints/fedramp-external-constraints.xml | 15 ++++++++++----- ...entory-item-or-component-has-virtual-FAIL.yaml | 9 +++++++++ ...entory-item-or-component-has-virtual-PASS.yaml | 9 +++++++++ 5 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 src/validations/constraints/content/ssp-inventory-item-or-component-has-virtual-INVALID.xml create mode 100644 src/validations/constraints/unit-tests/iventory-item-or-component-has-virtual-FAIL.yaml create mode 100644 src/validations/constraints/unit-tests/iventory-item-or-component-has-virtual-PASS.yaml diff --git a/features/fedramp_extensions.feature b/features/fedramp_extensions.feature index f748b172a..829030452 100644 --- a/features/fedramp_extensions.feature +++ b/features/fedramp_extensions.feature @@ -131,6 +131,7 @@ Examples: | inventory-item-has-valid-mac-address | | inventory-item-has-vendor-name | | inventory-item-or-component-has-asset-id | + | inventory-item-or-component-has-virtual | | inventory-item-public | | inventory-item-virtual | | last-accessed-is-datetime | @@ -408,6 +409,8 @@ Examples: | inventory-item-public-PASS.yaml | | inventory-item-virtual-FAIL.yaml | | inventory-item-virtual-PASS.yaml | + | iventory-item-or-component-has-virtual-FAIL.yaml | + | iventory-item-or-component-has-virtual-PASS.yaml | | last-accessed-is-datetime-FAIL.yaml | | last-accessed-is-datetime-PASS.yaml | | leveraged-authorization-has-authorization-type-FAIL.yaml | diff --git a/src/validations/constraints/content/ssp-inventory-item-or-component-has-virtual-INVALID.xml b/src/validations/constraints/content/ssp-inventory-item-or-component-has-virtual-INVALID.xml new file mode 100644 index 000000000..ca8c77777 --- /dev/null +++ b/src/validations/constraints/content/ssp-inventory-item-or-component-has-virtual-INVALID.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/validations/constraints/fedramp-external-constraints.xml b/src/validations/constraints/fedramp-external-constraints.xml index 5e85d1bb0..1fd67c084 100644 --- a/src/validations/constraints/fedramp-external-constraints.xml +++ b/src/validations/constraints/fedramp-external-constraints.xml @@ -719,11 +719,16 @@ In a FedRAMP SSP, each inventory item MUST include the vendor name in the inventory item itself or within the linked component. - - Scan Type Has Remarks - - When scan-type is 'other' or 'not-applicable', remarks MUST be provided to explain the selection. - + + Inventory Item or Component Has Virtual + + In a FedRAMP SSP, each inventory item MUST state if it is virtual in the inventory item itself or the linked component. + + + Scan Type Has Remarks + + When scan-type is 'other' or 'not-applicable', remarks MUST be provided to explain the selection. + diff --git a/src/validations/constraints/unit-tests/iventory-item-or-component-has-virtual-FAIL.yaml b/src/validations/constraints/unit-tests/iventory-item-or-component-has-virtual-FAIL.yaml new file mode 100644 index 000000000..623964940 --- /dev/null +++ b/src/validations/constraints/unit-tests/iventory-item-or-component-has-virtual-FAIL.yaml @@ -0,0 +1,9 @@ +test-case: + name: Negative Test for inventory-item-or-component-has-virtual + description: >- + This test case validates the behavior of constraint + inventory-item-or-component-has-virtual + content: ../content/ssp-inventory-item-or-component-has-virtual-INVALID.xml + expectations: + - constraint-id: inventory-item-or-component-has-virtual + result: fail diff --git a/src/validations/constraints/unit-tests/iventory-item-or-component-has-virtual-PASS.yaml b/src/validations/constraints/unit-tests/iventory-item-or-component-has-virtual-PASS.yaml new file mode 100644 index 000000000..788081779 --- /dev/null +++ b/src/validations/constraints/unit-tests/iventory-item-or-component-has-virtual-PASS.yaml @@ -0,0 +1,9 @@ +test-case: + name: Positive Test for inventory-item-or-component-has-virtual + description: >- + This test case validates the behavior of constraint + inventory-item-or-component-has-virtual + content: ../../../content/rev5/examples/ssp/xml/fedramp-ssp-example.oscal.xml + expectations: + - constraint-id: inventory-item-or-component-has-virtual + result: pass