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

Abort the build if an OVAL is not included due to extend_definition #6402

Merged

Conversation

matejak
Copy link
Member

@matejak matejak commented Nov 19, 2020

If an extending definition is missing, then the OVAL won't be there as well.
This indicates an incorrect setup of applicability - either extending definitions are not applicable as they should, or the compound definition should not be applicable.

Fixes: #6185

@matejak matejak added this to the 0.1.54 milestone Nov 19, 2020
@pep8speaks
Copy link

pep8speaks commented Nov 19, 2020

Hello @matejak! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-04-07 16:00:22 UTC

@matejak matejak added the OVAL OVAL update. Related to the systems assessments. label Nov 19, 2020
@openscap-ci
Copy link
Collaborator

openscap-ci commented Nov 19, 2020

Changes identified:
Others:
 Changes in Python files.

Show details

Others:
 Python abstract syntax tree change found in ssg/build_renumber.py.
 Python abstract syntax tree change found in ssg/constants.py.

Recommended tests to execute:
 (cd build && cmake ../ && ctest -j4)

@matejak
Copy link
Member Author

matejak commented Nov 20, 2020

test this please

@ggbecker
Copy link
Member

your pull requested has detected that some prodtypes are missing in disable_prelink

it should be: prodtype: rhcos4,ol7,rhel7,wrlinux1019

@matejak
Copy link
Member Author

matejak commented Nov 20, 2020

It was not so simple with OSP, as some OVALs are generated by templates, but it is resolved now.

@ggbecker
Copy link
Member

It was not so simple with OSP, as some OVALs are generated by templates, but it is resolved now.

Great. But now there is some issue with OCP4 as it only build on fedora and when using certain version of openscap

@matejak matejak force-pushed the abort_missing_extending_defs branch 2 times, most recently from 38f9b96 to e19f96d Compare November 20, 2020 16:50
ocp4/product.yml Outdated
additional_content_directories:
- "../linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software"
- "../linux_os/guide/system/network/network-ipv6/disabling_ipv6"
- "../linux_os/guide/system/selinux"
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't sound right... why are these being included?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a good catch. So we have some "shared" OVALs that don't belong to any rules. One would expect them to be included in the benchmark if they are needed by rule checks, but that's not the case - they are included unconditionally. Those incriminated definitions are the and ones.
The quick fix of these cases would be to set "affected platform" of those snippets to Linux OSs only, as they don't make sense for OCP, OSP and other application-level products.

In the longer run, we should do something about our messed-up system of platforms vs prodtypes vs products.
Finally, those shared checks should be included only on-demand, and there should be a distinction between an applicability of the check and whether the check is actually needed by some other check or by an existing rule.

@JAORMX
Copy link
Contributor

JAORMX commented Nov 23, 2020

It was not so simple with OSP, as some OVALs are generated by templates, but it is resolved now.

Great. But now there is some issue with OCP4 as it only build on fedora and when using certain version of openscap

Right, ocp4 content needs openscap 1.3.4

@matejak matejak force-pushed the abort_missing_extending_defs branch 2 times, most recently from fa1c104 to 93bd129 Compare November 25, 2020 16:29
@matejak
Copy link
Member Author

matejak commented Nov 25, 2020

RHV has been affected as well - it is just a flavor of RHEL after all.

@matejak
Copy link
Member Author

matejak commented Nov 26, 2020

/retest

@jan-cerny jan-cerny self-assigned this Dec 4, 2020
self.tree, self.oval_groups, indexed_oval_defs)
defs_miss = get_oval_checks_extending_non_existing_checks(self.tree, indexed_oval_defs)
if defs_miss:
if self.tolerate_missing_extending_defs:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is never set which means this block is never executed. What are the plans?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no plan - the code is just prepared for the possibility that missing extending definitions become tolerable.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Aha, and can it ever happen that it will be tolerable? What is the scenario in which it would be used?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hard to say - you know how it is with assumptions. There must have been some reason why it is tolerated since it was introduced.

Copy link
Collaborator

Choose a reason for hiding this comment

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

But it's you who introduces it so you should be able to explain why you introduce it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have removed the conserved code in a commit that can be reverted in case that there is an interest to build content that has "definition holes".

@vojtapolasek vojtapolasek modified the milestones: 0.1.54, 0.1.55 Jan 11, 2021
@jan-cerny
Copy link
Collaborator

@matejak please refresh my mind about why this PR is hanging

@matejak
Copy link
Member Author

matejak commented Jan 22, 2021

This PR can prevent products with inconsistent OVAL content from building :-( Perhaps we could start introducing it after the release.

@vojtapolasek vojtapolasek modified the milestones: 0.1.55, 0.1.56 Mar 8, 2021
@matejak matejak force-pushed the abort_missing_extending_defs branch from be06a88 to 483d05b Compare March 12, 2021 08:44
@matejak
Copy link
Member Author

matejak commented Mar 12, 2021

The PR doesn't break any builds now, so please @jan-cerny give it a go.

@JAORMX
Copy link
Contributor

JAORMX commented Mar 12, 2021

/retest

If an extending definition is missing, then the OVAL won't be there as well.
This indicates an incorrect setup of applicability - either extending definitions
are not applicable as they should, or the compound definition should not be applicable.
Definitions used by other definitions need to have at least the same applicability
as definitions that require them.
- The product name is specified more than once in the project, and all occurences have to be consistent.
@matejak matejak force-pushed the abort_missing_extending_defs branch from 483d05b to c7b6094 Compare April 7, 2021 16:00
@JAORMX
Copy link
Contributor

JAORMX commented Apr 7, 2021

/retest

@openshift-ci
Copy link

openshift-ci bot commented Apr 7, 2021

@matejak: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-aws-ocp4-moderate c7b6094 link /test e2e-aws-ocp4-moderate

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@JAORMX
Copy link
Contributor

JAORMX commented Apr 8, 2021

/retest

CI failed gathering logs; it's unrelated to the CaC tests.

@jan-cerny jan-cerny merged commit 2bebe03 into ComplianceAsCode:master Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OVAL OVAL update. Related to the systems assessments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing referenced OVAL
7 participants