Skip to content

Let a caller mark a path entry literal: { path, literal: true } - #621

Merged
ronleizrowice-ant merged 3 commits into
mainfrom
feat/literal-path-marker
Oct 4, 2026
Merged

ronleizrowice-ant merged 3 commits into
mainfrom
feat/literal-path-marker

Conversation

@ronleizrowice-ant

@ronleizrowice-ant ronleizrowice-ant commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Second of three stacked pull requests that replace #608; base: #620, the anchor one. Then #622. The third expresses the paths it finds as marked entries, so this goes first.

What

denyRead, allowRead, allowWrite and denyWrite take { "path": "...", "literal": true } beside a string: a path, never a pattern, whether or not it exists. FilesystemPathEntry is exported. getFsReadConfig() and getFsWriteConfig() carry marked entries in four literal... lists, and writeRootsOf() is exported for whoever asks what a command may write. The Linux wrapper folds those lists in and takes every path for a name; an eslint rule holds that.

Behaviour changes

  • The schema message for an entry that is no string changed.
  • A hand-built config with a malformed mark passes initialize(); wrapWithSandbox() and both getters then throw TypeError.
  • wrapCommandWithSandboxLinux() drops a direct caller's allowOnly string with *?[] when nothing is at that spelling: as a name, /home/*/../.ssh would fold to /home/.ssh.

Tests

Real bubblewrap runs on Linux, both runtimes. macOS is profile text compared on Linux: nothing ran under sandbox-exec. expandWindowsFsPaths runs on Linux; one Windows-only case was only read. 28 mutations, 27 caught; the survivor is equivalent.

Merge order

Conflicts with #569, #574, #575, #607, #581. #594 and #595 merge clean but read allowOnly alone (hostHelperWritePaths(), ownInstallWarning()): they must read writeRootsOf(). So must the monitor lines #569 and #574 add.

`denyRead`, `allowRead`, `allowWrite` and `denyWrite` take
`{ path, literal: true }` beside a string. Such an entry is a path and
never a pattern, whether or not it exists, so it can name a file in a
folder whose name holds `[`, `*` or `?`, or one that is not there yet.

Marked paths travel beside the spellings, in `literal...` lists on the
read and write restriction configs, so no backend reads their characters
again. The Linux wrapper folds those lists in once and takes every path
it is handed for a name, which an eslint rule holds; macOS compiles a
marked path to a subpath filter; Windows takes it down its literal branch
and skips one that holds `*` or `?`. `writeRootsOf()` is exported for
whoever asks what a command may write.
`resolveReadPathEntries` is main's generator over this branch's list of
entries, and both deny expansions keep `spelledOf(...)` inside main's
`finish()` and `walked()`, with `{ listings }`.
Base automatically changed from feat/glob-walk-anchor to main October 4, 2026 15:21

@antdres antdres left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/stamp

@ronleizrowice-ant
ronleizrowice-ant merged commit 80a2351 into main Oct 4, 2026
16 checks passed
@ronleizrowice-ant
ronleizrowice-ant deleted the feat/literal-path-marker branch October 4, 2026 17:39
@ronleizrowice-ant ronleizrowice-ant mentioned this pull request Oct 4, 2026
ronleizrowice-ant added a commit that referenced this pull request Oct 4, 2026
#620, #621, #622 and #644 as merged upstream. The bundle held all four,
joined with the budget, so of the nine blocks git marks it keeps its own
side. What is new to it is the second commit of #644: comments.
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.

2 participants