fix(sandbox): clear failed ACL temp state
This commit is contained in:
@@ -324,6 +324,7 @@ export class AclSandbox {
|
||||
this.token = undefined
|
||||
this.writeSidPtr = undefined
|
||||
this.tempWriteSidPtr = undefined
|
||||
this.tempDirResolved = undefined
|
||||
this.grantedPaths = []
|
||||
if (cleanupFailures.length > 0) {
|
||||
throw new AggregateError(
|
||||
|
||||
@@ -98,4 +98,13 @@ describe.skipIf(!isWin32 || !pwshAvailable())('AclSandbox write restriction', ()
|
||||
const broken = new AclSandbox({ writableDirs: [writableDir], tempDir: null, writeSid: 'S-1-4-abc-1', mode: 'workspace-write' })
|
||||
await expect(broken.init()).rejects.toThrow(/ConvertStringSidToSidW/u)
|
||||
}, 15_000)
|
||||
|
||||
it('failed init clears provisional temp state before a retry', async () => {
|
||||
const broken = new AclSandbox({ writableDirs: [writableDir], tempDir: null, writeSid: 'S-1-4-abc-1', mode: 'workspace-write' })
|
||||
const provisionalState = broken as unknown as { tempDirResolved: string | undefined }
|
||||
provisionalState.tempDirResolved = isolatedTemp
|
||||
|
||||
await expect(broken.init()).rejects.toThrow(/ConvertStringSidToSidW/u)
|
||||
expect(broken.tempDir).toBeUndefined()
|
||||
}, 15_000)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user