Replace NodeJS dict aliases with maps and named field reads
This commit is contained in:
@@ -25,14 +25,14 @@ function runAs(
|
||||
selected: RuntimeProfile,
|
||||
command: string,
|
||||
args: string[],
|
||||
env?: NodeJS.ProcessEnv,
|
||||
env?: ReadonlyMap<string, string>,
|
||||
): SpawnSyncReturns<string> {
|
||||
return spawnSync(command, args, {
|
||||
cwd: "/",
|
||||
uid: selected.uid,
|
||||
gid: selected.gid,
|
||||
encoding: "utf8",
|
||||
...(env !== undefined && { env }),
|
||||
...(env !== undefined && { env: Object.fromEntries(env) }),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -104,9 +104,12 @@ test.skipIf(!IS_ROOT)("cleanup leaves no runnable daemonized process", async ()
|
||||
|
||||
test.skipIf(!IS_ROOT)("the agent process cannot read its coordinator environment", () => {
|
||||
const selected = profile(20_020, "/tmp");
|
||||
const result = runAs(selected, "/usr/bin/cat", [`/proc/${process.pid}/environ`], {
|
||||
PARENT_SECRET: "must-not-cross-boundary",
|
||||
});
|
||||
const result = runAs(
|
||||
selected,
|
||||
"/usr/bin/cat",
|
||||
[`/proc/${process.pid}/environ`],
|
||||
new Map([["PARENT_SECRET", "must-not-cross-boundary"]]),
|
||||
);
|
||||
|
||||
expect(result.status).not.toBe(0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user