fix(security): set 0o600 on remaining session file write paths

Follow-up to #18066 — three session file write sites were missed:

- auto-reply/reply/session.ts: forked session transcript header
- pi-embedded-runner/session-manager-init.ts: session file reset
- gateway/server-methods/sessions.ts: compacted transcript rewrite

All now use mode 0o600 consistent with transcript.ts and chat.ts.
This commit is contained in:
Xinhua Gu
2026-02-16 18:32:34 +01:00
committed by Peter Steinberger
parent d4c057f8c1
commit ae0b110e44
3 changed files with 9 additions and 3 deletions

View File

@@ -89,7 +89,10 @@ function forkSessionFromParent(params: {
cwd: manager.getCwd(),
parentSession: parentSessionFile,
};
fs.writeFileSync(sessionFile, `${JSON.stringify(header)}\n`, "utf-8");
fs.writeFileSync(sessionFile, `${JSON.stringify(header)}\n`, {
encoding: "utf-8",
mode: 0o600,
});
return { sessionId, sessionFile };
} catch {
return null;