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

Add multi-check rules #148

Merged
merged 9 commits into from
Apr 12, 2023
Merged

Add multi-check rules #148

merged 9 commits into from
Apr 12, 2023

Conversation

Honny1
Copy link
Member

@Honny1 Honny1 commented Mar 21, 2023

This PR adds multi-check rules to the HTML report.

Example:
image

Depend on: #140

@Honny1 Honny1 force-pushed the multi-check-rules branch 2 times, most recently from 4c2e208 to f1053be Compare March 29, 2023 13:22
@Honny1 Honny1 marked this pull request as ready for review April 6, 2023 13:13
return self.reports_with_oval_definitions[self.cpe_source]
logging.warning((
"The given input does not contain a clear mapping of the OVAL definition used"
" for CPE checks. The results of the OVAL definition in the CPE checks could "
Copy link
Contributor

Choose a reason for hiding this comment

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

Spaces: at the end or at the start?

@@ -107,4 +107,11 @@ def parse_report(self):
self._debug_show_rules(rules)
report.rules = rules
report.groups = groups

if len(report.profile_info.selected_rules_ids) > 0:
report.profile_info.selected_rules_ids.extend(rule_parser.to_select_rule_ids)
Copy link
Contributor

Choose a reason for hiding this comment

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

That should be a ProfileInfo mutate method, like extend_selected_rules_ids. Along with the logic how/when to do that if len(report.profile_info.selected_rules_ids) > 0:.

Why do you update it only when it is not empty by the way?

Copy link
Member Author

Choose a reason for hiding this comment

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

There are two approaches how to determine if the rule is selected.

  • First is to get information from elements <xccdf-1.2:select ...>. A list of selected_rules_ids represents these elements.
  • The second is to get information from the result of the rule.

The second approach is used if select elements aren't present in the ARF report. That is why the list is not extended when the list is empty.

@Honny1
Copy link
Member Author

Honny1 commented Apr 12, 2023

Changes:

  • Created ProfileInfo mutate methods for selecting and deselecting rules
  • Consistently split strings (previous PR)

@evgenyz evgenyz merged commit fbe1e98 into OpenSCAP:main Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants