GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(desktop): store Clerk tokens with owner-only permissions (#22190) by shuv1337 · Pull Request #345 · shuv1337/s2code

Conversation

@shuv1337

@shuv1337 shuv1337 commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Problem

Desktop Clerk stored sign-in tokens with @clerk/electron storage({ path: stateDir }). That adapter uses electron-store, and conf writes clerk-tokens.json with configFileMode 0o666, so the process umask never tightens it and the next write restores 0666. Another local user could read or replace the file.

This is a narrow security cherry-pick of upstream pingdotgg/t3code#22190 (bd9cc0a901). It is the first step in the phased plan, before any broader nightly sync (upstream v0.1.6-nightly.20261031.3956 @ d92c437 is not included). Do not merge this as part of a full upstream sync.

Change

Cherry-picked -x only bd9cc0a901 onto current main (42c296b48, Phase B through nightly 20261030.3940 / #343).

The store now lives in <stateDir>/clerk, created at 0700. Startup moves an existing clerk-tokens.json into that directory and sets it to 0600. The same mode is applied again after every storage read, write, and delete. A symlink directory or token file is rejected so chmod cannot follow it.

Fork desktop identity is preserved. The only conflict was createDesktopClerkBridge: this fork already passes environment.appVersion into the desktop scheme, and the security fix also needs userDataPath. Both arguments are kept. Publishable-key handling, product paths (shuv2code-v2), and deep-link schemes (shuv2code-dev / s2code-dev) are unchanged.

Files

  • apps/desktop/src/app/ClerkTokenStore.ts (new)
  • apps/desktop/src/app/ClerkTokenStore.test.ts (new)
  • apps/desktop/src/app/DesktopClerk.ts
  • apps/desktop/src/app/DesktopClerk.test.ts

Scope and approval

Security-only cherry-pick of the already-merged upstream fix for pingdotgg#22190 / pingdotgg#15143. No release, update, or desktop-identity changes, and no other nightly commits.

Verification

  • vp test run apps/desktop/src/app/ClerkTokenStore.test.ts apps/desktop/src/app/DesktopClerk.test.ts: 2 files, 27 passed (Linux). Upstream reported 25; this fork has two extra DesktopClerk cases.
  • vp fmt --check and vp lint on the four files: passed.
  • tsc --noEmit for @t3tools/desktop and @t3tools/scripts: passed (vp run check:changed typecheck).
  • vp run check:changed: format, lint, typecheck, and the two tests passed. Knip failed on pre-existing unused files/exports that are not in this diff (scripts/resolve-nightly-release.ts, marketing @fontsource-variable/inter, and unused exports in desktop/server/web/shared identity helpers).

Limitations, same as upstream: the mode unit test skips on win32, where Node's file mode only toggles the read-only attribute. electron-store still applies 0666 during the write; 0600 is restored immediately afterward, and the 0700 directory covers that interval. Checked on Linux only.

Model and harness: Grok 4.7 in a Cursor Cloud Agent.

Open in Web Open in Cursor 

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@macodev00 @maria-rcks
@shuv1337 @cursoragent
fix(desktop): store Clerk tokens with owner-only permissions (pingdot…
a7f8309
…gg#22190)

Co-authored-by: macodev00 <[email protected]>
Co-authored-by: maria-rcks <[email protected]>
(cherry picked from commit bd9cc0a)
Co-authored-by: shuv <[email protected]>
@shuv1337
shuv1337 merged commit 016e3ac into main Oct 31, 2026
4 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@cursor cursor Bot mentioned this pull request Oct 31, 2026
feat(voice): add two-way calls and dictation to clients #344
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@shuv1337 @macodev00
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.