Skip to content

Commit

Permalink
feat: updates content from FedRAMP Rev4 to Rev5
Browse files Browse the repository at this point in the history
Updates FedRAMP submodule to the latest commit

The location of the XSLT has changed from the repository to the OSCAL
release so the NIST submodule was removed and the download_oscal_converters
script was added

BREAKING CHANGE: This drops support for Rev4 validation

Signed-off-by: Jennifer Power <[email protected]>

---------

Signed-off-by: Jennifer Power <[email protected]>
  • Loading branch information
jpower432 committed Jan 24, 2024
1 parent bd89e71 commit cb479c1
Show file tree
Hide file tree
Showing 38 changed files with 202,635 additions and 154,068 deletions.
4 changes: 1 addition & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
[submodule "nist-source"]
path = nist-source
url = https://github.com/usnistgov/OSCAL
[submodule "fedramp-source"]
path = fedramp-source
url = https://github.com/GSA/fedramp-automation
branch = master
18 changes: 10 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

OSCAL_RELEASE_TAG := "v1.0.6"

submodules:
git submodule update --init
Expand Down Expand Up @@ -70,17 +71,18 @@ mdformat:
pre-commit run mdformat --all-files


fedramp-copy:
mkdir -p trestle_fedramp/resources/fedramp-source/content/baselines/rev4
cp -R fedramp-source/dist/content/baselines/rev4/xml trestle_fedramp/resources/fedramp-source/content/baselines/rev4/

download_release_artifacts:
@./scripts/download_oscal_converters.sh $(OSCAL_RELEASE_TAG) trestle_fedramp/resources/nist-source/xml/convert/

fedramp-copy: download_release_artifacts
mkdir -p trestle_fedramp/resources/fedramp-source/content/baselines/rev5
cp -R fedramp-source/dist/content/rev5/baselines/xml/ trestle_fedramp/resources/fedramp-source/content/baselines/rev5/
mkdir -p trestle_fedramp/resources/fedramp-source/content/resources
cp -R fedramp-source/dist/content/resources/xml trestle_fedramp/resources/fedramp-source/content/resources/
cp -R fedramp-source/dist/content/rev5/resources/xml/ trestle_fedramp/resources/fedramp-source/content/resources/
mkdir -p trestle_fedramp/resources/fedramp-source/vendor
cp ssp.xsl trestle_fedramp/resources/fedramp-source/
cp ssp.sch.xsl trestle_fedramp/resources/fedramp-source/ssp.xsl
cp fedramp-source/vendor/svrl2html.xsl trestle_fedramp/resources/fedramp-source/vendor/
mkdir -p trestle_fedramp/resources/nist-source/xml
cp -R nist-source/xml/convert trestle_fedramp/resources/nist-source/xml/
cp oscal_ssp_json-to-xml-converter-new.xsl trestle_fedramp/resources/nist-source/xml/convert/


# POSIX ONLY
Expand Down
2 changes: 1 addition & 1 deletion fedramp-source
Submodule fedramp-source updated 433 files
1 change: 0 additions & 1 deletion nist-source
Submodule nist-source deleted from 143c7c
48 changes: 48 additions & 0 deletions scripts/download_oscal_converters.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

# Copyright (c) 2024 IBM Corp. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# download_oscal_converters.sh
# Download OSCAL XML to JSON converters from the OSCAL GitHub repo


if [ -z "$1" ]; then
echo "Please provide a tag name for the OSCAL release"
exit 1
fi

if [ -z "$2" ]; then
directory="oscal-converters"
else
directory="$2"
fi

echo "Downloading OSCAL converters from release $1 to $directory"

# Create the directory if it doesn't exist
mkdir -p "$directory"
pushd ./"$directory" || exit 1

# Store the long command in another variable to make it easier to read
oscal_release_url="https://api.github.com/repos/usnistgov/OSCAL/releases/tags/${1}"
assets_url=$(curl -sL "$oscal_release_url" | jq -r '.assets[] | select(.name | test("oscal_.*_json-to-xml-converter.xsl")) | .browser_download_url')
mapfile -t release_artifacts < <(echo "$assets_url")

for asset_url in "${release_artifacts[@]}"; do \
echo "Downloading $asset_url..."; \
curl -sLJO "$asset_url"; \
done

popd || exit 1
4,313 changes: 2,842 additions & 1,471 deletions ssp.xsl → ssp.sch.xsl

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

import pathlib

JSON_FEDRAMP_SAR_PATH = pathlib.Path('fedramp-source/dist/content/templates/sar/json/').resolve()
JSON_FEDRAMP_SAR_PATH = pathlib.Path('fedramp-source/dist/content/rev5/templates/sar/json/').resolve()
JSON_FEDRAMP_SAR_NAME = 'FedRAMP-SAR-OSCAL-Template.json'
JSON_FEDRAMP_SSP_PATH = pathlib.Path('fedramp-source/dist/content/templates/ssp/json/').resolve()
JSON_FEDRAMP_SSP_PATH = pathlib.Path('fedramp-source/dist/content/rev5/templates/ssp/json/').resolve()
JSON_FEDRAMP_SSP_NAME = 'FedRAMP-SSP-OSCAL-Template.json'
XML_FEDRAMP_SSP_PATH = pathlib.Path('fedramp-source/dist/content/templates/ssp/xml/').resolve()
XML_FEDRAMP_SSP_PATH = pathlib.Path('fedramp-source/dist/content/rev5/templates/ssp/xml/').resolve()
XML_FEDRAMP_SSP_NAME = 'FedRAMP-SSP-OSCAL-Template.xml'
2 changes: 1 addition & 1 deletion trestle_fedramp/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"""Core constants module containing all constants."""

# FedRAMP related files and directories
FEDRAM_BASELINE = 'fedramp-source/content/baselines/rev4/xml'
FEDRAM_BASELINE = 'fedramp-source/content/baselines/rev5/xml'
FEDRAMP_REGISTRY = 'fedramp-source/content/resources/xml'
FEDRAM__SVRL_XSL = 'fedramp-source/vendor/svrl2html.xsl'
FEDRAMP_SSP_XSL = 'fedramp-source/ssp.xsl'
Expand Down
Loading

0 comments on commit cb479c1

Please sign in to comment.