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

V-73391 Performs Excessive Iterations #46

Closed
slipthebit opened this issue Mar 18, 2021 · 1 comment
Closed

V-73391 Performs Excessive Iterations #46

slipthebit opened this issue Mar 18, 2021 · 1 comment

Comments

@slipthebit
Copy link
Contributor

V-73391 performs excessive iterations as a result of two factors: describe.one blocks around each describe block, and acl_rule looping within each describe set. This results in each acl_rule being evaluated against every describe set causing multiple failures for each acl_rule.

    describe.one do
      acl_rules.each do |acl_rule|
        describe "Audit rule property for principal: #{acl_rule['IdentityReference']}" do
          subject { acl_rule }
          its(['AuditFlags']) { should cmp "Fail" }
          its(['IdentityReference']) { should cmp "Everyone" }
          its(['ActiveDirectoryRights']) { should cmp "GenericAll" }
          its(['InheritanceFlags']) { should cmp "None" }
          its(['InheritanceType']) { should cmp "None" }
          its(['PropagationFlags']) { should cmp "None" }
        end
      end
    end

    describe.one do
      acl_rules.each do |acl_rule|
        describe "Audit rule property for principal: #{acl_rule['IdentityReference']}" do
          subject { acl_rule }
          its(['AuditFlags']) { should cmp "Success" }
          its(['IdentityReference']) { should cmp "Everyone" }
          its(['ActiveDirectoryRights']) { should cmp "WriteProperty" }
          its(['InheritanceFlags']) { should cmp "ContainerInherit" }
          its(['InheritanceType']) { should cmp "All" }
          its(['PropagationFlags']) { should cmp "None" }
        end
      end
    end

    describe.one do
      acl_rules.each do |acl_rule|
        describe "Audit rule property for principal: #{acl_rule['IdentityReference']}" do

https://docs.chef.io/inspec/dsl_inspec/#describeone-usage-notes

Suggested resolution:
A single describe.one block should encapsulate all of the describe sets, and the acl_rules loop be moved outside the describe.one block. This would ensure each acl_rule matches one of the describe sets or fail.

slipthebit added a commit to slipthebit/microsoft-windows-server-2016-stig-baseline that referenced this issue Mar 18, 2021
…n to one. Moved acl_rules outside of describe.one block.
@slipthebit
Copy link
Contributor Author

Reevaluating issue.

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

No branches or pull requests

1 participant