Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profile resolution incorrectly maps the oscal-version from the version on the source profile #15

Closed
david-waltermire opened this issue May 10, 2022 · 0 comments · Fixed by #21
Assignees
Labels
bug Something isn't working

Comments

@david-waltermire
Copy link
Collaborator

Describe the bug

Profile resolution incorrectly maps the oscal-version from the version on the source profile.

Who is the bug affecting?

Users using the profile resolution functionality.

What is affected by this bug?

Provides incorrect profile resolution output.
Resolving the following:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../example-checkup.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<!-- Modified by conversion XSLT 2021-04-05T11:22:07.701-04:00 - RC2 OSCAL becomes RC3 OSCAL -->
<profile xmlns="http://csrc.nist.gov/ns/oscal/1.0"
         uuid="cb1ec926-3441-458f-8cce-ea11308c9d37">
   <metadata>
      <title>Test Profile</title>
      <last-modified>2020-05-30T14:39:35.84-04:00</last-modified>
      <version>2.3.4</version>
      <oscal-version>1.0.3</oscal-version>
   </metadata>
   <import href="catalogs/abc-simple_catalog.xml">
      <include-controls with-child-controls="yes">
         <with-id>a1</with-id>
         <with-id>b1</with-id>
         <with-id>c1</with-id>
         <with-id>c3</with-id>
      </include-controls>
   </import>
</profile>

Will result in:

<?xml version='1.0' encoding='UTF-8'?>
<catalog xmlns="http://csrc.nist.gov/ns/oscal/1.0" uuid="bd50d038-64e2-49ef-9524-c8172d77cbaf">
  <metadata>
    <title>Test Profile</title>
    <last-modified>2022-05-10T10:47:25.3088315Z</last-modified>
    <version>2.3.4</version>
    <oscal-version>2.3.4</oscal-version>
    <prop name="resolution-tool" value="libOSCAL-Java"/>
    <link href="file:/******/liboscal-java/oscal/src/specifications/profile-resolution/profile-resolution-examples/base-test_profile.xml" rel="source-profile"/>
  </metadata>
  <control id="a1">
    <title>Control A1</title>
    <prop name="label" value="first"/>
    <part id="a1-stmt" name="statement">
      <p>A1 aaaaa aaaaaaaaaa</p>
    </part>
  </control>
  <control id="b1">
    <title>Control B1</title>
    <prop name="label" value="fourth"/>
    <part id="b1-stmt" name="statement">
      <p>B1 bbbb bbbbbbb.</p>
    </part>
  </control>
  <control id="c1">
    <title>Control C1</title>
    <prop name="label" value="seventh"/>
    <part id="c1-stmt" name="statement">
      <p>C1 ccccc ccc ccccccccccccccccc.</p>
    </part>
  </control>
  <control id="c3">
    <title>Control C3</title>
    <prop name="label" value="ninth"/>
    <part id="c3-stmt" name="statement">
      <p>C3 ccccc cccccccccccccc.</p>
    </part>
  </control>
  <control id="c3.a">
    <title>Control C3-A</title>
    <prop name="label" value="tenth"/>
    <part id="c3-stmt" name="statement">
      <p>C3 A ccccc cccccccccccccc.</p>
    </part>
  </control>
  <control id="c3.a-1">
    <title>Control C3-A-1</title>
    <prop name="label" value="eleventh"/>
    <part id="c3-stmt" name="statement">
      <p>C3 A-1 ccccc cccccccccccccc.</p>
    </part>
  </control>
</catalog>

When does this occur?

On profile resolution.

How do we replicate the issue?

Add the below (Illustrative only) test to ProfileResolutionTests.

@Test  
void testOscalVersion() throws IllegalStateException, IOException, BindingException, SaxonApiException {  
  String injectedOscalVersion = "1.0.3";  
  String profileLocation = String.format("%s/%s_profile.xml", PROFILE_PATH, "base-test");  
  File profileFile = new File(profileLocation);  
  Profile profile = OscalBindingContext.instance().loadProfile(profileFile);  
  profile.getMetadata().setOscalVersion(injectedOscalVersion);  
  ProfileResolver.ResolutionData data  
          = new ProfileResolver.ResolutionData(profile, ObjectUtils.notNull(profileFile.toURI()), new Stack<>());  
  getProfileResolver().resolve(data);  
  Catalog actual = data.getCatalog();  
  Assertions.assertThat(actual.getMetadata().getOscalVersion()).isEqualTo(injectedOscalVersion);  
}

Expected behavior (i.e. solution)

See Assertions above.

Other Comments

None

@david-waltermire david-waltermire added the bug Something isn't working label May 10, 2022
@david-waltermire david-waltermire self-assigned this May 10, 2022
@david-waltermire david-waltermire added this to the v1.0.3 Release milestone May 10, 2022
david-waltermire added a commit to david-waltermire/liboscal-java that referenced this issue May 17, 2022
…ot the content version from a source profile. Resolves usnistgov#15.
david-waltermire added a commit to david-waltermire/liboscal-java that referenced this issue May 17, 2022
…ot the content version from a source profile. Resolves usnistgov#15.
david-waltermire added a commit to david-waltermire/liboscal-java that referenced this issue May 18, 2022
…ot the content version from a source profile. Resolves usnistgov#15.
@david-waltermire david-waltermire linked a pull request May 18, 2022 that will close this issue
8 tasks
david-waltermire added a commit that referenced this issue May 18, 2022
* Corrected metadata/oscal-version handling bug to use OSCAL version, not the content version from a source profile. Resolves #15.
* More adjustments to handling of version and OSCAL version. OSCAL version is the high water mark of the profile, plus any imports. See usnistgov/OSCAL#1272.
david-waltermire added a commit that referenced this issue Jun 21, 2022
* Corrected metadata/oscal-version handling bug to use OSCAL version, not the content version from a source profile. Resolves #15.
* More adjustments to handling of version and OSCAL version. OSCAL version is the high water mark of the profile, plus any imports. See usnistgov/OSCAL#1272.
david-waltermire added a commit that referenced this issue Jun 24, 2022
* Corrected metadata/oscal-version handling bug to use OSCAL version, not the content version from a source profile. Resolves #15.
* More adjustments to handling of version and OSCAL version. OSCAL version is the high water mark of the profile, plus any imports. See usnistgov/OSCAL#1272.
david-waltermire added a commit to david-waltermire/liboscal-java that referenced this issue Jun 29, 2022
* Corrected metadata/oscal-version handling bug to use OSCAL version, not the content version from a source profile. Resolves usnistgov#15.
* More adjustments to handling of version and OSCAL version. OSCAL version is the high water mark of the profile, plus any imports. See usnistgov/OSCAL#1272.
david-waltermire added a commit that referenced this issue Jun 29, 2022
* Corrected metadata/oscal-version handling bug to use OSCAL version, not the content version from a source profile. Resolves #15.
* More adjustments to handling of version and OSCAL version. OSCAL version is the high water mark of the profile, plus any imports. See usnistgov/OSCAL#1272.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant