Skip to content

fix: 🐛 Refuse sbx pull patches for what git runs and reads - #900

Merged
pdettori merged 6 commits into
rossoctl:mainfrom
evaline-ju:sbx-hook-new
Nov 19, 2026
Merged

pdettori merged 6 commits into
rossoctl:mainfrom
evaline-ju:sbx-hook-new

Conversation

@evaline-ju

@evaline-ju evaline-ju commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

sbx pull --apply now refuses a patch that writes the core.hooksPath directory, a git directory not named .git, or a git config file: read, included, or at git's global, XDG or system location, even before it exists. A sandbox can't use any of these to run code on the host at the next git command. Paths come from git itself and are resolved through symlinks, including dangling ones.

Fixes #890 , replaces #891 with messier history

Assisted-By: Claude Code

Checklist

  • Commits are signed off (git commit -s).
  • make lint and the tests for the touched packages pass.
  • Docs: changed behavior, flags or environment variables are reflected in the relevant README or
    docs/ page, with the right maturity label (see docs/CONTRIBUTING-DOCS.md).
  • Docs: make check-links passes if any Markdown changed.
  • A new spec or ADR is registered in docs/specs/README.md or docs/adrs/README.md. - N/A

@pdettori pdettori added the ready-for-ai-review Request automated AI code review from clawgenti label Nov 18, 2026
@evaline-ju
evaline-ju marked this pull request as ready for review November 18, 2026 22:59
@evaline-ju
evaline-ju requested a review from pdettori as a code owner November 18, 2026 22:59

@pdettori pdettori left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Summary

Sound change: pull --apply now refuses patches that write the core.hooksPath directory, a non-.git git directory, git config files (read, included, or global/XDG/system, even when missing), and anything inside a nested repo/submodule. I traced the --show-origin -z parsing, the symlink/dangling-link resolution, the git var exit-code handling and the case folding; no blocking issues. Failures to read git config fail closed. Tests cover refusals, sibling non-refusals, nested repos, pre-2.42 git and $HOME-as-tree. Two non-blocking suggestions and two nits inline.

Author: evaline-ju (MEMBER, maintainer)
Areas reviewed: TypeScript (mocactl), tests, docs/spec
Agent/IDE config (.claude/.vscode): none
Commits: 4 commits, all signed-off: yes (subjects use emoji prefixes rather than conventional ones, advisory only)
CI status: passing

Assisted-By: Claude Code

Comment thread packages/mocactl/src/sbx/push.ts Resolved
Comment thread packages/mocactl/src/sbx/push.ts Resolved
Comment thread packages/mocactl/src/sbx/push.ts Resolved
Comment thread docs/sandbox/user-guide.md Resolved
@pdettori

Copy link
Copy Markdown
Member

thanks - need to resolve conflicts to merge

Signed-off-by: Evaline Ju <[email protected]>
@pdettori
pdettori merged commit 4271192 into rossoctl:main Nov 19, 2026
18 checks passed
webchang added a commit to webchang/moca that referenced this pull request Nov 19, 2026
Brings rossoctl#900 (an sbx hook). No conflicts.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Rong Chang <[email protected]>
@pdettori pdettori added this to the v0.11.0 milestone Nov 19, 2026
@evaline-ju
evaline-ju deleted the sbx-hook-new branch November 19, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sbx pull --apply can write files that make git run code on the host

2 participants