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

Unexpected Behavior When Controls in an overlay Profile are Created as Multiple Files #6908

Open
christopher-m-hosmer opened this issue Dec 11, 2023 · 0 comments

Comments

@christopher-m-hosmer
Copy link

Bug

When Controls in an overlay Profile are created as multiple files, e.g. one Control per file, InSpec does not define the correct number of Controls nor the correct number of Tests.

Bottom Line Up Front (BLUF)

+ Profile Single File Overlay Multiple File Overlay
Single File Underlay Works Not Working
Multiple File Underlay Works Not Working

The same results occur on:

  • CentOS 7.9 using inspec 5.22.29 and cinc-auditor 6.6.0
  • RHEL 9.3 using inspec 5.22.36 and cinc-auditor 6.6.0

Possible Fix

Support for multiple Control files is shown in InSpec's documentation "Chef InSpec" -> "Profiles" -> "About Profiles" -> "Profile structure" and reinforced by the fact that Controls are contained in a directory instead of a single file in the Profile root directory. Whether the Profile is used as a underlay or overlay should not restrict the structure of the Profile.

Background

In the test scenario the underlay defines basic Control metadata properties. The overlay takes advantage of InSpec's capability to modify Control properties. The overlay adds or modifies properties, such as impact, and then defines the tests in the describe block.

As documented in the "Chef InSpec" -> "Profiles" -> "Dependencies" -> "Selectively include controls" section, the require_controls "command selectively include(s) certain controls from an included profile." The expected behavior is that each time that the require_controls command is executed that the defined Controls are added to a list of Controls to execute. Instead, multiple calls on the command seem to overwrite or corrupt the list of Controls and Tests to execute.

Bug Test Usage

  • Unzip the attached archive.
    InSpec-Overlay-Bug_2023-12-11.zip

  • Execute bash ./Test-All.sh to run all four permutations of the test.

  • Modify the engine variable in the Test-All.sh script to change between using inspec and cinc-auditor for the tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants