Repository navigation
fix(security): the Studio automation discovery file is written by the one writer of secret files, with its checks - #774
Merged
Conversation
… one writer of secret files, with its checks Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NxVy8Kr2nZk8HoMNcxZPFF
… test Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NxVy8Kr2nZk8HoMNcxZPFF
…mporary files are cleaned; the limits are stated Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NxVy8Kr2nZk8HoMNcxZPFF
…t write; the guards of Remove are tested Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NxVy8Kr2nZk8HoMNcxZPFF
# Conflicts: # CHANGELOG.md
jay23606
added a commit
to jay23606/flutter-probe
that referenced
this pull request
Nov 17, 2026
… one writer of secret files, with its checks (AlphaWaveSystems#774) ## Summary Finding 4 of the IDE transport note. The discovery file holds the automation token. Studio made its folder 0700 and wrote the file 0600 but did not re-check an existing folder or file, did not refuse a link, and fell back to the system temp folder with no user config folder. `probe-mcp --http` already did all of that for its token file in `writeTokenFile`. - New `internal/secretfile` is the one writer, moved from `writeTokenFile` with its refusals unchanged and one addition: a folder or file that belongs to another user is refused too. `probe-mcp --http` is now a thin wrapper over it (its tests are unchanged and pass). - Studio's discovery file uses it. For a file named by `PROBE_STUDIO_AUTOMATION_FILE` the folder is the person's own (their home folder may be 0755), so it must only be a real folder, theirs, not writable by others; the default folder must be private (0700). The file itself is always 0600, written by rename. - No temp-folder fallback: with no user config folder and no named file the endpoint does not start, and the error says to set `PROBE_STUDIO_AUTOMATION_FILE`. - On exit a server removes the file only while it holds its own document. ## Tests and mutants `secretfile` table tests (existing file open to others, file link, dangling link, not a regular file, private folder open, folder link, another user's folder and file via a seam, a shared folder writable by others, replaced flag, no temp file left, Remove only its own), and Studio tests through `startAutomation` (a link or open file refused and the target untouched, a folder link or writable folder refused, a readable named folder accepted with a 0600 file, no config folder leaves the temp folder empty, a stale file replaced and only own removed). Eleven mutants killed: each check removed or inverted, written in place instead of renamed, the temp fallback back, Close removing another server's file. ## Test plan - [x] `go test -race ./internal/secretfile ./internal/mcp ./studio` - [x] Windows build of `internal/secretfile` - [x] disclosure scan
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.
Summary
Finding 4 of the IDE transport note. The discovery file holds the automation token. Studio made its folder 0700 and wrote the file 0600 but did not re-check an existing folder or file, did not refuse a link, and fell back to the system temp folder with no user config folder.
probe-mcp --httpalready did all of that for its token file inwriteTokenFile.internal/secretfileis the one writer, moved fromwriteTokenFilewith its refusals unchanged and one addition: a folder or file that belongs to another user is refused too.probe-mcp --httpis now a thin wrapper over it (its tests are unchanged and pass).PROBE_STUDIO_AUTOMATION_FILEthe folder is the person's own (their home folder may be 0755), so it must only be a real folder, theirs, not writable by others; the default folder must be private (0700). The file itself is always 0600, written by rename.PROBE_STUDIO_AUTOMATION_FILE.Tests and mutants
secretfiletable tests (existing file open to others, file link, dangling link, not a regular file, private folder open, folder link, another user's folder and file via a seam, a shared folder writable by others, replaced flag, no temp file left, Remove only its own), and Studio tests throughstartAutomation(a link or open file refused and the target untouched, a folder link or writable folder refused, a readable named folder accepted with a 0600 file, no config folder leaves the temp folder empty, a stale file replaced and only own removed). Eleven mutants killed: each check removed or inverted, written in place instead of renamed, the temp fallback back, Close removing another server's file.Test plan
go test -race ./internal/secretfile ./internal/mcp ./studiointernal/secretfile🤖 Generated with Claude Code
https://claude.ai/code/session_01NxVy8Kr2nZk8HoMNcxZPFF