Repository navigation
OpenShell: harden mirror sync boundaries - #57693
Conversation
Greptile SummaryThis PR hardens the OpenShell mirror sync boundary in two important ways: (1) the sandbox-to-host download path now strips symlinks using a recursive The implementation is logically sound and the security rationale is clear. The new tests cover excluded directories, symlink skipping on both directions, and the
Confidence Score: 5/5Safe to merge — no logic or security defects found; all remaining findings are P2 style suggestions. The security hardening is correctly implemented: symlinks are reliably dropped via lstat checks before any copy or upload, excluded dirs are preserved atomically, and the new tests validate all added paths. No P0/P1 issues found. No files require special attention.
|
| Filename | Overview |
|---|---|
| extensions/openshell/src/mirror.ts | Replaces fs.cp with a custom symlink-stripping recursive copy helper; adds stageDirectoryContents and DEFAULT_OPEN_SHELL_MIRROR_EXCLUDE_DIRS exports. |
| extensions/openshell/src/backend.ts | Expands download exclusion list to include git-hooks and .git; adds symlink guard in syncLocalPathToRemote; routes uploadPathToRemote through a staged temp dir. |
| extensions/openshell/src/mirror.test.ts | Adds tests for default excluded dirs, symlink skipping on download, and symlink-free staging on upload; all housed inside the existing replaceDirectoryContents describe block. |
Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/openshell/src/mirror.test.ts
Line: 149
Comment:
**Test grouped under wrong `describe` block**
The `stageDirectoryContents` test (and its siblings added by this PR) are placed inside `describe("replaceDirectoryContents")`, but the last test case exercises `stageDirectoryContents`, a different exported function. This makes it harder to find failures and misleads the test reporter output. Consider nesting it in its own `describe("stageDirectoryContents")` block.
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: extensions/openshell/src/mirror.ts
Line: 23-29
Comment:
**Sequential directory traversal may be slower for large trees**
`copyTreeWithoutSymlinks` processes each directory entry one-at-a-time via `for...of` + `await`. For directories with many entries this serializes all the `lstat`/`copyFile` I/O calls. Switching to `Promise.all` over the entries (as the deletion phase of `replaceDirectoryContents` already does) would parallelize the I/O and speed up mirror sync on large workspaces.
```suggestion
const entries = await fs.readdir(params.sourcePath);
await Promise.all(
entries.map((entry) =>
copyTreeWithoutSymlinks({
sourcePath: path.join(params.sourcePath, entry),
targetPath: path.join(params.targetPath, entry),
}),
),
);
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "OpenShell: harden mirror sync boundaries" | Re-trigger Greptile
8749b5f to
7310780
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7310780496
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b817eb817a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
* OpenShell: harden mirror sync boundaries * OpenShell: polish mirror hardening tests * OpenShell: preserve trusted mirror symlinks * OpenShell: bound mirror fs work globally
* OpenShell: harden mirror sync boundaries * OpenShell: polish mirror hardening tests * OpenShell: preserve trusted mirror symlinks * OpenShell: bound mirror fs work globally
* OpenShell: harden mirror sync boundaries * OpenShell: polish mirror hardening tests * OpenShell: preserve trusted mirror symlinks * OpenShell: bound mirror fs work globally
* OpenShell: harden mirror sync boundaries * OpenShell: polish mirror hardening tests * OpenShell: preserve trusted mirror symlinks * OpenShell: bound mirror fs work globally
* OpenShell: harden mirror sync boundaries * OpenShell: polish mirror hardening tests * OpenShell: preserve trusted mirror symlinks * OpenShell: bound mirror fs work globally
* OpenShell: harden mirror sync boundaries * OpenShell: polish mirror hardening tests * OpenShell: preserve trusted mirror symlinks * OpenShell: bound mirror fs work globally
* OpenShell: harden mirror sync boundaries * OpenShell: polish mirror hardening tests * OpenShell: preserve trusted mirror symlinks * OpenShell: bound mirror fs work globally
* OpenShell: harden mirror sync boundaries * OpenShell: polish mirror hardening tests * OpenShell: preserve trusted mirror symlinks * OpenShell: bound mirror fs work globally
* OpenShell: harden mirror sync boundaries * OpenShell: polish mirror hardening tests * OpenShell: preserve trusted mirror symlinks * OpenShell: bound mirror fs work globally
* OpenShell: harden mirror sync boundaries * OpenShell: polish mirror hardening tests * OpenShell: preserve trusted mirror symlinks * OpenShell: bound mirror fs work globally
Summary
Changes
fs.cp(..., dereference: false)mirror copy with a recursive file-and-directory copy that drops symlinks and other special entrieshooks,git-hooks, and.giton the host during sandbox downloadssyncLocalPathToRemotefrom mirroring host symlinks back into the sandboxValidation
pnpm test -- extensions/openshell/src/mirror.test.tspnpm test -- extensions/openshell/src/openshell-core.test.tspnpm buildclaude -p '/review'and addressed the actionable feedbackNotes