Sessions: reassert mirrored transcript permissions

This commit is contained in:
Vincent Koc 2026-03-07 09:42:36 -08:00
parent bbc3bd9cf2
commit da5770df67

View File

@ -79,6 +79,14 @@ async function ensureSessionHeader(params: {
});
}
async function hardenSessionFilePermissions(sessionFile: string): Promise<void> {
try {
await fs.promises.chmod(sessionFile, 0o600);
} catch {
// Best-effort on platforms without POSIX chmod support.
}
}
export async function appendAssistantMessageToSessionTranscript(params: {
agentId?: string;
sessionKey: string;
@ -152,6 +160,7 @@ export async function appendAssistantMessageToSessionTranscript(params: {
stopReason: "stop",
timestamp: Date.now(),
});
await hardenSessionFilePermissions(sessionFile);
emitSessionTranscriptUpdate(sessionFile);
return { ok: true, sessionFile };