fix(desktop): Keep the Clerk token file owner-only#37

draft1
personal/ios-signing
personal/clerk-token-file-mode
openedSep 29, 2026byMMike Olson
View on GitHubTwo-way sync enabledPR last imported 4h ago

What Changed

The desktop app now writes clerk-tokens.json with mode 0600 instead of 0666, and tightens an existing world-writable token file to 0600 when the app starts. The change is a pnpm patch to @clerk/electron@0.0.44.

Why

Clerk's Electron storage saves tokens through electron-store, whose writer explicitly chmods the file to 0666 on every write, so the user's umask never applies. The token itself is encrypted with the OS keystore, but a world-writable file lets another local account replace it. The storage adapter accepts unencrypted raw: values, so a planted token would sign the app into someone else's account.

Known Limitations

This is a stopgap until Clerk sets the mode in @clerk/electron itself. The patch is pinned to 0.0.44, so a Clerk upgrade will fail to install until the patch is dropped or refreshed.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Added 1 commit

  • fix(desktop): Keep the Clerk token file owner-onlydcd750b