-
Notifications
You must be signed in to change notification settings - Fork 55
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
feat: add profile-inherit command #1392
feat: add profile-inherit command #1392
Conversation
Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
Adds profile-seed as author subcommand Adds profile-seed unit test Adds SSP testdata Closes oscal-compass#1388 Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
Adds additional test case to check for ids output when all controls are filtered out Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
…ed command Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
cc @afflom |
Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
assert len(result_prof.imports[0].exclude_controls[0].with_ids) == 1 | ||
assert result_prof.imports[0].exclude_controls[0].with_ids[0] == excluded | ||
|
||
# Test with a profile that has more controls that the ssp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
than* typo
assert len(result_prof.imports[0].exclude_controls[0].with_ids) == 1 | ||
assert result_prof.imports[0].exclude_controls[0].with_ids[0] == excluded | ||
|
||
# Test with a profile that has less controls that the ssp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
than* typo
|
||
# Create dictionary containing all by-components by control for faster searching | ||
for implemented_requirement in leveraged_ssp.control_implementation.implemented_requirements: | ||
components: List[ssp.ByComponent] = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls change variable name to by_components to be more meaningful. I agree that in the end are components, but for readability purposes I´d prefer to call this variable as it is
if control_id not in components_by_id: | ||
continue | ||
|
||
by_comps = components_by_id[control_id] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where´s the by_comps declaration? Am I missing it somewhere?
|
||
include_with_ids: Set[prof.withId] = catalog_control_ids - exclude_with_ids | ||
|
||
include_controls = [prof.SelectControlById(with_ids=sorted(include_with_ids))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where´s include_controls declaration? As we try to keep strongly typed variables, please declare variables with its type when possible :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @AleJo2995! Ended up removing the intermediary variable and just set the value on the import. Please let me know if this adequately addresses your feedback.
include_with_ids: Set[prof.withId] = catalog_control_ids - exclude_with_ids | ||
|
||
include_controls = [prof.SelectControlById(with_ids=sorted(include_with_ids))] | ||
exclude_controls = [prof.SelectControlById(with_ids=sorted(exclude_with_ids))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where´s exclude_controls declaration? As we try to keep strongly typed variables, please declare variables with its type when possible :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same.
@jpower432 I´ve added some feedback regarding style than functionality. I have tested functionality and all seems correct to me. I´ll make a second pass today to it and provide more feedback if needed. If not, we´re all set :) |
Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@jpower432 you can go ahead and squash and merge whenever you want :) |
Types of changes
develop
->main
)Quality assurance (all should be covered).
Summary
This PR adds a new subcommand for
author
calledprofile-inherit
. This initializes and seeds a profile with information from a leveraged SSP and parent parent. Thewith-ids
field is populate with a control delta from the profile and inherited controls.Closes #1388
Key links:
Before you merge