fix(test): use well-known SID for Windows locale compatibility

The icacls command was failing on non-English Windows because
the "Everyone" group name is localized (e.g., "Todos" in Spanish).
Using the well-known SID *S-1-1-0 works on all Windows locales.
This commit is contained in:
lluviaoscuradeldoce-design 2026-01-29 16:30:35 -05:00
parent 33863591de
commit f712388584

View File

@ -800,8 +800,9 @@ describe("security audit", () => {
await fs.writeFile(includePath, "{ logging: { redactSensitive: 'off' } }\n", "utf-8"); await fs.writeFile(includePath, "{ logging: { redactSensitive: 'off' } }\n", "utf-8");
if (isWindows) { if (isWindows) {
// Grant "Everyone" write access to trigger the perms_writable check on Windows // Grant "Everyone" write access to trigger the perms_writable check on Windows
// Use the well-known SID *S-1-1-0 for "Everyone" (works on all locales: English, Spanish, etc.)
const { execSync } = await import("node:child_process"); const { execSync } = await import("node:child_process");
execSync(`icacls "${includePath}" /grant Everyone:W`, { stdio: "ignore" }); execSync(`icacls "${includePath}" /grant *S-1-1-0:W`, { stdio: "ignore" });
} else { } else {
await fs.chmod(includePath, 0o644); await fs.chmod(includePath, 0o644);
} }
@ -815,18 +816,18 @@ describe("security audit", () => {
const user = "DESKTOP-TEST\\Tester"; const user = "DESKTOP-TEST\\Tester";
const execIcacls = isWindows const execIcacls = isWindows
? async (_cmd: string, args: string[]) => { ? async (_cmd: string, args: string[]) => {
const target = args[0]; const target = args[0];
if (target === includePath) { if (target === includePath) {
return {
stdout: `${target} NT AUTHORITY\\SYSTEM:(F)\n BUILTIN\\Users:(W)\n ${user}:(F)\n`,
stderr: "",
};
}
return { return {
stdout: `${target} NT AUTHORITY\\SYSTEM:(F)\n ${user}:(F)\n`, stdout: `${target} NT AUTHORITY\\SYSTEM:(F)\n BUILTIN\\Users:(W)\n ${user}:(F)\n`,
stderr: "", stderr: "",
}; };
} }
return {
stdout: `${target} NT AUTHORITY\\SYSTEM:(F)\n ${user}:(F)\n`,
stderr: "",
};
}
: undefined; : undefined;
const res = await runSecurityAudit({ const res = await runSecurityAudit({
config: cfg, config: cfg,