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

Introduce script shorthand to OVAL #10085

Merged
merged 5 commits into from
Jan 25, 2023

Conversation

jan-cerny
Copy link
Collaborator

Description:

Introduce a small script shorthand_to_oval.py that converts (resolved) shorthand OVAL files to a valid OVAL file.

It's based on already existing code from the CTest test "macros-oval".

Rationale:

The script can be useful for example when creating minimal bug reproducers. If you know that a problem is located in OVAL for a specific rule, you can use it to convert a resolved shorthand OVAL files from the build/product/checks/oval directory to a standalone valid OVAL file that you can then pass to oscap.

Review Hints:

$ ./build_product rhel9
$ utils/shorthand_to_oval.py build/rhel9/checks/oval/accounts_tmout.xml oval.xml
$ oscap oval eval oval.xml

For more details, please read the commit messages of every commit.

The method OVALTester._expand_shorthand is a private method used
as helper in the CTest test "macros-oval". But, it might be useful
not only in this test, so we will move it to the ssg module and
make it a public function.
@jan-cerny jan-cerny added the enhancement General enhancements to the project. label Jan 18, 2023
@jan-cerny jan-cerny added this to the 0.1.66 milestone Jan 18, 2023
@github-actions
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

Reduce code complexity to satisfy CodeClimate.
@jan-cerny
Copy link
Collaborator Author

I have addressed the CodeClimate problem.

@vojtapolasek vojtapolasek modified the milestones: 0.1.66, 0.1.67 Jan 24, 2023
@Mab879 Mab879 self-assigned this Jan 24, 2023
Copy link
Member

@Mab879 Mab879 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, and the changes look good. Could you add CTest that runs this script?

This is a simple end-to-end test for utils/shorthand_to_oval.py
@codeclimate
Copy link

codeclimate bot commented Jan 25, 2023

Code Climate has analyzed commit 5e6ca9e and detected 0 issues on this pull request.

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

This pull request will bring the total coverage in the repository to 49.5% (-0.2% change).

View more on Code Climate.

@Mab879
Copy link
Member

Mab879 commented Jan 25, 2023

/packit retest-failed

Copy link
Member

@Mab879 Mab879 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! This will be a great addition to the project!

@Mab879
Copy link
Member

Mab879 commented Jan 25, 2023

Waving the CodeClimate findings as one, they related to the reorganization of code, and two there are end to end tests for the new code.

@Mab879 Mab879 merged commit be88d6a into ComplianceAsCode:master Jan 25, 2023
@Mab879 Mab879 added the Infrastructure Our content build system label Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement General enhancements to the project. Infrastructure Our content build system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants