Repository navigation
fix(harness): keep prompt history and run logs private to the user - #3164
Merged
Merged
Conversation
On unix, sessions/, projects/, data/ and run/ under RIG_HOME are made 0700, best effort, before anything is written under them. RIG_HOME's own mode and the modes of files are unchanged.
Setting a mode follows links and ran after a failed create_dir_all, so a link back to the home made the home 0700 and a file in a directory's place changed mode. A link to a directory elsewhere is still tightened.
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.
fix(harness): keep prompt history and run logs private to the user
Description
Prompt history (
projects/<project>/tui/history.jsonl) and the logs of failed runs (underrun/) were created with ordinary modes in ordinary directories, so on a shared machine another local user could read them. #3137 tightened onlysessions/. This widens the same best-effort rule to the four directories that hold what the user said, and leaves the rest ofRIG_HOMEalone.What users see change
On unix:
sessions/,projects/,data/andrun/underRIG_HOMEare mode 0700 once rig has started, on a fresh home and on an existing home whose directories were 0755.sessions/already was.RIG_HOMEitself, is left as it was.RIG_HOME's own mode does not change, and neither do the modes of files. Other entries underRIG_HOME, such asbin/andsettings.toml, keep their modes.Windows and wasm: nothing changes.
Public API
One additive method on
rig_harness_protocol::Home. Nothing else in the public API changes.Before: no such method. The chmod of
sessions/was written out inHome::new_sessionand again inpaths_in.After:
It is called from
Home::new_session,paths_in(still guarded bydescribing()) and the launcher'shold_run, before anything is written under those directories.Changelog
sessions/,projects/,data/andrun/underRIG_HOMEare made private to the user (0700, best effort), so another local user cannot read prompt history or failed-run logs. AddsHome::keep_private.Migration
None.
Type of change
Testing
keep_private_tightens_the_four_directories_and_not_the_homeinrig-harness-protocol: covers an existing 0755 directory, a directory that was absent (created private), and a link to a 0755 directory elsewhere, each ending with no group or other bits. A second home hasprojectslinked to the home and a regular 0644 file atdata. Both homes stay 0755 and the file stays 0644. On the test commit it cannot compile, because the method is new. It passes on the head, and it fails with the directory and home check removed (the linked home and the file both become 0700).cargo xtask verify --affected --base origin/mainat this head on the build server: all 10 checks passed.keep_private_tightens_the_four_directories_and_not_the_homeLine deltas: production +19 / -8, tests +45 / -0. No existing test was changed.
Checklist:
CHANGELOG.mdorMIGRATING.md(they are generated at release)Notes
Not verified by the author: the change has not been driven in the real app, and the three call sites have no test of their own, so real-use testing covers them. No non-unix build was run locally. On those targets the
cfg(unix)loop drops out andkeep_privateis empty.The loop is entirely
cfg(unix), including itscreate_dir_all, so Windows does not gain three empty directories.paths_inkeeps its owncreate_dir_all(sessions)for that reason.Follow-ups, not in this PR:
keep_private's list by hand.Choices left to the owner: none.