-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improvements, extensions and repairs to profile resolver (#1071)
* party should be required, but was marked as optional by mistake * documented the default value for with-child-controls * Adding missing structuring directive from Profile resolution. * Release 1.0 metaschema adjustments (#1065) * Many fixes to the constraints in the OSCAL metaschemas to repair broken Metapaths. * fixing defects in metaschema constraints * Updating to latest Metaschema toolchain. Removed use of the "require" constraint. * updating readme with current links * Permits provision of a fresh UUID for a resolved catalog at runtime, or more graceful fallbacks. * New improved version moves UUID generation logic into the profile processor XSLT shell. (So the internal process is platform-agnostic and will not attempt any external references.) * Further syntax improvements; start at an XSpec for file set (not working yet) * Adding missing 'random' utility XSLT * Providing XSpec support for normalized comparison * Samples corrected (wrt metadata/oscal-version); added XSpec for running full set with XSLT to produce it * Peeled off 'safe' profile resolver for XSpec to avoiding runtime errors. 'Full' set now runs (showing 11 passed 6 failed) * Making UUID-generation more robust (will fail instead of break) * Refining top-level profile resolution testing; more improvements to interface * Repairing broken test; extending testing under XSpec * More refinements to end-to-end XSpec for profile resolution Co-authored-by: David Waltermire <david.waltermire@nist.gov>
- Loading branch information
1 parent
2cd81e6
commit e73068a
Showing
42 changed files
with
543 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/specifications/profile-resolution/profile-resolution-examples/build-xspec.xsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
xmlns:x="http://www.jenitennison.com/xslt/xspec" | ||
xmlns:opr="http://csrc.nist.gov/ns/oscal/profile-resolution" | ||
|
||
xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
xmlns:math="http://www.w3.org/2005/xpath-functions/math" | ||
exclude-result-prefixes="xs math" | ||
version="3.0"> | ||
|
||
<xsl:output indent="yes"/> | ||
|
||
<xsl:template match="/"> | ||
<xsl:text>
</xsl:text> | ||
<xsl:comment expand-text="true"> autogenerated { current-dateTime() } following model in example-set.xspec</xsl:comment> | ||
<x:description stylesheet="../../../utils/util/resolver-pipeline/oscal-profile-RESOLVE.xsl" | ||
run-as="external"> | ||
|
||
<!-- x:description/@run-as='external' permits the context item to be determined dynamically per scenario | ||
cf https://github.com/xspec/xspec/wiki/External-Transformation#global-context-item | ||
helper function for cleaning up whitespace: | ||
see https://github.com/xspec/xspec/wiki/Integrating-Your-Own-Test-Helpers for | ||
for an example see https://github.com/xspec/xspec/blob/master/tutorial/helper/ws-only-text/href_stylesheet.xspec | ||
--> | ||
|
||
<x:helper stylesheet="../../../utils/util/resolver-pipeline/oscal-profile-test-helper.xsl" /> | ||
<!-- looking at all the profile documents in the same directory as this XSLT --> | ||
<xsl:variable name="collection-at" as="xs:string" expand-text="true">{ document-uri(document('')) ! replace(.,'/[^/]+$','') }?select=*_profile.xml</xsl:variable> | ||
|
||
<xsl:message expand-text="true">looking for profile examples in { $collection-at }</xsl:message> | ||
<xsl:apply-templates select="collection($collection-at)" mode="make-file-scenario"/> | ||
|
||
</x:description> | ||
|
||
</xsl:template> | ||
|
||
<xsl:template match="/" mode="make-file-scenario"> | ||
<xsl:variable name="filepath" select="document-uri(/)"/> | ||
<xsl:variable name="filename" select="replace($filepath,'.+/','')"/> | ||
<xsl:variable name="basename" select="replace($filename,'\.xml$','')"/> | ||
<x:scenario label="Testing { $filename }"> | ||
<x:context href="{ $filename }"/> | ||
<x:expect label="Resolution of { $filename }" select="opr:scrub(.)" | ||
href="output-expected/{ $basename }_RESOLVED.xml"/> | ||
</x:scenario> | ||
</xsl:template> | ||
|
||
</xsl:stylesheet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/specifications/profile-resolution/profile-resolution-examples/example-set.xspec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" | ||
xmlns:opr="http://csrc.nist.gov/ns/oscal/profile-resolution" | ||
stylesheet="../../../utils/util/resolver-pipeline/oscal-profile-RESOLVE.xsl" | ||
run-as="external"> | ||
<!--<x:param name="assign-uuid">00000000-0000-4000-A000-000000000000</x:param>--> | ||
|
||
<!-- x:description/@run-as='external' permits the context item to be determined dynamically per scenario | ||
cf https://github.com/xspec/xspec/wiki/External-Transformation#global-context-item | ||
helper function for cleaning up whitespace: | ||
see https://github.com/xspec/xspec/wiki/Integrating-Your-Own-Test-Helpers for | ||
for an example see https://github.com/xspec/xspec/blob/master/tutorial/helper/ws-only-text/href_stylesheet.xspec | ||
--> | ||
|
||
<x:helper stylesheet="../../../utils/util/resolver-pipeline/oscal-profile-test-helper.xsl" /> | ||
|
||
<x:scenario label="Base test"> | ||
<x:context href="base-test_profile.xml"/> | ||
<x:expect label="Base test - fully resolved" select="opr:scrub(.)" | ||
href="output-expected/base-test_profile_RESOLVED.xml"/> | ||
</x:scenario> | ||
|
||
<x:scenario label="Working test"> | ||
<x:context href="full-test_profile.xml"/> | ||
<x:expect label="Full test - fully resolved" select="opr:scrub(.)" | ||
href="output-expected/full-test_profile_RESOLVED.xml"/> | ||
</x:scenario> | ||
</x:description> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
src/specifications/profile-resolution/profile-resolution-examples/full-set.xspec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- autogenerated 2021-12-14T16:02:57.305-05:00 following model in example-set.xspec--> | ||
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" | ||
xmlns:opr="http://csrc.nist.gov/ns/oscal/profile-resolution" | ||
xmlns:o="http://csrc.nist.gov/ns/oscal/1.0" | ||
stylesheet="../../../utils/util/resolver-pipeline/oscal-profile-RESOLVE.xsl" | ||
run-as="external" | ||
xmlns:ov="http://csrc.nist.gov/ns/oscal/test/variable"> | ||
<x:helper stylesheet="../../../utils/util/resolver-pipeline/oscal-profile-test-helper.xsl"/> | ||
|
||
<x:scenario label="Base test"> | ||
<!-- Alternative model for test scrubbing both the result and the expected | ||
result for comparison --> | ||
<x:context href="base-test_profile.xml"/> | ||
<x:variable name="ov:expected-output" | ||
href="output-expected/base-test_profile_RESOLVED.xml"/> | ||
<x:expect label="Base test - fully resolved" | ||
test="opr:scrub($x:result)" select="opr:scrub($ov:expected-output)"/> | ||
</x:scenario> | ||
|
||
<x:scenario label="Testing base-test_profile.xml"> | ||
|
||
<x:context href="base-test_profile.xml"/> | ||
<x:expect label="Resolution of base-test_profile.xml" | ||
select="opr:scrub(.)" | ||
href="output-expected/base-test_profile_RESOLVED.xml"/> | ||
</x:scenario> | ||
<x:scenario label="Testing base2-test_profile.xml"> | ||
<x:context href="base2-test_profile.xml"/> | ||
<x:expect label="Resolution of base2-test_profile.xml" | ||
select="opr:scrub(.)" | ||
href="output-expected/base2-test_profile_RESOLVED.xml"/> | ||
</x:scenario> | ||
<x:scenario label="Testing broken_profile.xml"> | ||
<x:context href="broken_profile.xml"/> | ||
<x:expect label="Resolution of broken_profile.xml" | ||
select="opr:scrub(.)" | ||
href="output-expected/broken_profile_RESOLVED.xml"/> | ||
</x:scenario> | ||
<x:scenario label="Testing circular_profile.xml"> | ||
<x:context href="circular_profile.xml"/> | ||
<x:expect label="Resolution of circular_profile.xml" | ||
select="opr:scrub(.)" | ||
href="output-expected/circular_profile_RESOLVED.xml"/> | ||
</x:scenario> | ||
<x:scenario label="Testing exclude-call-test_profile.xml"> | ||
<x:context href="exclude-call-test_profile.xml"/> | ||
<x:expect label="Resolution of exclude-call-test_profile.xml" | ||
select="opr:scrub(.)" | ||
href="output-expected/exclude-call-test_profile_RESOLVED.xml"/> | ||
</x:scenario> | ||
<x:scenario label="Testing full-test_profile.xml"> | ||
<x:context href="full-test_profile.xml"/> | ||
<x:expect label="Resolution of full-test_profile.xml" | ||
select="opr:scrub(.)" | ||
href="output-expected/full-test_profile_RESOLVED.xml"/> | ||
</x:scenario> | ||
<x:scenario label="Testing home_profile.xml"> | ||
<x:context href="home_profile.xml"/> | ||
<x:expect label="Resolution of home_profile.xml" | ||
select="opr:scrub(.)" | ||
href="output-expected/home_profile_RESOLVED.xml"/> | ||
</x:scenario> | ||
<x:scenario label="Testing import-twice_profile.xml"> | ||
<x:context href="import-twice_profile.xml"/> | ||
<x:expect label="Resolution of import-twice_profile.xml" | ||
select="opr:scrub(.)" | ||
href="output-expected/import-twice_profile_RESOLVED.xml"/> | ||
</x:scenario> | ||
<x:scenario label="Testing include-all-no-children-test_profile.xml"> | ||
<x:context href="include-all-no-children-test_profile.xml"/> | ||
<x:expect label="Resolution of include-all-no-children-test_profile.xml" | ||
select="opr:scrub(.)" | ||
href="output-expected/include-all-no-children-test_profile_RESOLVED.xml"/> | ||
</x:scenario> | ||
<x:scenario label="Testing include-all-test_profile.xml"> | ||
<x:context href="include-all-test_profile.xml"/> | ||
<x:expect label="Resolution of include-all-test_profile.xml" | ||
select="opr:scrub(.)" | ||
href="output-expected/include-all-test_profile_RESOLVED.xml"/> | ||
</x:scenario> | ||
<x:scenario label="Testing include-call-with-children-test_profile.xml"> | ||
<x:context href="include-call-with-children-test_profile.xml"/> | ||
<x:expect label="Resolution of include-call-with-children-test_profile.xml" | ||
select="opr:scrub(.)" | ||
href="output-expected/include-call-with-children-test_profile_RESOLVED.xml"/> | ||
<x:expect label="Includes grandparent in result" test="$x:result//o:control/@id = 'c3'"/> | ||
<x:expect label="Includes grandchild in result" test="$x:result//o:control/@id = 'c3.a-1'"/> | ||
<x:expect label="Is missing a control not included" test="not( $x:result//o:control/@id = 'c2' )"/> | ||
</x:scenario> | ||
<x:scenario label="Testing include-loose-param-test_profile.xml"> | ||
<x:context href="include-loose-param-test_profile.xml"/> | ||
<x:expect label="Resolution of include-loose-param-test_profile.xml" | ||
select="opr:scrub(.)" | ||
href="output-expected/include-loose-param-test_profile_RESOLVED.xml"/> | ||
</x:scenario> | ||
<x:scenario label="Testing include-match-test_profile.xml"> | ||
<x:context href="include-match-test_profile.xml"/> | ||
<x:expect label="Resolution of include-match-test_profile.xml" | ||
select="opr:scrub(.)" | ||
href="output-expected/include-match-test_profile_RESOLVED.xml"/> | ||
</x:scenario> | ||
<x:scenario label="Testing merge-implicit-keep_profile.xml"> | ||
<x:context href="merge-implicit-keep_profile.xml"/> | ||
<x:expect label="Resolution of merge-implicit-keep_profile.xml" | ||
select="opr:scrub(.)" | ||
href="output-expected/merge-implicit-keep_profile_RESOLVED.xml"/> | ||
</x:scenario> | ||
<x:scenario label="Testing merge-keep-resources_profile.xml"> | ||
<x:context href="merge-keep-resources_profile.xml"/> | ||
<x:expect label="Resolution of merge-keep-resources_profile.xml" | ||
select="opr:scrub(.)" | ||
href="output-expected/merge-keep-resources_profile_RESOLVED.xml"/> | ||
</x:scenario> | ||
<x:scenario label="Testing merge-keep_profile.xml"> | ||
<x:context href="merge-keep_profile.xml"/> | ||
<x:expect label="Resolution of merge-keep_profile.xml" | ||
select="opr:scrub(.)" | ||
href="output-expected/merge-keep_profile_RESOLVED.xml"/> | ||
</x:scenario> | ||
<x:scenario label="Testing modify-adds_profile.xml"> | ||
<x:context href="modify-adds_profile.xml"/> | ||
<x:expect label="Resolution of modify-adds_profile.xml" | ||
select="opr:scrub(.)" | ||
href="output-expected/modify-adds_profile_RESOLVED.xml"/> | ||
</x:scenario> | ||
</x:description> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.