[codex] Guard fleet refresh workspace paths#85
Conversation
…itor-verify-fleet-refresh-before-returning-to # Conflicts: # package.json # src/cli.ts # src/commands/fleet.ts # test/fleet.test.ts
…orkspace-guard # Conflicts: # test/report.test.ts
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: kaizen-agents-org/coderabbit/.coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (13)
📝 WalkthroughWalkthroughAdds a ChangesFleet refresh and slug safety
Sequence Diagram(s)sequenceDiagram
participant CLI
participant refreshFleet
participant refreshProject
participant RunLock
participant WorkspaceManager
CLI->>refreshFleet: project, sync, runCommand
refreshFleet->>refreshProject: target projects
refreshProject->>RunLock: acquire(slug)
refreshProject->>WorkspaceManager: runSetup(config)
refreshProject->>WorkspaceManager: runVerify(config)
refreshProject->>RunLock: release()
refreshFleet-->>CLI: FleetRefreshResult
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related issues
Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d34a1cbccb
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| function assertSafeWorkspacePath(slug: string, projectWorkspacePath: string): void { | ||
| assertProjectSlug(slug); | ||
| if (path.resolve(projectWorkspacePath) !== path.resolve(workspaceDir(slug))) { |
There was a problem hiding this comment.
Reject symlinked workspaces before syncing
When --sync is used and ~/.kaizen/workspaces/<slug> is a symlink to another checkout, this lexical path.resolve comparison still passes, so refresh proceeds to workspace.sync(), which runs git reset --hard and git clean -fdx plus setup/verify in the symlink target. That bypasses the unsafe-workspace guard this change adds and can delete files outside the managed workspace; check lstat/real paths and reject existing symlinks before running refresh.
Useful? React with 👍 / 👎.
Summary
Verification
Closes #78
Summary by CodeRabbit
New Features
Bug Fixes
Tests