Skip to content

Commit f1fa464

Browse files
committed
fix(test): narrow management-auth icacls stubs for real win32
Blanket timeout stubs passed on Linux because atomicWriteFile skips ACL when process.platform is not win32, but crashed startServer on Windows CI after the isolate suite finally reached these cases.
1 parent 2d82ddf commit f1fa464

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

tests/server-management-auth.test.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -480,12 +480,16 @@ describe("management and data-plane credential separation", () => {
480480
writeFileSync(join(testHome, "admin-api-token"), `${adminToken}\n`, { mode: 0o600 });
481481
process.env.USERNAME ??= "tester";
482482
setPlatformForTests("win32");
483+
// Timeout only directory hardens (grant ACE carries (OI)(CI)). File hardens
484+
// must succeed so startServer → saveConfig can atomic-write on real win32;
485+
// Linux CI skips that path via process.platform and hid the blanket-timeout
486+
// failure mode under isolate.
483487
setIcaclsRunnerForTests(args => {
484-
const target = args[0] ?? "";
485-
if (target.endsWith("admin-api-token")) {
486-
return { success: true, exitCode: 0, timedOut: false, stdout: "" };
488+
const grant = args.find(a => a.includes("(F)")) ?? "";
489+
if (grant.includes("(OI)(CI)")) {
490+
return { success: false, exitCode: null, timedOut: true, stdout: "" };
487491
}
488-
return { success: false, exitCode: null, timedOut: true, stdout: "" };
492+
return { success: true, exitCode: 0, timedOut: false, stdout: "" };
489493
});
490494
resetHardenedStateForTests();
491495
const state = initializeManagementAuthState(remoteConfig());
@@ -549,7 +553,16 @@ describe("management and data-plane credential separation", () => {
549553
saveConfig(remoteConfig());
550554
process.env.USERNAME ??= "tester";
551555
setPlatformForTests("win32");
552-
setIcaclsRunnerForTests(() => ({ success: false, exitCode: null, timedOut: true, stdout: "" }));
556+
// Env-token init never touches admin-api-token. Time out only that file so a
557+
// broken file-backed ACL cannot be what made management available; allow
558+
// other file hardens so startServer → saveConfig works on real win32.
559+
setIcaclsRunnerForTests(args => {
560+
const target = args[0] ?? "";
561+
if (target.includes("admin-api-token") || target.includes(".admin-token.tmp")) {
562+
return { success: false, exitCode: null, timedOut: true, stdout: "" };
563+
}
564+
return { success: true, exitCode: 0, timedOut: false, stdout: "" };
565+
});
553566
resetHardenedStateForTests();
554567

555568
const state = initializeManagementAuthState(remoteConfig());

0 commit comments

Comments
 (0)