Skip to content

Profile resolution flattens nested control structure #1663

Open
@GaryGapinski

Description

@GaryGapinski

Describe the bug

Profile resolution of a nested control includes ancestor control but the control nesting is not maintained.

Who is the bug affecting

Users of oscal-profile-RESOLVE.xsl.

What is affected by this bug

Tooling & API

How do we replicate this issue

I was wondering if inclusion of a control enhancement would include the parent control.

It does. This is in accord with SP 800-53 rev5 (§2.2 ¶2 final sentence) and the profile resolution specification. However, the nested control structure is flattened.

Using this profile

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://github.com/usnistgov/OSCAL/raw/v1.0.4/xml/schema/oscal_complete_schema.xsd" schematypens="http://www.w3.org/2001/XMLSchema" title="OSCAL complete schema" ?>
<profile xmlns="http://csrc.nist.gov/ns/oscal/1.0" uuid="3353e8e1-3eef-42ef-8163-1f71616bafca">
    <metadata>
        <title />
        <last-modified>2023-02-18T13:06:18Z</last-modified>
        <version>2023-02-18T13:06:18Z</version>
        <oscal-version>1.0.4</oscal-version>
    </metadata>
    <import href="c-ce-c.xml">
        <include-controls>
            <with-id>c1.1</with-id>
        </include-controls>
    </import>
</profile>

and catalog

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://github.com/usnistgov/OSCAL/raw/v1.0.4/xml/schema/oscal_complete_schema.xsd" schematypens="http://www.w3.org/2001/XMLSchema" title="OSCAL complete schema" ?>
<catalog xmlns="http://csrc.nist.gov/ns/oscal/1.0" uuid="37b7acd4-ab3f-4217-99d1-2ab9e490db49">
    <metadata>
        <title />
        <last-modified>2023-02-18T13:06:18Z</last-modified>
        <version>2023-02-18T13:06:18Z</version>
        <oscal-version>1.0.4</oscal-version>
    </metadata>
    <control id="c1">
        <title />
        <control id="c1.1">
            <title />
        </control>
    </control>
</catalog>

perform a profile resolution.

gapinski@flexion-mac-C02FCBVSMD6N ~ % cd ~/Projects/github/usnistgov/OSCAL/src/utils/util/resolver-pipeline  
gapinski@flexion-mac-C02FCBVSMD6N resolver-pipeline % git status                                                             
On branch main
Your branch is up to date with 'origin/main'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	c-ce-c.xml
	c-ce-p.xml
	c-ce.zip

nothing added to commit but untracked files present (use "git add" to track)
gapinski@flexion-mac-C02FCBVSMD6N resolver-pipeline % cat c-ce-p.xml                                                         
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://github.com/usnistgov/OSCAL/raw/v1.0.4/xml/schema/oscal_complete_schema.xsd" schematypens="http://www.w3.org/2001/XMLSchema" title="OSCAL complete schema" ?>
<profile xmlns="http://csrc.nist.gov/ns/oscal/1.0" uuid="3353e8e1-3eef-42ef-8163-1f71616bafca">
    <metadata>
        <title />
        <last-modified>2023-02-18T13:06:18Z</last-modified>
        <version>2023-02-18T13:06:18Z</version>
        <oscal-version>1.0.4</oscal-version>
    </metadata>
    <import href="c-ce-c.xml">
        <include-controls>
            <with-id>c1.1</with-id>
        </include-controls>
    </import>
</profile>
gapinski@flexion-mac-C02FCBVSMD6N resolver-pipeline % cat c-ce-c.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://github.com/usnistgov/OSCAL/raw/v1.0.4/xml/schema/oscal_complete_schema.xsd" schematypens="http://www.w3.org/2001/XMLSchema" title="OSCAL complete schema" ?>
<catalog xmlns="http://csrc.nist.gov/ns/oscal/1.0" uuid="37b7acd4-ab3f-4217-99d1-2ab9e490db49">
    <metadata>
        <title />
        <last-modified>2023-02-18T13:06:18Z</last-modified>
        <version>2023-02-18T13:06:18Z</version>
        <oscal-version>1.0.4</oscal-version>
    </metadata>
    <control id="c1">
        <title />
        <control id="c1.1">
            <title />
        </control>
    </control>
</catalog>
gapinski@flexion-mac-C02FCBVSMD6N resolver-pipeline % alias xslt='java -cp ~/saxon/saxon-he-12.0.jar net.sf.saxon.Transform' 
gapinski@flexion-mac-C02FCBVSMD6N resolver-pipeline % xslt
No source file name
SaxonJ-HE 12.0 from Saxonica
Usage: see http://www.saxonica.com/documentation/index.html#!using-xsl/commandline
Format: net.sf.saxon.Transform options params
Options available: -? -a -catalog -config -cr -diag -dtd -ea -expand -explain -export -ext -im -init -it -jit -json -l -lib -license -nogo -now -ns -o -opt -or -outval -p -quit -r -relocate -repeat -s -sa -scmin -strip -t -T -target -threads -TJ -Tlevel -Tout -TP -TPxsl -traceout -tree -u -val -versionmsg -warnings -x -xi -xmlversion -xsd -xsdversion -xsiloc -xsl -y --?
Use -XYZ:? for details of option XYZ
Params: 
  param=value           Set stylesheet string parameter
  +param=filename       Set stylesheet document parameter
  ?param=expression     Set stylesheet parameter using XPath
  !param=value          Set serialization parameter
gapinski@flexion-mac-C02FCBVSMD6N resolver-pipeline % xslt -xsl:oscal-profile-RESOLVE.xsl -s:c-ce-p.xml
<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns="http://csrc.nist.gov/ns/oscal/1.0"
          uuid="2f121ef6-3503-4731-afdc-05e7fb3ba092">
   <metadata>
      <title/>
      <last-modified>2023-02-19T08:08:20.01928-05:00</last-modified>
      <version>2023-02-18T13:06:18Z</version>
      <oscal-version>1.0.4</oscal-version>
      <link rel="resolution-source" href=""/>
   </metadata>
</catalog>
gapinski@flexion-mac-C02FCBVSMD6N resolver-pipeline % 

Note that the resolution is faulty when operating on main branch of the usnistgov/OSCAL repo.

In order to demonstrate the problem, use oscal-profile-RESOLVE.xsl from #1639.

gapinski@flexion-mac-C02FCBVSMD6N resolver-pipeline % xslt -xsl:https://raw.githubusercontent.com/galtm/OSCAL/saxon11/src/utils/util/resolver-pipeline/oscal-profile-RESOLVE.xsl -s:c-ce-p.xml
<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns="http://csrc.nist.gov/ns/oscal/1.0"
          uuid="00000000-0000-4000-B000-000000000000">
   <metadata>
      <title/>
      <last-modified>2023-02-19T08:22:04.145451-05:00</last-modified>
      <version>2023-02-18T13:06:18Z</version>
      <oscal-version>1.0.4</oscal-version>
      <prop name="resolution-tool"
             value="OSCAL Profile Resolver XSLT Pipeline OPRXP"/>
      <link href="file:/Users/gapinski/Projects/github/usnistgov/OSCAL/src/utils/util/resolver-pipeline/c-ce-p.xml"
             rel="source-profile"/>
   </metadata>
   <control id="c1">
      <title/>
   </control>
   <control id="c1.1">
      <title/>
   </control>
</catalog>
gapinski@flexion-mac-C02FCBVSMD6N resolver-pipeline % 

The controls are not nested. This flattening seems at odds with the (explicit) with-parent-controls attribute description.

Worse, the the OSCAL XML Schema lacks the with-parent-controls attribute for the include-controls element (#1662).

Expected behavior (i.e. solution)

The nesting structure of the controls in the catalog should be preserved.

Other comments

The specimen instance documents are in the attached archive.
c-ce.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions