Skip to content

Commit

Permalink
Merge pull request #244 from jan-cerny/remediations
Browse files Browse the repository at this point in the history
Hide some remediation types
  • Loading branch information
evgenyz authored Jul 31, 2024
2 parents 60dc569 + 81dc3d8 commit 1a18bfb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
"fix",
]

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


@dataclass
class Remediation:
Expand All @@ -33,5 +38,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 @@ -6,6 +6,7 @@
from openscap_report.dataclasses import replace

from ..data_structures import Identifier, Reference, Rule, RuleWarning
from ..data_structures.remediation import HIDDEN_REMEDIATION_TYPES
from ..namespaces import NAMESPACES
from .full_text_parser import FullTextParser
from .known_references import KNOWN_REFERENCES, update_references
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 1a18bfb

Please sign in to comment.