Repository navigation
The development trace store's temporary folder is private to its user - #2313
Merged
Merged
Conversation
A working directory without node_modules records traces under the system's temporary directory, in a folder named only after a hash of the working directory and created with default permissions. On a shared temporary directory another user could make that folder or a link first and read or redirect the traces. The folder's name now carries the user's id, it is created with mode 0700, and it is used only when it is a real folder owned by this user with no access for others. Otherwise the host records in a folder made by mkdtemp, and the one startup log line names both. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VjCSiB3Dk7BRBmjic6wFM5
marvin-bitterlich
enabled auto-merge
November 18, 2026 16:21
Coverage 91.9% (−0.1 pts) · Patch 16.7%15 of 18 added lines are not covered, in 2 files. Uncovered added lines
Components ·
|
| Component | Coverage | vs main |
|---|---|---|
@shivaedev/server |
94.1% | −1.3 pts |
@shivaedev/test-sql |
96.6% | −0.6 pts |
@shivaedev/test-story |
92.3% | −0.2 pts |
@shivaedev/sql |
93.7% | −0.1 pts |
1e45a1b (merged onto 64d4061) vs main at 64d4061 · updated Nov 18, 16:29 UTC · Full report
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.
Why?
#2298 gave a development host whose working directory has no
node_modulesa trace store under the system's temporary directory, inshivaedev-server-<hash of the working directory>/traces.db. Anyone who knows the working directory can work out that name. On a machine where users share/tmp, another user could make the folder first and read the traces, or put a link there and have the store written somewhere else. The folder was also created with the default mode, so others could read it.How?
The stable folder is now
shivaedev-server-<user id>-<hash>. The host creates it with mode0700and then looks at what holds the name, without following a link. It uses the folder only when all of these are true:Otherwise it records in a folder made by
mkdtemp, which is new and private every time. The one Info line at startup still names the store, and in that case also names the folder it refused:0700and used0700The stories use the existing
traceStoreLocationkit, which starts a real Node process with its ownTMPDIR. The kit gained verbs that open the folder to others, put a link in its place and hand it to another user, and readouts for the announced folder's owner and mode, the refused folder and the folder behind the link. On main, four of the six stories fail; thenode_modulesstory and "a second start records to the same store" pass there and guard what did not change.Decisions
lstatcheck,mkdtempas the fallback. No lock file, no per-user parent folder and no configuration.### Fixed. No API changes. The path changes once, fromshivaedev-server-<hash>toshivaedev-server-<user id>-<hash>; the store there starts empty and the old folder is left behind.Callouts
chown, which only root may do, so that story runs only as root and is skipped on a non-root CI runner). They did not exercise a second real user: no process without access tried to read the folder, so the kernel's enforcement of0700is taken as given.defaultTraceStorechanged fromEffect.synctoEffect.try, because creating a folder can fail. Its one caller already hadUnknownErrorin its error type from opening the database.Generated by Claude Code