Merge main safeguards and verify startup resource improvements
This commit is contained in:
commit
95dd4dc8fd
19 files changed
+194
-33
No files matched your search
@@ -26,10 +26,13 @@ test('native ACL policy accepts only the current owner and one protected inherit
|
||||
$extra=Make-Acl $true $sid 'FullControl' 'ContainerInherit,ObjectInherit' 'None' 'Allow' $sid
|
||||
$extra.AddAccessRule((New-Object System.Security.AccessControl.FileSystemAccessRule($other,'Read','ContainerInherit,ObjectInherit','None','Allow')))
|
||||
$rows+=(Test-PrivateDirectoryAcl $extra $sid)
|
||||
$hidden=New-Object System.Security.AccessControl.DirectorySecurity
|
||||
$hidden.SetSecurityDescriptorSddlForm('O:'+$sid.Value+'D:P(A;OICI;FA;;;'+$sid.Value+')(OA;OICI;FA;00000000-0000-0000-0000-000000000001;;WD)')
|
||||
$rows+=(Test-PrivateDirectoryAcl $hidden $sid)
|
||||
ConvertTo-Json -Compress -InputObject $rows
|
||||
`;
|
||||
const output=cp.execFileSync('powershell.exe',['-NoLogo','-NoProfile','-NonInteractive','-Command','$ErrorActionPreference="Stop";'+privateDirectoryAcl+cases],{encoding:'utf8',windowsHide:true,timeout:15000});
|
||||
assert.deepEqual(JSON.parse(output),[true,false,false,false,false,false,false,false,false]);
|
||||
assert.deepEqual(JSON.parse(output),[true,false,false,false,false,false,false,false,false,false]);
|
||||
});
|
||||
|
||||
test('a compliant real directory is not rewritten and an unprotected directory is repaired',{skip:process.platform!=='win32'},t=>{
|
||||
@@ -40,4 +43,7 @@ test('a compliant real directory is not rewritten and an unprotected directory i
|
||||
run('$p=[Console]::In.ReadToEnd();$acl=[IO.Directory]::GetAccessControl($p);$acl.SetAccessRuleProtection($false,$true);[IO.Directory]::SetAccessControl($p,$acl)');
|
||||
run(secureDirectoryScript);
|
||||
const verified=run(privateDirectoryAcl+';$p=[Console]::In.ReadToEnd();Test-PrivateDirectoryAcl ([IO.Directory]::GetAccessControl($p)) ([System.Security.Principal.WindowsIdentity]::GetCurrent().User)');assert.equal(verified,'True');
|
||||
run('$p=[Console]::In.ReadToEnd();$sid=[System.Security.Principal.WindowsIdentity]::GetCurrent().User;$acl=New-Object System.Security.AccessControl.DirectorySecurity;$acl.SetSecurityDescriptorSddlForm("O:"+$sid.Value+"D:P(A;OICI;FA;;;"+$sid.Value+")(OA;OICI;FA;00000000-0000-0000-0000-000000000001;;WD)",[System.Security.AccessControl.AccessControlSections]"Access,Owner");[IO.Directory]::SetAccessControl($p,$acl)');
|
||||
assert.equal(run(privateDirectoryAcl+';$p=[Console]::In.ReadToEnd();Test-PrivateDirectoryAcl ([IO.Directory]::GetAccessControl($p)) ([System.Security.Principal.WindowsIdentity]::GetCurrent().User)'),'False');
|
||||
run(secureDirectoryScript);assert.equal(run(privateDirectoryAcl+';$p=[Console]::In.ReadToEnd();Test-PrivateDirectoryAcl ([IO.Directory]::GetAccessControl($p)) ([System.Security.Principal.WindowsIdentity]::GetCurrent().User)'),'True');
|
||||
});
|
||||
Reference in new issue
Block a user