Skip to content

policy: {colon} path variable writes a literal ':' - #692

Merged
vyskocilm merged 1 commit into
mainfrom
feat/colon-var
Oct 23, 2026
Merged

vyskocilm merged 1 commit into
mainfrom
feat/colon-var

Conversation

@vyskocilm

Copy link
Copy Markdown
Contributor

{colon} joins {lbrace}/{rbrace} in pathVars, so every sink expands it: ro/rw/tmpfs/symlink/optional specs, file path and content, environ values. splitSpec splits host:guest on the raw text before expanding, so /mnt/a{colon}b grants /mnt/a:b and /mnt/a{colon}b:/g binds it at /g. In an element of a ':'-separated list checkExpandedElement refuses it, with a message naming {colon}: whatever reads PATH splits there.

Red team on this change, both fixed with tests:

  • env coupling read a symlink's target unexpanded while bwrap got the expanded one, so target = "/q{colon}" was judged as a different link than target = "/q:" (TestEnvCouplingExpandsASymlinkTarget).
  • refusals suggesting ro = ["<path>"] echoed a host path holding ':' raw, which splitSpec reads as another host at another guest; specText writes ':' and '{' as {colon}/{lbrace} (TestSpecTextRoundTripsThroughSplitSpec).

{colon} joins {lbrace}/{rbrace} in pathVars, so every sink expands it:
ro/rw/tmpfs/symlink/optional specs, file path and content, environ
values. splitSpec splits host:guest on the raw text before expanding,
so `/mnt/a{colon}b` grants /mnt/a:b and `/mnt/a{colon}b:/g` binds it at
/g. In an element of a ':'-separated list checkExpandedElement refuses
it, with a message naming {colon}: whatever reads PATH splits there.

Red team on this change, both fixed with tests:
- env coupling read a symlink's target unexpanded while bwrap got the
  expanded one, so `target = "/q{colon}"` was judged as a different
  link than `target = "/q:"` (TestEnvCouplingExpandsASymlinkTarget).
- refusals suggesting `ro = ["<path>"]` echoed a host path holding ':'
  raw, which splitSpec reads as another host at another guest; specText
  writes ':' and '{' as {colon}/{lbrace}
  (TestSpecTextRoundTripsThroughSplitSpec).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@vyskocilm
vyskocilm merged commit b401c6f into main Oct 23, 2026
5 checks passed
@vyskocilm
vyskocilm deleted the feat/colon-var branch October 23, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant