Repository navigation
Support CPE 2.3 format in XCCDF platform applicability (#2404) - #2453
Closed
Mohit20057 wants to merge 1 commit into
Closed
Mohit20057 wants to merge 1 commit into
Mohit20057 wants to merge 1 commit into
Conversation
Mohit20057
requested review from
Mab879,
jan-cerny and
matusmarhefka
as code owners
October 20, 2026 15:06
When an XCCDF benchmark or rule uses a CPE 2.3 formatted string in platform idref, platform applicability previously failed to match against CPE dictionaries due to: 1. cpe_name_match_one() failing on field count difference between 11-field CPE 2.3 formatted strings and 4-field CPE 2.2 URIs, as well as lack of wildcard '*' support. 2. cpe_name_applicable_dict() and cpe_name_match_dict() only checking primary CPE 2.2 cpe-item names and ignoring cpe23-item. This patch refactors cpe_name_match_one() to support wildcards and cross-format CPE 2.2 / CPE 2.3 matching, and updates dictionary lookup to also match against cpe23-item names when present. Fixes OpenSCAP#2404
Mohit20057
force-pushed
the
fix-cpe23-platform-applicability
branch
from
October 21, 2026 07:01
abf6caf to
dc9fe80
Compare
|
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.



Summary
Fixes #2404
When an XCCDF benchmark or rule uses a CPE 2.3 formatted string in
<platform idref="...">(e.g.,cpe:2.3:o:...), platform applicability previously failed silently against CPE dictionaries, causing all rules to be evaluated asnotapplicable.Root Cause
cpe_name_match_one()failed immediately on field count comparison (cpe_fields_num(against) < cpefn) when comparing an 11-field CPE 2.3 formatted string against a 4-field CPE 2.2 URI, and did not recognize*as an ANY wildcard.cpe_name_applicable_dict()andcpe_name_match_dict()only checked the primary<cpe-item>name (CPE 2.2 URI) and ignored the inner<cpe-23:cpe23-item>element.Solution
cpe_name_match_one()to compare attributes across all 11 fields (CPE_TOTAL_FIELDNUM), handling wildcards (*) and omitted attributes for seamless cross-format matching between CPE 2.2 and CPE 2.3.cpe23_item_get_name()andcpe_item_get_cpe23_name()accessors to retrieve<cpe-23:cpe23-item>names.cpe_name_applicable_dict()andcpe_name_match_dict()to match against both the primary CPE 2.2 name and the CPE 2.3 name if present.tests/API/CPE/dict/test_api_cpe_dict.shtesting CPE 2.3 matching against CPE 2.3 and CPE 2.2 dictionaries.tests/API/XCCDF/applicability/test_xccdf_cpe_eval.shwith a benchmark containing a CPE 2.3 platform idref, verifying that 0 rules evaluate tonotapplicable.