Repository navigation
Keep .env files and keys out of the sandbox - #11
Merged
Merged
Conversation
ExcludeRules handles names at any depth, anchored paths, folder-only patterns, *, ?, [sets], ** and ! lines, compared without case and after Unicode normalization. ProjectConfig gets an exclude list that starts with the defaults (.env, .env.* but not the examples, .envrc, *.pem, *.key, *.p12, *.pfx, id_rsa and friends, .netrc). A .mudroomignore at the project root adds patterns as a separate list, so its ! lines can't take back the project's own.
Plain and Windows copies skip them. An APFS clone or reflink copies the whole folder, so the excluded entries are deleted from it before session.json is written; nothing can start a sandbox before then, and a failed delete drops the session. session.json records the patterns and what was left out.
The diff puts changes at excluded paths in their own list, which the stat and full output show with an X. Apply skips them with the pattern as the reason, also when handed a diff made without the session's rules. An agent edit to .mudroomignore is flagged like .envrc.
mudroom exclude list|add|remove|reset edits a project's list like the network commands do, and list shows what a new session would leave out. run, start and new print the files left out of the sandbox; diff, snapshots, hunks and review use the session's patterns.
Path matching is now a table over (segment, component), so a pattern full of ** can't hang session creation or the preview. Sets take POSIX classes ([:alpha:], [:digit:] and the rest); an unknown class is an error. .mudroomignore is opened without following links or blocking on a FIFO, must be a regular file of at most 1 MB, 1,000 patterns and 1,024 characters a line, and a file that breaks these rules or has a bad line stops session creation with the reason instead of being ignored.
The sheet passes its list to the session instead of relying on the saved config, stops if saving the settings fails, and shows why a project's .mudroomignore can't be used.
…eing created Session start warns when git tracks a file that was left out, since the agent's repository sees it as deleted. Removing excluded entries clears macOS file flags (uchg) first, on the entry and its folder. create holds creating.lock until session.json exists, so a session still being cloned isn't listed as broken or discarded.
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.
Someone on Product Hunt pointed out that
.envfiles end up in the agent's copy. They did: the clone took the whole folder, ignored files included.This adds an exclude list per project. Files that match it are left out of both
base/andwork/, so the agent never sees them andapplycan never create, change or delete them..env,.env.*(not.env.example,.env.sample,.env.template),.envrc,*.pem,*.key,*.p12,*.pfx,id_rsa,id_dsa,id_ecdsa,id_ed25519,.netrc. On for every project, including existing ones..gitignoresyntax, with**and!. Matching ignores case and Unicode normalization on every platform..mudroomignoreat the project root adds patterns and can be committed. It can't let back in anything from your own list.session.jsonwhen the session is created; diff and apply use that copy.session.jsonis written, so no sandbox starts on a clone that still has the files. Plain and Windows copies skip them while copying.diffshows it asXandapplyskips it.mudroom exclude list|add|remove|reset, a "Kept out of the sandbox" section in New Session, and a line at session start listing what was left out.Tests: 29 new (265 total), covering matching, config, clonefile and plain copy, symlinks, read-only folders, apply refusing excluded paths, and old sessions without a list.
The Linux and Windows code paths (the
readdirwalker and the Windows copy loop) were not compiled locally, so CI is the first check for them.