Skip to content

Commit

Permalink
Hide some remediation types
Browse files Browse the repository at this point in the history
This change will cause that Anaconda and Kickstart remediation
types will not be shown in the HTML report. Anaconda remediations
are consumed only by OSCAP Anaconda Addon. Kickstart remediations
are consumed by OpenSCAP to generate a kickstart. It isn't useful
to the user at all to see or copy these remediation types, they
don't have any use for them. To reduce the unnecessary information
in the report, we won't include them in the report.
  • Loading branch information
jan-cerny committed Jul 30, 2024
1 parent 60dc569 commit 6a06016
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
"fix",
]

HIDDEN_REMEDIATION_TYPES = [
"urn:redhat:anaconda:pre",
"urn:xccdf:fix:script:kickstart",
]

@dataclass
class Remediation:
Expand All @@ -33,5 +37,6 @@ def get_type(self):
"urn:redhat:anaconda:pre": "Anaconda snippet",
"urn:xccdf:fix:script:kubernetes": "Kubernetes snippet",
"urn:redhat:osbuild:blueprint": "OSBuild Blueprint snippet",
"urn:xccdf:fix:script:kickstart": "Kickstart snippet",
}
return script_types.get(self.system, "script")
3 changes: 3 additions & 0 deletions openscap_report/scap_results_parser/parsers/rule_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import collections

from openscap_report.dataclasses import replace
from ..data_structures.remediation import HIDDEN_REMEDIATION_TYPES

from ..data_structures import Identifier, Reference, Rule, RuleWarning
from ..namespaces import NAMESPACES
Expand Down Expand Up @@ -58,6 +59,8 @@ def _get_remediations(self, rule):
output = []
for fix in rule.findall(".//xccdf:fix", NAMESPACES):
remediation = self.remediation_parser.get_remediation(fix)
if remediation.system in HIDDEN_REMEDIATION_TYPES:
continue
output.append(remediation)
return output

Expand Down

0 comments on commit 6a06016

Please sign in to comment.