Repository navigation
profile file: [[profile.NAME.file]] writes literal text read-only - #687
Merged
Merged
Conversation
Issue #653. A profile can now put a small file in the sandbox: [[profile.NAME.file]] path = "/etc/gitconfig" content = "..." Rendered with --perms 0444 --ro-bind-data, up to 64 KiB. Content takes {profile.NAME.identity.<leaf>} placeholders from the include closure, expanded single-pass, plus {lbrace}/{rbrace}, which every sink's path vars now accept. p.Files records which profile wrote each file. Refused: two different contents at one path (both profiles named), a file under a bind (masking), a file at a path snug generates for the selection (wording names the layer to use instead, e.g. /etc/gitconfig for ~/.gitconfig), a file at /tmp, a file through a symlink. --dry-run gets a FILES block with full content (JSON: files array); a file displaced by snug's own is shown as displaced, content not printed. NOT GRANTED says when a profile writes a file there instead of blaming snug, and its heading is reworded. Env coupling counts a profile's own file as a path it grants, within its include closure. VisibleText kept an escaped trailing quote by quoting with strconv. CLAUDE.md invariant 1 corrected: rejectMasking exempts by Mount.Authored, not by KindData. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Only the rows TestBook* holds stay: the `file` row in profile-keys.md
and {lbrace}/{rbrace} in the path variable table. The prose goes to
issue #683 for the maintainer to vet.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
vyskocilm
added a commit
to miska/snug
that referenced
this pull request
Oct 22, 2026
gomoni#687 profile-file placeholders enumerate every identity key, so the refusal now names identity.gpg.fingerprint and identity.gpg.scope. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Closes #653.
New key
[[profile.NAME.file]]: literal text as read-only file in sandbox.--perms 0444 --ro-bind-data, max 64 KiB. Inside: mode 444, owned by user, every write fails.{profile.NAME.identity.<leaf>}from include closure only, single-pass.{lbrace}/{rbrace}escapes, accepted in every sink's path vars.p.Filesledger: which profile wrote which file.Refused:
/etc/gitconfiginstead of~/.gitconfig/tmp--dry-run:filesarraydisplaced, content not printed (refused dry-run leaked generated secret before fix)Env coupling counts profile's own file as granted path, within include closure, downward only.
Other:
VisibleTextdropped escaped trailing quote; nowstrconv.Quote.rejectMaskingexempts byMount.Authored, not byKindData.TestBook*holds (profile-keys.mdfilerow,{lbrace}/{rbrace}in path var table). Prose## filesection moved to book: document facts #673 removed from .claude/design #683 for manual review.Goldens:
profile-file.bwrap.txt,filesystem.profile-file.txt,json.profile-file.json,explain.profile-file.txtnew;refusals.txt+4 entries, 1 reworded (join conflict "two different file contents (...); select one").Review:
/tmpaccepted; NOT GRANTED blamed snug for profile file's anchor dir. Both fixed, tests.Checks:
make gategreen.make integration: newTestProfileFile*pass.TestOfflineHasOnlyLoopback,TestDoctorRunsCleanOnAHostThatCanRunSnugfail on dev host only:ip_greloaded,fb_tunnels_only_for_init_net=0,unshare -rn ip -o linkshowsgre0 gretap0 erspan0without snug.🤖 Generated with Claude Code