From 8357cbd4c477b97ec8abdf851fa87ffd0639e62f Mon Sep 17 00:00:00 2001 From: Gabeblis Date: Wed, 8 Jan 2025 15:31:37 +0000 Subject: [PATCH] Add 'inventory-item-has-asset-type' constraint and tests --- features/fedramp_extensions.feature | 3 +++ .../ssp-inventory-item-has-asset-type-INVALID.xml | 7 +++++++ .../constraints/fedramp-external-constraints.xml | 5 +++++ .../unit-tests/inventory-item-has-asset-type-FAIL.yaml | 9 +++++++++ .../unit-tests/inventory-item-has-asset-type-PASS.yaml | 9 +++++++++ 5 files changed, 33 insertions(+) create mode 100644 src/validations/constraints/content/ssp-inventory-item-has-asset-type-INVALID.xml create mode 100644 src/validations/constraints/unit-tests/inventory-item-has-asset-type-FAIL.yaml create mode 100644 src/validations/constraints/unit-tests/inventory-item-has-asset-type-PASS.yaml diff --git a/features/fedramp_extensions.feature b/features/fedramp_extensions.feature index 7aced5bef..5c787240b 100644 --- a/features/fedramp_extensions.feature +++ b/features/fedramp_extensions.feature @@ -124,6 +124,7 @@ Examples: | interconnection-security | | inventory-item-allows-authenticated-scan | | inventory-item-and-component-has-public | + | inventory-item-has-asset-type | | inventory-item-has-function | | inventory-item-has-scan-type | | inventory-item-has-valid-mac-address | @@ -388,6 +389,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-asset-type-FAIL.yaml | + | inventory-item-has-asset-type-PASS.yaml | | inventory-item-has-function-FAIL.yaml | | inventory-item-has-function-PASS.yaml | | inventory-item-has-scan-type-FAIL.yaml | diff --git a/src/validations/constraints/content/ssp-inventory-item-has-asset-type-INVALID.xml b/src/validations/constraints/content/ssp-inventory-item-has-asset-type-INVALID.xml new file mode 100644 index 000000000..760caa436 --- /dev/null +++ b/src/validations/constraints/content/ssp-inventory-item-has-asset-type-INVALID.xml @@ -0,0 +1,7 @@ + + + + + + + \ 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 af1baef6b..c47ab8ccb 100644 --- a/src/validations/constraints/fedramp-external-constraints.xml +++ b/src/validations/constraints/fedramp-external-constraints.xml @@ -688,6 +688,11 @@ For HIGH-impact systems, every inventory-item MUST identify an asset-owner or administrator property either within the inventory-item itself, or within the component linked by the inventory-item. + + Inventory Item Has Asset-Type + + In a FedRAMP SSP, each inventory item MUST define the asset type either in the inventory item itself or within the linked component. + Inventory Item Has Function diff --git a/src/validations/constraints/unit-tests/inventory-item-has-asset-type-FAIL.yaml b/src/validations/constraints/unit-tests/inventory-item-has-asset-type-FAIL.yaml new file mode 100644 index 000000000..baf1f0616 --- /dev/null +++ b/src/validations/constraints/unit-tests/inventory-item-has-asset-type-FAIL.yaml @@ -0,0 +1,9 @@ +test-case: + name: Negative Test for inventory-item-has-asset-type + description: >- + This test case validates the behavior of constraint + inventory-item-has-asset-type + content: ../content/ssp-inventory-item-has-asset-type-INVALID.xml + expectations: + - constraint-id: inventory-item-has-asset-type + result: fail diff --git a/src/validations/constraints/unit-tests/inventory-item-has-asset-type-PASS.yaml b/src/validations/constraints/unit-tests/inventory-item-has-asset-type-PASS.yaml new file mode 100644 index 000000000..6f3fa6982 --- /dev/null +++ b/src/validations/constraints/unit-tests/inventory-item-has-asset-type-PASS.yaml @@ -0,0 +1,9 @@ +test-case: + name: Positive Test for inventory-item-has-asset-type + description: >- + This test case validates the behavior of constraint + inventory-item-has-asset-type + content: ../../../content/rev5/examples/ssp/xml/fedramp-ssp-example.oscal.xml + expectations: + - constraint-id: inventory-item-has-asset-type + result: pass