Repository navigation
fix(graph,mctx): load a box's package graph only from links it may follow - #4000
bryan-minimal wants to merge 7 commits into
Conversation
…llow A package graph the daemon loads on a box's behalf took the workspace and every [upstream] or sideload link its layers named by plain path: a dir link anywhere on the daemon's machine, and a repo that is a local path or file:// URL, cloned in the daemon. A context confined to a box's workspace now loads its graph within the box: - a dir link is followed only to a directory inside the workspace, reached through no .. and no symlink; anything else is refused, naming the link as written and why, before anything there is read - a repo that git would take as local (a path, file://, a remote helper) is refused, in the graph and in the project setup (init, update) - every layer's minimal.toml is read beneath the workspace, or beneath the checkout for a repository, and a layer directory that resolves outside it is refused A host-side load keeps today's behaviour. mctx::Config carries box_local_links (default Refuse) as the place a later allowance from the user's policy plugs in. The daemon's scaffold no longer looks the file up by plain path first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeps the project setup's check off a large Result error type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A dir link that climbs with .. and comes back inside the workspace, as the .minimal/ layout writes ../pkgs, is now followed: the path is resolved by name against the declaring file's directory, must stay beneath the workspace, and the symlink check and the load use the resolved path. A .. that leaves the workspace is still refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 13 billable files and costs up to $3.25.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 58 minutes for your next included review. View limit details
|
|
Approved: no findings at Nothing to do. Clobber: not checked in git history. If that was not intentional, restore the earlier change. |
norrietaylor
left a comment
There was a problem hiding this comment.
Reviewed the link-following paths: BoxScope::resolve_link in load_layer for the upstream, every sideload and the leaf; Layer::new_within with the confined minimal.toml read; bound_for for checkouts; the layer cache (it only caches Repo origins, so a dir layer never skips new_within); every daemon graph-load site (composables, build_context and cloned_reinit keep mfile_edit_root); ProjectSetup for init/update; and is_local_remote against git's own url_is_local_not_ssh / helper parsing for the CLI clone in checkouts::repo. The design holds and the tests are good negative-control pairs. Two medium findings block approval. First, a TOCTOU: the box can swap the layer directory for a symlink between refuse_outside and Confinement::new, which re-derives the confinement root from the swapped path, so neither confinement check catches it. Second, the scaffold now swallows a refused read, and no test covers that. There are also two low notes on refusal wording and scope.
Generated by Claude Code
… lie beneath The layer directory was checked against the workspace, then canonicalized again when its confinement was made. A directory swapped for a link out of the workspace between the two became the confinement root, so the checks on every file read passed. The confinement is now refused unless its root is beneath the workspace or checkout, so a later swap is caught by those checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hout a scaffold Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…repos are refused A refused relative dir in a checkout's layer named the daemon's path to the checkout; it is now shown relative to the layer that wrote it. The docs now say a repository is refused when git reaches it without the network; a loopback host is a network remote, pinned by a test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
The daemon loads a package graph on a box's behalf. Until now it took the workspace, and every
[upstream]or sideload link the graph's layers named, by plain path. That meant adirlink could point anywhere on the daemon's machine, and arepogiven as a local path orfile://URL was cloned by the daemon.A context confined to a box's workspace now loads its graph within the box:
dirlink is followed only to a directory inside the workspace. It may climb with..and come back inside, as the.minimal/layout's../pkgsdoes: the path is resolved by name against the declaring file's directory and must stay beneath the workspace. A symlink on the way, or a path that leaves the workspace, is refused, naming the link (relative to the project, or to the layer that declares it, never by the daemon's own path) and why, before anything there is read.repothat git would take as local (a path,file://, a remote helper) is refused in the graph and in the project setup (init,update).minimal.tomlis read beneath the workspace, or beneath the checkout for a repository. A layer directory that resolves outside it is refused.A host-side load keeps today's behaviour.
mctx::Configcarriesbox_local_links(defaultRefuse) as the place a later allowance from the user's policy plugs in. The daemon's scaffold no longer looks the file up by plain path first.Tests
graph::confineand the loader: in-workspace.., a..that leaves, symlinked paths, local andfile://repos.box_manager.Lab evidence
Release vs this branch:
The lab prepush (fmt, clippy
-D warnings, the workspace tests, the new tests repeated, doctests, the native daemon e2e) and Kani are green on this tree.🤖 Generated with Claude Code