fix(local): stop the database being readable by other accounts on the machine - #1594
Open
GeiserX wants to merge 1 commit into
Open
fix(local): stop the database being readable by other accounts on the machine#1594GeiserX wants to merge 1 commit into
GeiserX wants to merge 1 commit into
Conversation
… machine auth.json and server-connections.json are written 0600. The database beside them is created by SQLite with the process umask, so on a default macOS or Linux install it lands at 0644, along with its -wal and -shm sidecars. It is not the less sensitive of the two. It holds live PKCE verifiers, health-check response samples, artifact previews, and — for stdio MCP integrations created before the auth-method revamp — plaintext secret env. chmod on open rather than on create, so a database written by an earlier version is tightened too. Best-effort per file: a filesystem without POSIX modes must not stop the server booting over a permission it cannot set.
This was referenced Aug 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
On a default macOS or Linux install, the local database is readable by every other account on the machine. The two secret files sitting next to it are not.
That is from a real
~/.executor, not a constructed case.auth.jsonandserver-connections.jsonget a deliberatechmodafter write; the database never got one, because SQLite creates its own files with the process umask.The database is not the less sensitive of the two. It holds:
oauth_session.pkce_verifier— a readable live verifier defeats PKCEconnection.last_health— response samples taken from the upstreamartifact.preview— a rendered artifact with its dataintegration.configWAL is on, so the
-walsidecar carries recently written rows too.The fix
chmodthe database and its sidecars to0600inopenLocalLibsql, which every on-disk open path already routes through.On open rather than on create, so a database written by an earlier version gets tightened too — same reasoning as the
mode+chmodpair already inwriteToken, sincemodeonly applies at creation. Best-effort per file, so a filesystem without POSIX modes cannot stop the server booting over a permission it cannot set.How I tested it
Not just that the suite is green — I checked the tests can go red.
bun run testinapps/local: 75 passed, 14 files.openLocalLibsqlagainst a real file and assert onstatSync, because the property is what the filesystem ends up holding.chmodthat silently stopped running would still look green on a machine with a strict umask.chmodcall (keeping it compiling) and re-ran. Exactly the two tests that assert the fix went red; the control and the in-memory test correctly stayed green.oxlinton both changed files: 0 warnings, 0 errors.tsgo --noEmit: clean.The upgrade case has its own test — it seeds a
0644database first, then opens it, because that is the state every existing install is in today.