From 80eb99c3ab9407be681bb1875c9b2116501c239a Mon Sep 17 00:00:00 2001 From: Gabeblis Date: Wed, 27 Nov 2024 10:36:40 -0500 Subject: [PATCH] Add `component-has-authentication-method` Constraint (#927) * add constraint and tests * trim test data * add constraint and tests * trim test data * fix test data * change 'http' to 'https' * Remove extra word * Edit message --------- Co-authored-by: ~ . ~ --- features/fedramp_extensions.feature | 3 + features/steps/fedramp_extensions_steps.ts | 1 + .../constraints/content/ssp-all-VALID.xml | 5 +- ...nent-has-authentication-method-INVALID.xml | 68 +++++++++++++++++++ .../fedramp-external-constraints.xml | 5 ++ ...ponent-has-authentication-method-FAIL.yaml | 9 +++ ...ponent-has-authentication-method-PASS.yaml | 9 +++ 7 files changed, 98 insertions(+), 2 deletions(-) create mode 100644 src/validations/constraints/content/ssp-component-has-authentication-method-INVALID.xml create mode 100644 src/validations/constraints/unit-tests/component-has-authentication-method-FAIL.yaml create mode 100644 src/validations/constraints/unit-tests/component-has-authentication-method-PASS.yaml diff --git a/features/fedramp_extensions.feature b/features/fedramp_extensions.feature index 4d4c49c6b..bfc7a3cf9 100644 --- a/features/fedramp_extensions.feature +++ b/features/fedramp_extensions.feature @@ -34,6 +34,7 @@ Examples: | cia-impact-has-adjustment-justification | | cia-impact-has-selected | | cloud-service-model | + | component-has-authentication-method | | component-type | | control-implementation-status | | data-center-alternate | @@ -172,6 +173,8 @@ Examples: | cia-impact-has-selected-PASS.yaml | | cloud-service-model-FAIL.yaml | | cloud-service-model-PASS.yaml | + | component-has-authentication-method-FAIL.yaml | + | component-has-authentication-method-PASS.yaml | | component-type-FAIL.yaml | | component-type-PASS.yaml | | control-implementation-status-FAIL.yaml | diff --git a/features/steps/fedramp_extensions_steps.ts b/features/steps/fedramp_extensions_steps.ts index 424d1b1a6..84338650c 100644 --- a/features/steps/fedramp_extensions_steps.ts +++ b/features/steps/fedramp_extensions_steps.ts @@ -421,6 +421,7 @@ async function checkConstraints( `The content may need adjustment to properly test this constraint.` ); } + !quiet && console.error(formatSarifOutput(sarifOutput)) errors.push(""); // Add a blank line for readability } } diff --git a/src/validations/constraints/content/ssp-all-VALID.xml b/src/validations/constraints/content/ssp-all-VALID.xml index c38e0c37e..77986c485 100644 --- a/src/validations/constraints/content/ssp-all-VALID.xml +++ b/src/validations/constraints/content/ssp-all-VALID.xml @@ -309,8 +309,9 @@ - - + + + External API Connection diff --git a/src/validations/constraints/content/ssp-component-has-authentication-method-INVALID.xml b/src/validations/constraints/content/ssp-component-has-authentication-method-INVALID.xml new file mode 100644 index 000000000..41bba60e6 --- /dev/null +++ b/src/validations/constraints/content/ssp-component-has-authentication-method-INVALID.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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 af9677979..efdecb643 100644 --- a/src/validations/constraints/fedramp-external-constraints.xml +++ b/src/validations/constraints/fedramp-external-constraints.xml @@ -81,6 +81,11 @@ + + Component Has Authentication Method + + A FedRAMP SSP MUST include at least one authentication method for each leveraged system. + Has Authorization Boundary Diagram Link Href Target diff --git a/src/validations/constraints/unit-tests/component-has-authentication-method-FAIL.yaml b/src/validations/constraints/unit-tests/component-has-authentication-method-FAIL.yaml new file mode 100644 index 000000000..1b7355f71 --- /dev/null +++ b/src/validations/constraints/unit-tests/component-has-authentication-method-FAIL.yaml @@ -0,0 +1,9 @@ +test-case: + name: Negative Test for component-has-authentication-method + description: >- + This test case validates the behavior of constraint + component-has-authentication-method + content: ../content/ssp-component-has-authentication-method-INVALID.xml + expectations: + - constraint-id: component-has-authentication-method + result: fail diff --git a/src/validations/constraints/unit-tests/component-has-authentication-method-PASS.yaml b/src/validations/constraints/unit-tests/component-has-authentication-method-PASS.yaml new file mode 100644 index 000000000..76f5b7ef6 --- /dev/null +++ b/src/validations/constraints/unit-tests/component-has-authentication-method-PASS.yaml @@ -0,0 +1,9 @@ +test-case: + name: Positive Test for component-has-authentication-method + description: >- + This test case validates the behavior of constraint + component-has-authentication-method + content: ../content/ssp-all-VALID.xml + expectations: + - constraint-id: component-has-authentication-method + result: pass