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

Add validation for Keys in Controls #10813

Merged
merged 4 commits into from
Jul 10, 2023

Conversation

Mab879
Copy link
Member

@Mab879 Mab879 commented Jul 7, 2023

Description:

This adds test before import a control dict to ensure that it only have supported keys. To prevent unfortunate event like using rule vs rules.

Rationale:

Closes #9772

Review Hints:

Add an invalid key like badval to a control in a control file and the build should fail.

@Mab879 Mab879 added this to the 0.1.69 milestone Jul 7, 2023
@Mab879 Mab879 added the Infrastructure Our content build system label Jul 7, 2023
@github-actions
Copy link

github-actions bot commented Jul 7, 2023

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

Fedora Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

@Mab879 Mab879 changed the title Controls strict Add validation for Keys in Controls Jul 7, 2023
@codeclimate
Copy link

codeclimate bot commented Jul 7, 2023

Code Climate has analyzed commit aa10861 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 53.5% (0.0% change).

View more on Code Climate.

@jan-cerny jan-cerny self-assigned this Jul 10, 2023
Copy link
Collaborator

@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.

I have verified that it fixes #9772 in a nice way, this happened when using a wrong key (rule instead of rules):

RuntimeError: Unable to parse controls from /home/jcerny/work/git/scap-security-guide/controls/anssi.yml: Key rule is not a valid for a control.
ninja: build stopped: subcommand failed.

@jan-cerny
Copy link
Collaborator

The CI fail on Rawhide is in the installation of the Imp module and isn't related to the contents of this PR.

@jan-cerny jan-cerny merged commit 387380d into ComplianceAsCode:master Jul 10, 2023
@Mab879 Mab879 deleted the controls_strict branch July 10, 2023 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure Our content build system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Controls file format does not prevent using unsupported parameters
2 participants