Skip to content

[backport] Evaluate OVAL state with no entities as true - #2463

Merged
matusmarhefka merged 1 commit into
OpenSCAP:maint-1.3from
jan-cerny:backport_2452
Oct 22, 2026
Merged

matusmarhefka merged 1 commit into
OpenSCAP:maint-1.3from
jan-cerny:backport_2452

Conversation

@jan-cerny

Copy link
Copy Markdown
Member

This PR is a backport of the PR #2452 to the maint-1.3 branch.

According to the OVAL specification, child entities in state elements have minOccurs=0. A state without any entities imposes no conditions; therefore, any collected system item vacuously satisfies it.

Previously, eval_item() in oval_resultTest.c would iterate over an empty list of state contents, leaving the results structure empty. It then passed this empty set to ores_get_result_byopr(), which mapped it to OVAL_RESULT_UNKNOWN.

This caused a critical false negative with Canonical's Ubuntu OVAL feeds, which define singleton family_states with no child entities. Because the inventory check evaluated to unknown, every Ubuntu Security Notice (USN) extending that inventory definition failed to evaluate to true, reporting zero vulnerabilities and exiting cleanly with code 0.

This patch detects when an OVAL state contains no entities and immediately returns OVAL_RESULT_TRUE. Also adds a regression test suite covering entity-less states and Ubuntu applicability check patterns.

According to the OVAL specification, child entities in state elements
have minOccurs=0. A state without any entities imposes no conditions;
therefore, any collected system item vacuously satisfies it.

Previously, eval_item() in oval_resultTest.c would iterate over an empty
list of state contents, leaving the results structure empty. It then
passed this empty set to ores_get_result_byopr(), which mapped it to
OVAL_RESULT_UNKNOWN.

This caused a critical false negative with Canonical's Ubuntu OVAL feeds,
which define singleton family_states with no child entities. Because the
inventory check evaluated to unknown, every Ubuntu Security Notice (USN)
extending that inventory definition failed to evaluate to true, reporting
zero vulnerabilities and exiting cleanly with code 0.

This patch detects when an OVAL state contains no entities and immediately
returns OVAL_RESULT_TRUE. Also adds a regression test suite covering
entity-less states and Ubuntu applicability check patterns.

Fixes OpenSCAP#2396
@jan-cerny jan-cerny added this to the 1.3.16 milestone Oct 22, 2026
@sonarqubecloud

Copy link
Copy Markdown

@matusmarhefka
matusmarhefka merged commit 416c134 into OpenSCAP:maint-1.3 Oct 22, 2026
11 checks passed
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.

3 participants