Fix profile resolution when children of nested controls selected#233
Open
aj-stein-nist wants to merge 2 commits intousnistgov:developfrom
Open
Fix profile resolution when children of nested controls selected#233aj-stein-nist wants to merge 2 commits intousnistgov:developfrom
aj-stein-nist wants to merge 2 commits intousnistgov:developfrom
Conversation
aj-stein-nist
commented
Feb 1, 2024
src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/BasicIndexer.java
Outdated
Show resolved
Hide resolved
aj-stein-nist
commented
Feb 1, 2024
src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/BasicIndexer.java
Show resolved
Hide resolved
aj-stein-nist
commented
Feb 1, 2024
src/test/java/gov/nist/secauto/oscal/lib/profile/resolver/ProfileResolutionTests.java
Show resolved
Hide resolved
aj-stein-nist
commented
Feb 1, 2024
src/main/java/gov/nist/secauto/oscal/lib/profile/resolver/support/BasicIndexer.java
Outdated
Show resolved
Hide resolved
This may be a business logic error or perhaps at one time there was/is a valid reason, but as it stands the BasicIndexer would detect unselected controls for resolution of the profile but only drop them when their parent was selected for the default strategy of flattening. For simple trees where c1 is the root control and c1.1 is the child, so c1 -> c1.1, c1 was not being correctly removed. NOTE: Logging indicates a double index of c1.1 even with this change so that still needs to be fixed most likely to resolve this issue.
19e4ca4 to
37fcc27
Compare
Contributor
Author
|
@david-waltermire I am going to ask for a preliminary review but the fix seems pretty simple so I am worried I am misunderstand the scope of the issue. Additionally, when running the regression test, I am notice in the 10:39:58.383 [main] DEBUG gov.nist.secauto.oscal.lib.profile.resolver.ProfileResolver.resolveImport(ProfileResolver.java:322) - resolving profile import 'issue106-catalog.xml'
10:39:58.540 [main] ERROR gov.nist.secauto.metaschema.model.common.constraint.LoggingConstraintValidationHandler.logConstraint(LoggingConstraintValidationHandler.java:121) - ERROR: (/catalog/control[1]) Expect constraint 'prop[@name='status']/@value=('withdrawn','Withdrawn') or part[@name='statement']' did not match the data at path '/catalog/control[1]'
10:39:58.543 [main] ERROR gov.nist.secauto.metaschema.model.common.constraint.LoggingConstraintValidationHandler.logConstraint(LoggingConstraintValidationHandler.java:121) - ERROR: (/catalog/control[1]/control[1]) Expect constraint 'prop[@name='status']/@value=('withdrawn','Withdrawn') or part[@name='statement']' did not match the data at path '/catalog/control[1]/control[1]'
10:43:53.065 [main] DEBUG gov.nist.secauto.oscal.lib.profile.resolver.selection.DefaultResult.promoteControl(DefaultResult.java:103) - promoting control 'c1.1'
10:45:05.843 [main] DEBUG gov.nist.secauto.oscal.lib.profile.resolver.selection.DefaultResult.removeControl(DefaultResult.java:199) - Requesting removal of control 'c1'.
10:53:58.002 [main] DEBUG gov.nist.secauto.oscal.lib.profile.resolver.support.BasicIndexer.removeItem(BasicIndexer.java:246) - Removing CONTROL 'c1' from index.
10:55:28.634 [main] DEBUG gov.nist.secauto.oscal.lib.profile.resolver.ProfileResolver.structureFlat(ProfileResolver.java:462) - applying flat structuring directive
10:57:38.239 [main] DEBUG gov.nist.secauto.oscal.lib.profile.resolver.selection.DefaultResult.promoteControl(DefaultResult.java:103) - promoting control 'c1.1'
10:59:44.536 [main] WARN gov.nist.secauto.oscal.lib.profile.resolver.support.BasicIndexer.addItem(BasicIndexer.java:218) - Duplicate control found with identifier c1.1 in index.I cannot seem to track that down and I am not sure given the warning type on the log record if it is serious, but since the document should be reindex at this point, I am left scratching my head. Let me know. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Committer Notes
Closes #232.
All Submissions:
Changes to Core Features:
Have you included examples of how to use your new feature(s)?Have you updated all website and readme documentation affected by the changes you made?