mcollera / AccessControlDsc

MIT License
13 stars 12 forks source link

NTFSAccessControl Refactoring and fix for bug #46 - NTFSAccessControlEntry - False Positive Test Bug #47

Closed bcwilhite closed 5 years ago

bcwilhite commented 5 years ago

Code clean up and refactoring as well as fix for bug #46

Bug #46:

When Force and ForcePrincipal parameters are set to false and Inheritance/Propagation Flags are not equal to the currently defined ACE, the Test-TargetResource function will return $false for "InDesiredState". Because of this issue, the Set-TargetResource Function is run unnecessarily, as well as the configuration is never compliant/in desired state.

To Reproduce

On the target machine, modify an NTFS permission rule outside of the default setting and/or outside what the current configuration specifies. Furthermore, a principal can be defined via a configuration to have 1 set as the InheritanceFlags, but the actual ACE for the specific principal is 3, when this scenario occurs, the Test-TargetResource will return false and the Set runs. When the Set-TargetResource function runs, it sets the ACE to 1, however, since the principal already has 3, it has more than what is needed so nothing technically happens. Create a Member Server configuration and apply it to a target machine. When you run the configuration over and over again, note that it's never in the desired state, even though the Set-TargetResource function is executed.

Expected behavior

The Set-TargetResource should not run in this scenario since the specified rule is already applied via an ACE granting common Inheritance/Propagation Flags.

codecov-io commented 5 years ago

Codecov Report

Merging #47 into Dev will decrease coverage by 1%. The diff coverage is 68%.

Impacted file tree graph

@@        Coverage Diff        @@
##           Dev   #47   +/-   ##
=================================
- Coverage   54%   52%   -2%     
=================================
  Files        5     5           
  Lines      999   965   -34     
=================================
- Hits       545   511   -34     
  Misses     454   454