Skip to content

Validate levels in controls#11427

Merged
Mab879 merged 4 commits into
ComplianceAsCode:masterfrom
vojtapolasek:validate_levels_in_controls
Jan 10, 2024
Merged

Validate levels in controls#11427
Mab879 merged 4 commits into
ComplianceAsCode:masterfrom
vojtapolasek:validate_levels_in_controls

Conversation

@vojtapolasek
Copy link
Copy Markdown
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
@github-actions
Copy link
Copy Markdown

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
Copy Markdown
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.

Comment thread ssg/controls.py Outdated
Comment thread ssg/controls.py Outdated
Comment thread ssg/controls.py Outdated
@vojtapolasek vojtapolasek force-pushed the validate_levels_in_controls branch from 727ec2c to 990ea4d Compare January 9, 2024 09:56
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.
@vojtapolasek vojtapolasek force-pushed the validate_levels_in_controls branch from 990ea4d to 07687e7 Compare January 9, 2024 12:37
@qlty-cloud-legacy
Copy link
Copy Markdown

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
Copy Markdown
Collaborator Author

/packit retest

@Mab879
Copy link
Copy Markdown
Member

Mab879 commented Jan 9, 2024

/packit retest-failed

@Mab879
Copy link
Copy Markdown
Member

Mab879 commented Jan 9, 2024

/packit rebuild-failed

1 similar comment
@Mab879
Copy link
Copy Markdown
Member

Mab879 commented Jan 9, 2024

/packit rebuild-failed

@vojtapolasek
Copy link
Copy Markdown
Collaborator Author

/packit retest-failed

@vojtapolasek
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
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