fix(claude-extension): enforce private permissions for settings writes (#1378)

This commit is contained in:
Kai (Tam Nhu) Tran authored and GitHub committed 2026-05-23 21:45:07 -04:00
1 parent 210ab761e2
commit 0db9705d75
2 files changed
+14 -2

No files matched your search

@@ -231,8 +231,12 @@ function writeJsonDocument(
const tempPath = `${filePath}.tmp.${uniqueFileNonce()}`;
try {
fs.writeFileSync(tempPath, JSON.stringify(data, null, 2) + '\n', 'utf8');
fs.writeFileSync(tempPath, JSON.stringify(data, null, 2) + '\n', {
encoding: 'utf8',
mode: 0o600,
});
fs.renameSync(tempPath, filePath);
fs.chmodSync(filePath, 0o600);
} catch (error) {
if (fs.existsSync(tempPath)) {
fs.rmSync(tempPath, { force: true });