Repository navigation
fix(speech): avoid system tar for Windows model extraction - #9571
boris-papevis wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between bea8c6bf34454ff1bb9ba3bde2b180ec2cd6253e and 22f0ae6. 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds secure tar.bz2 speech-model archive extraction through a worker thread, including path and entry-type validation. Model downloads now pass an 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/main/speech/speech-model-archive-worker.ts (2)
8-8: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAdd a comment explaining the entry type constraints.
As per coding guidelines, please add a concise comment explaining why this constraint exists.
// Why: prevent symlinks and hardlinks from being used as a directory traversal or arbitrary write primitive. const ALLOWED_ENTRY_TYPES = new Set(['File', 'OldFile', 'Directory'])💡 Proposed change
+// Why: prevent symlinks and hardlinks from being used as a directory traversal or arbitrary write primitive. const ALLOWED_ENTRY_TYPES = new Set(['File', 'OldFile', 'Directory'])Source: Coding guidelines
10-12: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAdd a comment explaining the
strippedpath logic.As per coding guidelines, please add a concise comment explaining why the path constraint uses a stripped path.
// Why: tar is configured with strip: 1, so we must validate the path exactly as it will be written after the first directory segment is removed.💡 Proposed change
function assertSafeEntry(path: string, type: string): void { const normalized = path.replaceAll('\\', '/') + // Why: tar is configured with strip: 1, so we must validate the path exactly as it will be written after the first directory segment is removed. const stripped = normalized.split('/').slice(1).join('/')Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: a2c0c7b2-9ce3-4fda-a800-641206a29c98
📥 Commits
Reviewing files that changed from the base of the PR and between d9d939a and f9d453ce45f723929675839f41998c552e5392f9.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (6)
electron.vite.config.tspackage.jsonsrc/main/speech/model-manager.test.tssrc/main/speech/model-manager.tssrc/main/speech/speech-model-archive-worker.test.tssrc/main/speech/speech-model-archive-worker.ts
bea8c6b to
22f0ae6
Compare
|
thanks @boris-papevis for brining attention here ! To avoid the extra dep I merged #10735 LMK if it has any issues |
Summary
On Windows, extract
.tar.bz2speech models in a worker thread instead of callingC:\Windows\System32\tar.exe.The Windows bsdtar on the affected system did not finish extracting the Parakeet archive before Orca's 10-minute timeout. The streaming JavaScript extractor completed the same archive in about 113 seconds without blocking Electron's main thread.
macOS and Linux continue to use the existing system
tarpath.Related issue: #9231
Screenshots
No visual change.
Testing
pnpm lintoxlint.src/main/daemon/daemon-server.tsandsrc/renderer/src/components/skills/skill-freshness-group.tsx.pnpm typecheckpnpm testpnpm build.tar.bz2extraction, path traversal rejection, and link rejectionA built-worker smoke test also extracted a real
.tar.bz2fixture fromout/main/speech-model-archive-worker.js.AI Review Report
The review checked Windows, macOS, and Linux behavior; Electron worker packaging; local and SSH compatibility; agent and integration compatibility; performance; cancellation cleanup; and archive security.
The implementation changes only the Windows extraction path. macOS and Linux retain their current
tarcommand. Speech models live in Orca's local application cache, so remote repositories and SSH worktrees do not use this path. The change does not affect CLI agents, Git providers, integrations, shortcuts, labels, or UI behavior.The review identified two main risks:
..traversal, symbolic links, hard links, and unsupported entry types.Cancellation terminates the worker before
ModelManagerremoves partial files.Security Audit
Orca verifies the downloaded archive against its catalog SHA-256 before extraction.
The extractor also:
tarandunbzip2-streamare bundled into the worker, so the packaged application does not resolve them from an external runtime directory. This change does not handle credentials, authentication data, secrets, or external IPC.Notes
Windows uses the worker-based extractor. macOS and Linux keep the existing system
tarimplementation.No remote, SSH, agent, integration, Git-provider, or UI behavior changes.
X: No account