Read inherited Idunn descriptors directly

This commit is contained in:
Meta Vens 2026-09-28 00:35:15 +02:00
commit 5697802dbf
2 changed files with 3 additions and 4 deletions

View file

@ -605,8 +605,7 @@ export function systemdListenPidMatches(listenPid: string | undefined, processPi
}
function readDescriptor(descriptor: number): Buffer {
const fdPath = `/proc/self/fd/${descriptor}`;
return fs.readFileSync(fdPath);
return fs.readFileSync(descriptor);
}
function privateKeyFromSeed(seed: Uint8Array): crypto.KeyObject {

View file

@ -100,8 +100,8 @@ test("opens Idunn's machine-bound identity and signs the exact Expected incarnat
process.env.LISTEN_FDNAMES = "gamecult-idunn-runtime-activation-key:gamecult-runtime-presence-identity";
const realReadFileSync = fs.readFileSync.bind(fs);
mock.method(fs, "readFileSync", (filePath: fs.PathOrFileDescriptor, ...args: unknown[]) => {
if (filePath === "/proc/self/fd/3") return activationSeed;
if (filePath === "/proc/self/fd/4") return providerCredential;
if (filePath === 3) return activationSeed;
if (filePath === 4) return providerCredential;
if (filePath === "/etc/machine-id") return machineId;
return realReadFileSync(filePath as never, ...args as never[]);
});