Skip to content

Conversation

@Mab879
Copy link
Member

@Mab879 Mab879 commented Jan 8, 2026

Fixes #2260

This will be backported 1.3.14 as well.

@Mab879 Mab879 added this to the 1.4.4 milestone Jan 8, 2026
@jan-cerny jan-cerny self-assigned this Jan 12, 2026
Copy link
Member

@jan-cerny jan-cerny left a comment

Choose a reason for hiding this comment

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

The fix is wrong. The problem isn't that the tailoring is wrapped in a component element. The problem is that the component element that contains the tailoring is put after extended-component elements.

You can try it yourself, take the ARF from the reproducer in the issue description and move manually the component element containing the tailoring before all the extended-component elements . Then run the oscap xccdf generate fix again, it will start working.

The SCAP source data stream XML schema enforces ordering of child elements of data-stream-collection element. It requires that all component elements go first and extended-component elements should go after that. But they cant be interleaved.

I think the issue started to happen after the scap-security-guide started to ship data streams with SCEs. Before inclusion of SCEs there weren't any extended-component elements, there were only component elements, so it couldn't happen that the component element with tailoring would be appended after extedend-component elements.

The Tailoring element shall be wrapped in the component element, not in the extended-component element. According to SCAP 1.3 specification (sections 3.1.1 and 3.1.2), component is for items that are part of SCAP standard, and extended-extended component is for items that aren't part of SCAP standard. Tailoring is listed in the specification as an item that should be a child of the component element.

I suggest fixing the code that generates ARF so that the component element with tailoring is injected after the component with XCCDF but before all the extended-component elements.

Comment on lines 193 to 194
# Validate the ARF against schema (most important - this was failing before the fix)
$OSCAP ds rds-validate $result 2>$stderr
Copy link
Member

Choose a reason for hiding this comment

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

It doesn't fail before the fix. Not with this test data. To make it fail before the fix you need different test data. You need to create an input file that is a SCAP source data stream, not a plain XCCDF, and in this SCAP source data stream there need to be some extended-component elements. For example elements containing SCEs as the latest scap-security-guide data streams. But don't include the whole scap-security-guide data stream in the openscap test suite, please create a minimal reproducer data stream that will fail before the fix and pass after the fix.

Comment on lines 193 to 194
# Validate the ARF against schema (most important - this was failing before the fix)
$OSCAP ds rds-validate $result 2>$stderr
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer to have oscap xccdf generate fix command, that would be closer to the steps to reproduce the reporter's issue.

src/DS/rds.c Outdated
&tailoring_res_node, doc, NULL, 1, 0);
xmlNsPtr sds_ns = sds_res_node->ns;
xmlNodePtr tailoring_component = xmlNewNode(sds_ns, BAD_CAST "component");
xmlNodePtr tailoring_component = xmlNewNode(sds_ns, BAD_CAST "extended-component");
Copy link
Member

Choose a reason for hiding this comment

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

It needs to stay "component".

@Mab879 Mab879 marked this pull request as draft January 12, 2026 13:49
Now the tailoring is added just before the extended-components (i.e. SCE).

Created in part by Claude Code.

Fixes OpenSCAP#2260
@Mab879 Mab879 changed the title Fix ARF generation with tailoring to use extended-component Fix schema ordering when adding tailoring to ARF files Jan 12, 2026
@Mab879 Mab879 marked this pull request as ready for review January 12, 2026 21:52
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.

Tailoring breaks validating SCAP Source Datastream

2 participants