Repository navigation
Conversation
On Linux, `vp run` wrote the fspy preload library and the
`vt_client_napi` addon to `/tmp/fspy` and `/tmp/vt_client_napi`, which
belong to whoever created them first. Another user running a different
version couldn't write there, and the same version used files the first
user could replace.
- `vt_materialized_artifact::user_temp_dir` returns `{temp}/{name}-{uid}`
on Unix, created with mode 0o700. An existing path has to be a
directory, not a symlink, owned by the current user and not writable
by anyone else. On Windows, the temp folder is already the user's own,
so it returns `{temp}\{name}`.
- `Materialize::at` no longer reconciles an existing file's mode, which
followed symlinks: no one else can write to the folder. Only
executables get an explicit mode, 0o755.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wan9chi
force-pushed
the
claude/user-temp-artifacts
branch
from
November 6, 2026 01:31
2c464cf to
dd39680
Compare
fspy benchmarklinuxmacoswindows |
This branch has not been deployed
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.
Motivation
vp runwrites the fspy preload library and thevt_client_napiaddon to thefspyandvt_client_napifolders in the system temp directory. On Linux that directory is/tmp, which every user shares, so those folders belong to whoever ranvp runfirst. Another user running a different version can't write there, so their tracked tasks fail to start. Running the same version, they use files the first user could replace.vp run --json, the next PR in this stack, writes its JSON Schema the same way, which is where this came up.Changes
vt_materialized_artifact::user_temp_dir(name)returns a folder in the system temp directory that only the current user can write to:{temp}/{name}-{uid}, created with mode0700. An existing path must be a directory, not a symlink, that the current user owns and that nobody else can write to; otherwise it's an error. On macOS, the temp directory is already per user, so only the folder name changes.{temp}\{name}, since the temp directory is already the user's own.vt_client_napiaddon materialize there.Materialize::atno longer resets the mode of an existing file. Thatchmodfollowed symlinks, and with a folder nobody else can write to, there's no drift to fix. Only executables get an explicit mode (0755). Other files keep the0600that new temp files get.🤖 Generated with Claude Code
Note
Medium Risk
Changes where security-sensitive embedded binaries (fspy preload, NAPI addon) are written and adds Unix permission checks that must be correct for runs to start safely on multi-user systems.
Overview
On Linux shared
/tmp, helper files thatvp runmaterializes (fspy’s preload library and thevt_client_napiaddon) no longer land in world-visible folders like/tmp/fspy. They now useuser_temp_dir, which creates{temp}/{name}-{uid}with mode0700on Unix and rejects symlinks or directories other users can write to; Windows keeps{temp}\{name}because the temp dir is already per-user.fspy and
napi_client_pathcall that helper instead of manually creating shared temp subdirs.Materialize::atassumes the target directory is user-private: it stops reconciling modes on existing files (avoidingchmodthrough symlinks) and only sets0755when creating new executable artifacts; other new files stay at the temp file default (0600).Unit tests cover directory creation, symlink rejection, and world-writable directory rejection on Unix.
Reviewed by Cursor Bugbot for commit dd39680. Bugbot is set up for automated code reviews on this repo. Configure here.