Skip to content

Produce Metaschemas without XXEs (#1665)#1901

Merged
aj-stein-nist merged 6 commits intousnistgov:developfrom
nikitawootten-nist:nikitawootten-nist/issue1665
Aug 25, 2023
Merged

Produce Metaschemas without XXEs (#1665)#1901
aj-stein-nist merged 6 commits intousnistgov:developfrom
nikitawootten-nist:nikitawootten-nist/issue1665

Conversation

@nikitawootten-nist
Copy link
Contributor

@nikitawootten-nist nikitawootten-nist commented Aug 24, 2023

Committer Notes

Fixes #1665

Also in this PR:

  • Added list-release-artifacts utility makefile target for use in OSCAL-Reference;
  • Renamed src/release/README.txt to a more descriptive name to prevent confusion in the future (see Rename README.txt to README.md #1891);
  • The archive generation target includes the XXE-less metaschema modules.

All Submissions:

By submitting a pull request, you are agreeing to provide this contribution under the CC0 1.0 Universal public domain dedication.

(For reviewers: The wiki has guidance on code review and overall issue review for completeness.)

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you included examples of how to use your new feature(s)?
  • Have you updated all OSCAL website and readme documentation affected by the changes you made? Changes to the OSCAL website can be made in the docs/content directory of your branch.

@nikitawootten-nist nikitawootten-nist requested a review from a team August 24, 2023 20:08
@nikitawootten-nist nikitawootten-nist linked an issue Aug 24, 2023 that may be closed by this pull request
7 tasks
@nikitawootten-nist
Copy link
Contributor Author

nikitawootten-nist commented Aug 24, 2023

Example output

Running make resolved-metaschemas produces the following files:

 ➜ tree generated | grep RESOLVED
├── oscal_assessment-common_metaschema_RESOLVED.xml
├── oscal_assessment-plan_metaschema_RESOLVED.xml
├── oscal_assessment-results_metaschema_RESOLVED.xml
├── oscal_catalog_metaschema_RESOLVED.xml
├── oscal_complete_metaschema_RESOLVED.xml
├── oscal_component_metaschema_RESOLVED.xml
├── oscal_control-common_metaschema_RESOLVED.xml
├── oscal_implementation-common_metaschema_RESOLVED.xml
├── oscal_metadata_metaschema_RESOLVED.xml
├── oscal_poam_metaschema_RESOLVED.xml
├── oscal_profile_metaschema_RESOLVED.xml
├── oscal_ssp_metaschema_RESOLVED.xml

The resolved metaschemas are identical to the source ones but with two crucial differences:

  1. XXEs have been resolved
  2. The import/@hrefs have been transformed with the appropriate suffix added.

Example:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../build/metaschema-xslt/src/validate/metaschema-composition-check.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<!-- OSCAL GRAND UNIFIED MEGALOMETASCHEMA -->
<!-- validate with XSD and Schematron (linked) -->
<METASCHEMA xmlns="http://csrc.nist.gov/ns/oscal/metaschema/1.0">
   <schema-name>OSCAL Unified Model of Models</schema-name>
   <schema-version>1.1.0</schema-version>
   <short-name>oscal-complete</short-name>
   <namespace>http://csrc.nist.gov/ns/oscal/1.0</namespace>
   <json-base-uri>http://csrc.nist.gov/ns/oscal/1.0</json-base-uri>
   <remarks>
      <p>This format represents a combination of all of the OSCAL models.</p>
   </remarks>
   <import href="oscal_catalog_metaschema_RESOLVED.xml"/>
   <import href="oscal_profile_metaschema_RESOLVED.xml"/>
   <import href="oscal_component_metaschema_RESOLVED.xml"/>
   <import href="oscal_ssp_metaschema_RESOLVED.xml"/>
   <import href="oscal_assessment-plan_metaschema_RESOLVED.xml"/>
   <import href="oscal_assessment-results_metaschema_RESOLVED.xml"/>
   <import href="oscal_poam_metaschema_RESOLVED.xml"/>
</METASCHEMA>

wendellpiez
wendellpiez previously approved these changes Aug 24, 2023
Copy link
Contributor

@wendellpiez wendellpiez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice concept, nice simple implementation--

Copy link
Contributor

@aj-stein-nist aj-stein-nist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great addition, thank you very much. All I would ask is that you add an ADR and then I can approve.

aj-stein-nist
aj-stein-nist previously approved these changes Aug 25, 2023
Co-authored-by: A.J. Stein <alexander.stein@nist.gov>
@aj-stein-nist aj-stein-nist added this to the Next milestone Aug 25, 2023
@aj-stein-nist aj-stein-nist merged commit ac6397d into usnistgov:develop Aug 25, 2023
@aj-stein-nist aj-stein-nist modified the milestones: Next, Ready Now Aug 25, 2023
@nikitawootten-nist nikitawootten-nist deleted the nikitawootten-nist/issue1665 branch August 25, 2023 17:33
@aj-stein-nist aj-stein-nist removed this from the Ready Now milestone Aug 25, 2023
aj-stein-nist added a commit that referenced this pull request Sep 12, 2023
* Produce Metaschemas without XXEs (#1665)

* ADR for XXE resolution

* Accepted ADR 5

* Apply suggestions from code review

Co-authored-by: A.J. Stein <alexander.stein@nist.gov>

* Revert release artifact archive readme extension change

---------

Co-authored-by: A.J. Stein <alexander.stein@nist.gov>
Arminta-Jenkins-NIST pushed a commit that referenced this pull request Sep 12, 2023
* Produce Metaschemas without XXEs (#1665)

* ADR for XXE resolution

* Accepted ADR 5

* Apply suggestions from code review

Co-authored-by: A.J. Stein <alexander.stein@nist.gov>

* Revert release artifact archive readme extension change

---------

Co-authored-by: A.J. Stein <alexander.stein@nist.gov>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generate and Publish OSCAL Metaschema without XML Entities

3 participants