Repository navigation
fix: a mount with two names was still outside the containment check - #6
Merged
Merged
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
git-credential-broker
Bot
force-pushed
the
fix/mount-alias-and-node-floor
branch
5 times, most recently
from
October 3, 2026 19:13
a0ee868 to
f84ae0e
Compare
`insideMountedPath` compared `resolve()`d strings, so `/var/services/homes/u` — the host's `$HOME` — and `/volume1/homes/u`, the same directory as the container sees it, were two different places. `stage` therefore accepted `--to /volume1/homes/u/Workspaces/...` and wrote the broker's code into a directory the agent can rewrite, which is the one thing the check exists to refuse. Reproduced on this host; the stray tree was removed. Both sides are canonicalized now: the nearest existing ancestor is `realpathSync`d and the part that does not exist yet is appended, because `stage` is asked to write to a path that does not exist. The unit test reproduces the alias, and the `stage` test asserts the refusal before anything is written.
`test` and `native-windows` were the only job ids that named the action rather than the platform; `linux`, `macos` and `wsl` already did. The display names keep the `test on …` stem the checks are found by, so no required context moves.
git-credential-broker
Bot
force-pushed
the
fix/mount-alias-and-node-floor
branch
from
October 3, 2026 19:38
f84ae0e to
850ca1d
Compare
i1stG
approved these changes
Oct 4, 2026
i1stG
left a comment
There was a problem hiding this comment.
Approving. I reproduced the bypass against the pre-fix code and checked the new guard, the overlap
change, the CI rename, and the suite.
Verified
- The bug is real.
insideMountedPath(realTarget, aliasHome)returnsnullon the parent of
this branch and the mount here — the alias is the whole difference. The fix is not
theoretical. canonicalPathhandles the half-written pathstageis asked for. It resolves the nearest
existing ancestor and appends the missing tail; onlyENOENT/ENOTDIRare walked up, everything
else propagates, so it fails closed. I also checked the dangling-symlink edge (a--tosymlink
whose target does not exist yet):mkdirSyncfailsENOENTbefore any write, so it is not a
write-through into a mount.- The overlap guard canonicalizes both sides, so a
--tothat is a symlink to the repository
(or into it) is refused rather than compared by spelling. corepack yarn check: 224 pass (215 unit, 9 e2e), matching the description. CI is green on
Linux, macOS, Windows and WSL.- The CI rename is safe. The required contexts in the
mainruleset are thename:values
(test on Linux,test on Windows (refused), …), which are unchanged, and no job carries a
needs:on the renamed ids.
Follow-ups — same class, pre-existing, not blockers for this diff
src/commands/setup.ts:110-113comparespath.resolve(input.gitconfig)against a lexical
path.join(os.homedir(), '.dotfiles'). On the alias host this is defeated the same way — I
measuredfalsefor the real spelling where a canonical comparison istrue.canonicalPathis
now exported; reusing it (orinsideMountedPath) would close it.src/host-request.ts:166compares arealpathSync'dgitDiragainst a lexically resolved
root. I reproduced it:discoverCheckouts(aliasHome)serves the plain checkout but skips a
worktree whose.gitfile points under the real name. Fail-closed, but the host opener would
silently not serve worktrees/submodules on exactly this host.canonicalPath(root)at line 183
fixes it.
Neither is a regression introduced here, so I am approving the stated scope. Happy to take both as
a small follow-up, or folded in if you prefer.
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.
Found while deploying #5 to the host.
The guard
insideMountedPathcomparedresolve()d strings. On this host$HOMEis/var/services/homes/JounQin, whichreadlink -fresolves to/volume1/homes/JounQin— the same directory the container mounts. So:wrote the broker's code into the agent-writable share, exactly what the guard
exists to prevent. It happened for real during verification; the stray tree was
identified by its
STAGED.jsonand removed.canonicalPathresolves the symlinks in a path's existing part — the nearestexisting ancestor plus the part that does not exist yet, because
stageisasked to create a directory that is not there.
insideMountedPathcomparesthose, and so does
stage's repository-overlap guard: a--tothat is asymlink into the repository is the repository. Only
ENOENT/ENOTDIRarewalked up; any other
realpathSyncfailure propagates, so a path whose realform cannot be known is refused instead of being answered lexically.
Tests cover the host alias, a mount that does not exist yet behind that alias,
and a
--tosymlinked into the repository. The alias and overlap cases failagainst the old code.
Also
ci: name the platform jobs after their platformrenames thetestandnative-windowsjob ids tolinuxandwindows, which is howmacosandwslalready read. Display names are untouched, so no required context moves.Tests
corepack yarn check: 224 tracked tests (215 unit, 9 e2e), green.