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

Validate levels in controls #11427

Merged

Conversation

vojtapolasek
Copy link
Collaborator

Description:

  • add a function which will check if a control does not include invalid level
  • valid levels are defined in the policy, any other levels are invalid

Rationale:

Inspired while verifying #11417

Review Hints:

  • choose a policy which has defined levels, change a control to contain undefined level and build any product
  • choose a policy which does not use level and define a level for a particular control, build any product

@vojtapolasek vojtapolasek added the Infrastructure Our content build system label Jan 8, 2024
@vojtapolasek vojtapolasek added this to the 0.1.72 milestone Jan 8, 2024
Copy link

github-actions bot commented Jan 8, 2024

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 self-assigned this Jan 8, 2024
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.

LGTM, but please rewrite to that it works on Python 2.7 on CentOS 7.

ssg/controls.py Outdated Show resolved Hide resolved
ssg/controls.py Outdated Show resolved Hide resolved
ssg/controls.py Outdated Show resolved Hide resolved
in case there are no levels defined, insert there a default level
This function checks if all levels defined for individual controls are defined for the policy.
Copy link

codeclimate bot commented Jan 9, 2024

Code Climate has analyzed commit 07687e7 and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1

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 58.5% (0.1% change).

View more on Code Climate.

@vojtapolasek
Copy link
Collaborator Author

/packit retest

@Mab879
Copy link
Member

Mab879 commented Jan 9, 2024

/packit retest-failed

@Mab879
Copy link
Member

Mab879 commented Jan 9, 2024

/packit rebuild-failed

1 similar comment
@Mab879
Copy link
Member

Mab879 commented Jan 9, 2024

/packit rebuild-failed

@vojtapolasek
Copy link
Collaborator Author

/packit retest-failed

@vojtapolasek
Copy link
Collaborator Author

@Mab879 I think I fixed everything I could. I consider extracting code from controls.py to satisfy the requirement on number of lines as out of scope.

@Mab879
Copy link
Member

Mab879 commented Jan 10, 2024

@Mab879 I think I fixed everything I could. I consider extracting code from controls.py to satisfy the requirement on number of lines as out of scope.

Agreed. Thanks for the work. Reviewing.

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.

LGTM.

Thanks for your work.

@Mab879 Mab879 merged commit 599c8e1 into ComplianceAsCode:master Jan 10, 2024
37 of 38 checks passed
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.

2 participants