Skip to content

fix(sessions): preserve 0600 permissions on sessions.json writes - #1049

Merged
steipete merged 1 commit into
openclaw:mainfrom
YuriNachos:fix/issue-1020-sessions-perms
Jan 17, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
YuriNachos:fix/issue-1020-sessions-perms

Conversation

@YuriNachos

Copy link
Copy Markdown
Contributor

Summary

Fixes #1020

sessions.json permissions revert to 644 after normal writes, so clawdbot security audit keeps warning that the store is readable by others even after fixing to 600.

Root Cause

saveSessionStoreUnlocked writes a temp file and rename()s it into place, but never restores permissions. The temp file is created with default permissions (umask 022), so the final file ends up 644.

Fix

After write/rename, the fix now calls fs.chmod(storePath, 0o600) to ensure permissions persist at 0600.

Testing

  • Reproduced: chmod 600 sessions.json, send message (triggers write), file becomes 644
  • After fix: chmod 600 sessions.json, send message, file stays at 600
  • Security audit no longer shows false positive warnings

Files Changed

  • src/config/sessions/store.ts: Added fs.chmod(storePath, 0o600) after write/rename

Checklist

  • Code follows project style guidelines
  • Tested locally with my Clawdbot instance
  • Keeps PR focused (single fix)

🤖 AI-assisted PR

  • Developed with assistance from Claude (Anthropic AI)
  • Testing: Light testing (manual verification)
  • I understand what the code does: this fix ensures secure file permissions persist

@steipete steipete self-assigned this Jan 16, 2026
steipete added a commit that referenced this pull request Jan 17, 2026
@steipete
steipete merged commit 6280305 into openclaw:main Jan 17, 2026
@steipete

Copy link
Copy Markdown
Contributor

Landed via temp rebase onto main.\n\n- Gate: pnpm lint && pnpm build && pnpm test\n- Land commit: 1f9a96d\n- Merge commit: 6280305\n\nThanks @YuriNachos!

dustin-olenslager pushed a commit to dustin-olenslager/ironclaw-supreme that referenced this pull request Mar 24, 2026
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
…ons-perms

fix(sessions): preserve 0600 permissions on sessions.json writes
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
…ons-perms

fix(sessions): preserve 0600 permissions on sessions.json writes
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
zeekay pushed a commit to Dream-AI-4444/bot that referenced this pull request Sep 11, 2026
…ons-perms

fix(sessions): preserve 0600 permissions on sessions.json writes
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
lhfer pushed a commit to lhfer/openclaw that referenced this pull request Oct 11, 2026
…ons-perms

fix(sessions): preserve 0600 permissions on sessions.json writes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sessions.json perms revert to 644 after writes (missing chmod in save)

2 participants