Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SCE finding XPath to allow nesting with OCILs #11682

Merged
merged 1 commit into from
Mar 12, 2024

Conversation

cipherboy
Copy link
Contributor

Description:

When building data streams with complex checks (SCE combined with OVAL) that also have OCIL checks, we build a nested check system like:

<complex-check operator="OR">
    <complex-check operator="<SCE-CROSS-OVAL>">
        <OVAL />
        <SCE />
    </complex-check>
    <OCIL />
</complex-check>

However, the XPath for finding such checks (to include the SCE in the data stream) required the SCE check to be a direct descendant of the rule. Modify the XPath to allow arbitrary nesting on the inner SCE.

Rationale:

Fix is broken :-)

Resolves: #11681

Review Hints:

Pull this commit on top of the branch described in #11681 and run:

ADDITIONAL_CMAKE_OPTIONS="-DSSG_SCE_ENABLED:BOOL=ON" ./build_product debian12

When building data streams with complex checks (SCE combined with OVAL)
that also have OCIL checks, we build a nested check system like:

    <complex-check operator="OR">
        <complex-check operator="<SCE-CROSS-OVAL>">
            <OVAL />
            <SCE />
        </complex-check>
        <OCIL />
    </complex-check>

However, the XPath for finding such checks (to include the SCE in the
data stream) required the SCE check to be a direct descendant of the
rule. Modify the XPath to allow arbitrary nesting on the inner SCE.

Resolves: ComplianceAsCode#11681

Signed-off-by: Alexander Scheel <alexander.m.scheel@gmail.com>
Copy link

openshift-ci bot commented Mar 12, 2024

Hi @cipherboy. Thanks for your PR.

I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci openshift-ci bot added the needs-ok-to-test Used by openshift-ci bot. label Mar 12, 2024
@Mab879 Mab879 self-assigned this Mar 12, 2024
@Mab879
Copy link
Member

Mab879 commented Mar 12, 2024

/ok-to-test

@openshift-ci openshift-ci bot added ok-to-test Used by openshift-ci bot. and removed needs-ok-to-test Used by openshift-ci bot. labels Mar 12, 2024
Copy link

Start a new ephemeral environment with changes proposed in this pull request:

Fedora Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

Copy link

🤖 A k8s content image for this PR is available at:
ghcr.io/complianceascode/k8scontent:11682
This image was built from commit: 66ee333

Click here to see how to deploy it

If you alread have Compliance Operator deployed:
utils/build_ds_container.py -i ghcr.io/complianceascode/k8scontent:11682

Otherwise deploy the content and operator together by checking out ComplianceAsCode/compliance-operator and:
CONTENT_IMAGE=ghcr.io/complianceascode/k8scontent:11682 make deploy-local

Copy link

codeclimate bot commented Mar 12, 2024

Code Climate has analyzed commit 66ee333 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 59.8% (0.0% change).

View more on Code Climate.

@Mab879 Mab879 added this to the 0.1.73 milestone Mar 12, 2024
@Mab879 Mab879 added bugfix Fixes to reported bugs. Infrastructure Our content build system labels Mar 12, 2024
@Mab879 Mab879 merged commit bcc8c93 into ComplianceAsCode:master Mar 12, 2024
44 checks passed
@Mab879
Copy link
Member

Mab879 commented Mar 12, 2024

Thanks for the fix! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Fixes to reported bugs. Infrastructure Our content build system ok-to-test Used by openshift-ci bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SCE script not included in datastream when using complex-check
2 participants