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

Controls file format does not prevent using unsupported parameters #9772

Closed
ggbecker opened this issue Nov 7, 2022 · 3 comments · Fixed by #10813
Closed

Controls file format does not prevent using unsupported parameters #9772

ggbecker opened this issue Nov 7, 2022 · 3 comments · Fixed by #10813
Assignees
Labels
enhancement General enhancements to the project. Infrastructure Our content build system
Milestone

Comments

@ggbecker
Copy link
Member

ggbecker commented Nov 7, 2022

Description of problem:

Controls file format does not support usage of rule parameter although it's being used by some of the control files in the project:

controls/cis_sle_15.yml:
  1566      status: automated
  1567:     rule:
  1568        - file_groupowner_at_allow

  1749      status: automated
  1750:     rule:
  1751        - sshd_enable_warning_banner

  2199      status: automated
  2200:     rule:
  2201        - group_unique_id

controls/cis_sle12.yml:
  1397      automated: yes
  1398:     rule:
  1399      - file_groupowner_at_allow

  1581      automated: yes
  1582:     rule:
  1583      - sshd_enable_warning_banner

The function below parses the parameters but does not warn the user in case some unsupported parameter is being used:

def from_control_dict(cls, control_dict, env_yaml=None, default_level=["default"]):

This basically means that the rules under rule will not be processed. The function needs to be extended to restrict which parameters are accepted and throw an error in case something that is not in the list is being used.

@ggbecker ggbecker added the Infrastructure Our content build system label Nov 7, 2022
@yuumasato
Copy link
Member

When loading content that uses classes based on XCCDFEntity, like Rule for example, unparsed data is flagged out during build time:

"Unparsed YAML data in '{yaml_file}': {keys}"

@marcusburghardt
Copy link
Member

marcusburghardt commented Nov 8, 2022

There are profiles using automated: and maybe other parameter before the definition of the status parameter. Therefore, they are not wrong but just outdated and, for compatibility purposes, should not be restricted now. In fact, the respective control files should be updated before restricting parameters which were used in the past but there is a current replacement.

Instead of restricting this now and triggering a wave of errors, I would recommend to simply alert about this but keep accepting until we are sure all control files are updated.

@marcusburghardt marcusburghardt added the enhancement General enhancements to the project. label Nov 8, 2022
@ggbecker
Copy link
Member Author

There are profiles using automated: and maybe other parameter before the definition of the status parameter. Therefore, they are not wrong but just outdated and, for compatibility purposes, should not be restricted now. In fact, the respective control files should be updated before restricting parameters which were used in the past but there is a current replacement.

Instead of restricting this now and triggering a wave of errors, I would recommend to simply alert about this but keep accepting until we are sure all control files are updated.

Agree, but in case of rule, the parameter will not get loaded and rules will not be present in the built profile, which is a major issue.

Mab879 added a commit to Mab879/content that referenced this issue Jul 7, 2023
@Mab879 Mab879 self-assigned this Jul 7, 2023
@Mab879 Mab879 added this to the 0.1.69 milestone Jul 7, 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 a pull request may close this issue.

4 participants