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 import identifier handling #1424

Closed

Conversation

david-waltermire
Copy link
Contributor

Committer Notes

Provides identifier reassignment capabilities for remapping identifiers in imported catalogs during the import phase of profile resolution.

All Submissions:

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

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.

david-waltermire and others added 30 commits August 22, 2022 23:00
* 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
…ts (#1101)

* Group scenarios and add edge case scenario
* Group the scenarios that test o:glob-as-regex.
* Add scenario for edge case where input is empty.
* For selection, augment XSpec and update XSLT
* Add XSpec tests for oscal-profile-resolve-select.xsl, mostly at the level of templates and functions.
* Minor enhancements in oscal-profile-resolve-select.xsl:
* Add support for with-parent-controls
* Generate fatal error if resource cannot be fetched
* Provide focused error message if resource has no suitable rlink
* Handle missing matching pattern
* Fix indentation
* Fix scenario that intentionally omits pattern
* Rename o:resource-or-warning as o:resource-or-error
* Attributes, not elements, for "from" and "to"
* Update expected value for 4a3cadf changes in catalog
* The abc-full_catalog.xml file has changed, so the "Loose parameters" test scenario needs adjustment.
* Reduce redundancy in expected metadata
* metadata is copied verbatim, so no need to check details in multiple test scenarios for the match=profile template
* Update verbiage to cross-reference with logged discussion pages
For consistency with select.xspec, use XSpec variable instead of entity
for the path to the profile resolution examples.
random-util.xsl provides r:make-uuid and r:make-uuid-sequence for creating one
or more random UUIDs. The r:make-random-string-sequence function supports
more flexible random patterns. Implementations here use the XPath
function, random-number-generator.

random-util.xspec provides template- and function-level tests for
code in random-util.xsl.
Implementing an idea from @wendellpiez: Instead of iterating over a
numeric sequence that represents the position of each character in a
long string, iterate over the sequence of characters.

This change is in the implementation only, not in the function output.
I used ad hoc modifications of the label="seq-length=10000" scenario
in the XSpec test to check that the original and modified functions
produce the same UUID sequence.
- Metadata tests and way of determining top UUID
- Remove global parameter assign-uuid (note backward incompatibility - is it OK?)
- Instead, support global parameters uuid-method and top-uuid, in uuid-method-choice.xsl
- Support global parameter hide-source-profile-uri
- Stub of opr:oscal-version function
- Stub of message handler template, using xsl:message for now
- Add XSpec tests
- Add table of parameters and clarify testing folder content
- Change "home" from global param to global variable; does not need to be set from outside
XSLT
- Move some code from oscal-profile-resolve-select.xsl to new file, select-or-custom-merge.xsl, and share it between Selection phase and Merge phase.
- Add error checking for multiple structuring directives.
- Finish the incomplete support for `insert-controls/@order`.
- Fix bug in support for `@with-parent-controls` in Selection phase.

XSpec
- In select.xspec, add test for order of controls matching imported document, not profile document. Also, add test for `@with-parent-controls` bug fix.
- Create merge-combine.xspec for testing combine-elements and mode="o:combine-elements" templates.
- Organize tests among merge.xspec, merge-combine.xspec, merge-as-is.xspec, and merge-custom.xspec.
- Integrate back-matter testing into template-level tests in merge.xspec and merge-as-is.xspec, and delete merge-back-matter.xspec.
* Added mapping model supporting mapping controls and control statements between two catalogs.
* Adjusted relationships based on PR #1150 discussions. Added type enumerations.
* Included a simple example
Adding the mapping model to the metaschema CI build.
Bumps [ajv-cli](https://github.com/ajv-validator/ajv-cli) from 4.2.0 to 5.0.0.
- [Release notes](https://github.com/ajv-validator/ajv-cli/releases)
- [Commits](ajv-validator/ajv-cli@v4.2.0...v5.0.0)

---
updated-dependencies:
- dependency-name: ajv-cli
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [peter-evans/create-issue-from-file](https://github.com/peter-evans/create-issue-from-file) from 3.0.0 to 4.
- [Release notes](https://github.com/peter-evans/create-issue-from-file/releases)
- [Commits](peter-evans/create-issue-from-file@97e6f90...99b87c3)

---
updated-dependencies:
- dependency-name: peter-evans/create-issue-from-file
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 2 to 3.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](actions/setup-java@v2...v3)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 2 to 3.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](actions/setup-node@v2...v3)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action) from 4.9.2 to 4.14.1.
- [Release notes](https://github.com/stefanzweifel/git-auto-commit-action/releases)
- [Changelog](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/CHANGELOG.md)
- [Commits](stefanzweifel/git-auto-commit-action@be7095c...49620cd)

---
updated-dependencies:
- dependency-name: stefanzweifel/git-auto-commit-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github.com/gohugoio/hugo](https://github.com/gohugoio/hugo) from 0.83.1 to 0.101.0.
- [Release notes](https://github.com/gohugoio/hugo/releases)
- [Changelog](https://github.com/gohugoio/hugo/blob/master/goreleaser.yml)
- [Commits](gohugoio/hugo@v0.83.1...v0.101.0)

---
updated-dependencies:
- dependency-name: github.com/gohugoio/hugo
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps Saxon-HE from 10.6 to 10.8.

---
updated-dependencies:
- dependency-name: net.sf.saxon:Saxon-HE
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3.4.0 to 3.4.1.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](actions/setup-node@5b949b5...2fddd88)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [xmlcalabash](https://github.com/ndw/xmlcalabash1) from 1.2.5-100 to 1.4.1-100.
- [Release notes](https://github.com/ndw/xmlcalabash1/releases)
- [Commits](ndw/xmlcalabash1@1.2.5-100...1.4.1-100)

---
updated-dependencies:
- dependency-name: com.xmlcalabash:xmlcalabash
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps golang from 1.18.3-bullseye to 1.18.4-bullseye.

---
updated-dependencies:
- dependency-name: golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Add mapping model to docs collection.
* Revised text to address ambiguity around handling `oscal-version` in the generated catalog target based on the versions provided in the imports and source profile. Resolves #1272.
* Adding swap space to resolve memory issue with Hugo build
* Profile Resolution spec: updated names of 'remove' directives
* Resolves #1246. Also repairs a few errors in surrounding copy.
* Adding swap space to address Hugo memory exhaustion.

Co-authored-by: David Waltermire <david.waltermire@nist.gov>
@david-waltermire
Copy link
Contributor Author

david-waltermire commented Sep 2, 2022

The following is an example of the resulting solution.

{
    "imports": [
        {
            "href": "#FedRAMP_rev4_MODERATE-baseline_profile.json",
            "include-controls": [
            {
                "with-ids": [
                "ac-6.9",
                "ac-6.10",
                "ac-7",
                "ac-8"
                ]
            }
            ],
            "identifier-reassignment": {
                "with-prefix": "prefixA-",
                "with-suffix": "-suffixA",
                "controls": {
                    "with-prefix": "prefixB-",
                    "with-suffix": "-suffixB",
                    "reassignments": [
                        {
                            "from": "ac-6.9",
                            "to": "ac-6.9-new"
                        }
                    ]
                }
                // ac-6.9 -> prefixA-prefixB-ac-6.9-new-suffixB-suffixA
                // ac-6.10 -> prefixA-prefixB-ac-6.10-suffixB-suffixA
                // ac-7 -> prefixA-prefixB-ac-7-suffixB-suffixA
                // ac-8 -> prefixA-prefixB-ac-8-suffixB-suffixA
            }
        }
    ]
}

@AdamOlineCB
Copy link

AdamOlineCB commented Sep 2, 2022

When reading through the example, I see "with-ids" acting as a filter of sorts in the "include-controls" section, identifying the controls to include from the profile, and then I scan down to the "identifier-reassignment" that uses "with-prefix" and "with-suffix" and my first thought was "are those also filters?". After studying for a few more minutes and reviewing the examples it is obvious they are actions to apply the prefix and suffix values for the resulting identifiers or the reassignment transformation.

My suggestion would be to change the "with-" portion to something that more clearly communicates these are actions, such as "use-" or "apply-", e.g.:

"use-prefix": "prefixB-",
"use-suffix": "-suffixB",

or

"apply-prefix": "prefixB-",
"apply-suffix": "-suffixB",

I think I like apply- best of these two.

@aj-stein-nist
Copy link
Contributor

"apply-prefix": "prefixB-",
"apply-suffix": "-suffixB",

I think I like apply- best of these two.

I too like the apply- and the rationale Adam provides resonated with. I think it is looking at too much Python using with context managers. 😆

@aj-stein-nist
Copy link
Contributor

{
    "imports": [
        {
            "href": "#FedRAMP_rev4_MODERATE-baseline_profile.json",
            "include-controls": [
            {
                "with-ids": [
                "ac-6.9",
                "ac-6.10",
                "ac-7",
                "ac-8"
                ]
            }
            ],
            "identifier-reassignment": {
                "with-prefix": "prefixA-",
                "with-suffix": "-suffixA",
                "controls": {
                    "with-prefix": "prefixB-",
                    "with-suffix": "-suffixB",
                    "reassignments": [
                        {
                            "from": "ac-6.9",
                            "to": "ac-6.9-new"
                        }
                    ]
                }
                // ac-6.9 -> prefixA-prefixB-ac-6.9-new-suffixB-suffixA
                // ac-6.10 -> prefixA-prefixB-ac-6.10-suffixB-suffixA
                // ac-7 -> prefixA-prefixB-ac-7-suffixB-suffixA
                // ac-8 -> prefixA-prefixB-ac-8-suffixB-suffixA
            }
        }
    ]
}

I am confused by the use of with-prefix in a few places and the model didn't really help me. Does the nested with-prefix and with-suffix declarations apply to some controls and not others as a subset of the include-controls assembly? If not, why do we double up the directives? I think I am just confused by the example given all controls in the example have wrapped suffixes and prefixes the same way.

@iMichaela
Copy link
Contributor

iMichaela commented Sep 2, 2022

Is the following interpretation accurate, considering the following assumptions:

  1. I am creating a new profile derived from FedRAMP's moderate profile, and I want to have an easy way to remember what I did since I am tailoring the controls in the process
  2. I want to know (easily remember that my controls started with fedramp baseline, moderate impact, and will end in my profile for highly regulated env hre, low impact profile
  3. I want later on to easily remember what I did in 2) just by looking at the ID

NOTE: I am using, as an example, the prefix for governance traceability and the suffix for impact level.

{
    "imports": [
        {
            "href": "#FedRAMP_rev4_MODERATE-baseline_profile.json",
            "include-controls": [
            {
                "with-ids": [
                "ac-6.9",
                "ac-6.10",
                "ac-7",
                "ac-8"
                ]
            }
            ],
            "identifier-reassignment": {
                "with-prefix": "hre-",
                "with-suffix": "-low",
                "controls": {
                    "with-prefix": "fedramp-",
                    "with-suffix": "-moderate",
                    "reassignments": [
                        {
                            "from": "ac-6.9",
                            "to": "hre-fedramp-ac-6.9-moderate-low" 
                        }
                    ]
                }
                // ac-6.9 -> hre-fedramp-ac-6.9-moderate-low
            }
        }
    ]
}

OR
The identifier-reassignment is only informative and the reassignment should read

"reassignments": [
                        {
                            "from": "ac-6.9",
                            "to": "ac-6.9-new" 
                        }
                    ]

and the new ID is actually ac-6.9-new

I am not sure I understand the part of the example in red that highlights the new name PLUS the chained prefixes-suffixes. Where or when should it be used as shown?

Updated `with-prefix` and `with-suffix` to `apply-prefix` and `apply-suffix` based on feedback.
Comment on lines +424 to +426
<li><p>Control</p></li>
<li><p>Group</p></li>
<li><p>Resource</p></li>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
<li><p>Control</p></li>
<li><p>Group</p></li>
<li><p>Resource</p></li>
<li><p>role</p></li>
<li><p>control</p></li>
<li><p>group</p></li>
<li><p>parameter</p></li>
<li><p>part</p></li>

@david-waltermire
Copy link
Contributor Author

This work will be completed once #1474 is completed.

@aj-stein-nist
Copy link
Contributor

@david-waltermire-nist I would like to take some time next week to meet up about this work and how it relates to other issues. After that, I will determine how we work on the issue in future sprints and update this branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment