فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
test(a02): assert owner-local SQL resume rejects public-readable BAK ACL without touching owner files
davoodmehraban89 committed
Oct 30, 2026 at 23:04 UTC
2b6282e6a6f3daf0acff3bfdf1769e08f84ede0a
1 file changed
+21
scripts/a02-private-owner-local-lab.ps1
+21
@@ -168,6 +168,27 @@ if($Mode -eq 'Test'){
168
try{Assert-ManifestDestination $unsafe}catch{$blocked=$true}
169
Require $blocked 'A02_SELFTEST_MANIFEST_PATH_ESCAPE_ACCEPTED'
170
}
171
+ # Test the resume ACL gate IN MEMORY: never open owner staging paths
172
+ # and never persist an insecure access rule.
173
+ $acl=[Security.AccessControl.FileSecurity]::new()
174
+ $acl.SetAccessRuleProtection($true,$false)
175
+ $current=[Security.Principal.WindowsIdentity]::GetCurrent().User
176
+ $acl.SetOwner($current)
177
+ foreach($sidText in @($current.Value,'S-1-5-18','S-1-5-32-544') | Select-Object -Unique){
178
+ $sid=[Security.Principal.SecurityIdentifier]::new([string]$sidText)
179
+ $rule=[Security.AccessControl.FileSystemAccessRule]::new(
180
+ $sid,[Security.AccessControl.FileSystemRights]::FullControl,
181
+ [Security.AccessControl.AccessControlType]::Allow)
182
+ [void]$acl.AddAccessRule($rule)
183
+ }
184
+ Assert-A02StagedAcl $acl
185
+ $everyone=[Security.Principal.SecurityIdentifier]::new('S-1-1-0')
186
+ [void]$acl.AddAccessRule([Security.AccessControl.FileSystemAccessRule]::new(
187
+ $everyone,[Security.AccessControl.FileSystemRights]::Read,
188
+ [Security.AccessControl.AccessControlType]::Allow))
189
+ $blocked=$false
190
+ try{Assert-A02StagedAcl $acl}catch{$blocked=$true}
191
+ Require $blocked 'A02_SELFTEST_BROAD_PUBLIC_BAK_ACL_ACCEPTED'
192
[pscustomobject]@{
193
status='private-lab-synthetic-orchestration-passed'
194
checks=$tests.Count;ownerBackupUsed=$false;sqlServerInstalled=$false