From 0defc6874467def739678811f982ef4ef0d31159 Mon Sep 17 00:00:00 2001 From: "~ . ~" <156969148+wandmagic@users.noreply.github.com> Date: Wed, 8 Jan 2025 15:56:46 -0500 Subject: [PATCH] Squashed commit of the following: commit 18a02c93b47d11c623730fe458feaeae6a2101e4 Author: wandmagic <156969148+wandmagic@users.noreply.github.com> Date: Wed Jan 8 09:37:15 2025 -0500 Hotfix styles (#1076) * style guide hotfix * Update fedramp-external-constraints.xml commit 60b3c5077782c17e0decb20863e5468e7b8b0888 Author: DimitriZhurkin Date: Wed Jan 8 07:14:14 2025 -0700 Add the inter-boundary-component-has-information-type constraint (#1066) * Add the inter-boundary-component-has-information-type constraint * clean up ssp-inter-boundary-component-has-information-type-INVALID.xml commit d7b06235c1d8779c7a57fc68bf60f92859a30a1d Author: wandmagic <156969148+wandmagic@users.noreply.github.com> Date: Tue Jan 7 14:47:44 2025 -0500 fix constraints (#1070) commit fc50a42fe67741fa534a71e8b36600950c02a7fc Author: wandmagic <156969148+wandmagic@users.noreply.github.com> Date: Fri Jan 3 14:21:47 2025 -0500 hotfix develop (#1064) --- features/fedramp_extensions.feature | 3 ++ features/steps/fedramp_extensions_steps.ts | 30 ++++++++----- .../ssp/xml/fedramp-ssp-example.oscal.xml | 12 ++++++ ...component-has-information-type-INVALID.xml | 36 ++++++++++++++++ .../fedramp-external-constraints.xml | 43 ++++++++----------- ...y-component-has-information-type-FAIL.yaml | 8 ++++ ...y-component-has-information-type-PASS.yaml | 8 ++++ 7 files changed, 105 insertions(+), 35 deletions(-) create mode 100644 src/validations/constraints/content/ssp-inter-boundary-component-has-information-type-INVALID.xml create mode 100644 src/validations/constraints/unit-tests/inter-boundary-component-has-information-type-FAIL.yaml create mode 100644 src/validations/constraints/unit-tests/inter-boundary-component-has-information-type-PASS.yaml diff --git a/features/fedramp_extensions.feature b/features/fedramp_extensions.feature index 38fd678af..7aced5bef 100644 --- a/features/fedramp_extensions.feature +++ b/features/fedramp_extensions.feature @@ -119,6 +119,7 @@ Examples: | information-type-has-confidentiality-impact | | information-type-has-integrity-impact | | information-type-system | + | inter-boundary-component-has-information-type | | interconnection-direction | | interconnection-security | | inventory-item-allows-authenticated-scan | @@ -377,6 +378,8 @@ Examples: | information-type-id-PASS.yaml | | information-type-system-FAIL.yaml | | information-type-system-PASS.yaml | + | inter-boundary-component-has-information-type-FAIL.yaml | + | inter-boundary-component-has-information-type-PASS.yaml | | interconnection-direction-FAIL.yaml | | interconnection-direction-PASS.yaml | | interconnection-security-FAIL.yaml | diff --git a/features/steps/fedramp_extensions_steps.ts b/features/steps/fedramp_extensions_steps.ts index 44b2435df..601f7b8af 100644 --- a/features/steps/fedramp_extensions_steps.ts +++ b/features/steps/fedramp_extensions_steps.ts @@ -1,23 +1,22 @@ -import { BeforeAll, BeforeStep, Given, Then, When, setDefaultTimeout, world } from "@cucumber/cucumber"; +import { BeforeAll, Given, Then, When, setDefaultTimeout } from "@cucumber/cucumber"; import { expect } from "chai"; import { + existsSync, + mkdirSync, readFileSync, readdirSync, unlinkSync, writeFileSync, - mkdirSync, - existsSync, } from "fs"; import { load } from "js-yaml"; -import { executeOscalCliCommand, resolveProfile, resolveProfileDocument, validateDocument} from "oscal"; -import {checkServerStatus} from 'oscal/dist/server.js' -import { dirname, join,parse, resolve } from "path"; -import { Exception, Log, Result } from "sarif"; +import { JSDOM } from 'jsdom'; +import { executeOscalCliCommand, formatSarifOutput, resolveProfileDocument, validateDocument } from "oscal"; +import { checkServerStatus } from 'oscal/dist/server.js'; +import { dirname, join, parse, resolve } from "path"; +import { Log } from "sarif"; import { fileURLToPath } from "url"; -import { parseString } from "xml2js"; -import {JSDOM} from 'jsdom' import { promisify } from "util"; -import {formatSarifOutput} from 'oscal' +import { parseString } from "xml2js"; let executor: 'oscal-cli'|'oscal-server' = process.env.OSCAL_EXECUTOR as 'oscal-cli'|'oscal-server' || 'oscal-cli' const quiet = process.env.OSCAL_TEST_QUIET === 'true' @@ -686,6 +685,7 @@ Then('I should have valid results {string}', async function (fileToValidate) { Then('I should verify that all constraints follow the style guide constraint', async function () { const baseDir = join(__dirname, '..', '..'); + const styleGuidePath = join(baseDir, 'src', 'validations', 'styleguides', 'fedramp-constraint-style.xml'); const constraintDir = join(baseDir, 'src', 'validations', 'constraints'); const constraintFiles = readdirSync(constraintDir).filter(file => file.startsWith('fedramp') && file.endsWith('.xml') @@ -701,7 +701,15 @@ Then('I should verify that all constraints follow the style guide constraint', a const fileContent = readFileSync(filePath, 'utf8'); const dom = new JSDOM(fileContent, { contentType: 'text/xml' }); const document = dom.window.document; - + const {isValid,log} = await validateDocument(filePath,{flags:['disable-schema'],quiet,extensions:[styleGuidePath],module:"http://csrc.nist.gov/ns/oscal/metaschema/1.0"},executor) + writeFileSync( + join( + __dirname, + "../../sarif/", + fileName.split(".xml").join("").toString()+".sarif" + ),JSON.stringify(log, null,"\t")) + const formattedErrors = (formatSarifOutput(log)); + formattedErrors&&errors.push(formattedErrors) // Process each 'constraints' block separately document.querySelectorAll('constraints').forEach(constraintsNode => { // Get direct child elements with IDs within this constraints block diff --git a/src/content/rev5/examples/ssp/xml/fedramp-ssp-example.oscal.xml b/src/content/rev5/examples/ssp/xml/fedramp-ssp-example.oscal.xml index 710ba036c..769cc3a18 100644 --- a/src/content/rev5/examples/ssp/xml/fedramp-ssp-example.oscal.xml +++ b/src/content/rev5/examples/ssp/xml/fedramp-ssp-example.oscal.xml @@ -1200,6 +1200,10 @@ leveraged-authorization assembly:

+ + + + @@ -1841,6 +1845,10 @@ compliance (e.g., Module in Process).

+ + + +

If 'yes', describe the authentication method.

@@ -2264,6 +2272,10 @@ approved.

+ + + +

If 'yes', describe the authentication method.

diff --git a/src/validations/constraints/content/ssp-inter-boundary-component-has-information-type-INVALID.xml b/src/validations/constraints/content/ssp-inter-boundary-component-has-information-type-INVALID.xml new file mode 100644 index 000000000..5b248eef3 --- /dev/null +++ b/src/validations/constraints/content/ssp-inter-boundary-component-has-information-type-INVALID.xml @@ -0,0 +1,36 @@ + + + + + + Service B + +

An non-authorized service provided by the Awesome Cloud leveraged authorization.

+

Describe the service and what it is used for.

+
+ + + + + + +

If 'yes', describe the authentication method.

+

If 'no', explain why no authentication is used.

+

If 'not-applicable', attest explain why authentication is not applicable in the remarks.

+
+
+ + + + + + + + 33333333-2222-4000-8000-004000000001 + + +

Each non-authorized leveraged service must be expressed as a "service" component.

+
+
+
+
\ 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 a468b8655..856cad3df 100644 --- a/src/validations/constraints/fedramp-external-constraints.xml +++ b/src/validations/constraints/fedramp-external-constraints.xml @@ -585,7 +585,7 @@ - + Authentication Method Has Remarks @@ -603,7 +603,7 @@ Container Image Has Checksum Property - + In a FedRAMP SSP, a component that describes a container or operating system image MUST define a checksum property. @@ -611,11 +611,21 @@ In a FedRAMP SSP, each information type property in a component MUST categorize the class of data flow as incoming to the system, outgoing from the system, or both. + + Inter-Boundary Component Has Information Type + + An inter-boundary communication component {@uuid} ({path(.)}) MUST have at least one information-type property. + Inventory Item and Component Has Public In a FedRAMP SSP, each inventory item and internal service component MUST state if they are public-facing. + + Inventory Item or Component Has Asset ID + + In a FedRAMP SSP, each inventory item and software image component MUST include the asset ID. + Leveraged Authorization Has Authorization Type @@ -659,16 +669,6 @@ - - - - - Inventory Item or Component Has Asset ID - - In a FedRAMP SSP, each inventory item and software image component MUST include the asset ID. - - - @@ -681,7 +681,7 @@ Authenticated Scan No Has Remarks - FedRAMP requires CSPs to provide justification for any high or moderate impact system inventory item that does not support authenticated scans. + A FedRAMP SSP MUST provide justification for any high or moderate impact system inventory item that does not support authenticated scans. High Impact Inventory Item Has Asset Owner @@ -796,6 +796,7 @@ 'sc-1_smt.a' : 'at least one procedure that addresses System and Communications Protection MUST be associated with SC-1 part a.', 'si-1_smt.a' : 'at least one procedure that addresses System and Information Integrity MUST be associated with SI-1 part a.', 'sr-1_smt.a' : 'at least one procedure that addresses Supply Chain Risk Management MUST be associated with SR-1 part a.'}"/> + Has Policy @@ -806,6 +807,11 @@ In a FedRAMP SSP, {$procedure-messages(./@statement-id)} + + Statement Has This System Component + + In a FedRAMP SSP, each control implementation statement MUST have one "this-system" by-component. + @@ -825,17 +831,6 @@ - - - - - - Statement Has This System Component - - In a FedRAMP SSP, each control implementation statement MUST have one "this-system" by-component. - - - diff --git a/src/validations/constraints/unit-tests/inter-boundary-component-has-information-type-FAIL.yaml b/src/validations/constraints/unit-tests/inter-boundary-component-has-information-type-FAIL.yaml new file mode 100644 index 000000000..e148e6f8d --- /dev/null +++ b/src/validations/constraints/unit-tests/inter-boundary-component-has-information-type-FAIL.yaml @@ -0,0 +1,8 @@ +# Driver for the invalid inter-boundary-component-has-information-type constraint unit test. +test-case: + name: The invalid inter-boundary-component-has-information-type constraint unit test. + description: Test that the FedRAMP SSP inter-boundary communication component does not have the "information-type" property. + content: ../content/ssp-inter-boundary-component-has-information-type-INVALID.xml + expectations: + - constraint-id: inter-boundary-component-has-information-type + result: fail \ No newline at end of file diff --git a/src/validations/constraints/unit-tests/inter-boundary-component-has-information-type-PASS.yaml b/src/validations/constraints/unit-tests/inter-boundary-component-has-information-type-PASS.yaml new file mode 100644 index 000000000..6bb761964 --- /dev/null +++ b/src/validations/constraints/unit-tests/inter-boundary-component-has-information-type-PASS.yaml @@ -0,0 +1,8 @@ +# Driver for the valid inter-boundary-component-has-information-type constraint unit test. +test-case: + name: The valid inter-boundary-component-has-information-type constraint unit test. + description: Test that the FedRAMP SSP inter-boundary communication component has at least one "information-type" property. + content: ../../../content/rev5/examples/ssp/xml/fedramp-ssp-example.oscal.xml + expectations: + - constraint-id: inter-boundary-component-has-information-type + result: pass \ No newline at end of file