Repository navigation
Description
Summary
Replace the AppleScript-based rename implementation with Node.js fs.rename() to fix a shell injection vulnerability and batch failure issues. This is the critical security fix that must land first.
Problem
The current implementation spawns a separate osascript process per file via spawnSync():
const escapedFilePath = file.replaceAll('"', '\\"');
await runAppleScript(`
tell application "Finder"
set theItem to POSIX file "${escapedFilePath}" as alias
set name of theItem to "${escapedNewName}"
end tell
`);Security: Filenames containing shell metacharacters can inject arbitrary AppleScript commands. The " → \" escaping is insufficient.
Reliability: Batch renames start timing out around ~90 files — some files are silently skipped with no indication of failure.
No error recovery: A single try/catch around the entire loop means a mid-batch failure leaves files in an inconsistent state.
Proposed Solution
- Replace AppleScript with
fs.rename()in bothindex.tsx(Rename) andreplace.tsx(Replace) - Remove
utils.tsx(AppleScript runner) — no longer needed - Add per-file error handling with individual success/failure tracking
- Add conflict detection to prevent overwriting existing files
- Show results summary after operation (what succeeded, what failed)
Critical constraint: Keep the existing two commands with their exact names:
Rename File(s)(command name:index)Replace File(s) Characters(command name:replace)
This preserves user hotkeys, aliases, and ranking.
Implementation Notes
- Key files to modify:
src/index.tsx,src/replace.tsx - Key file to remove:
src/utils.tsx - No new dependencies required
- Extract shared rename logic into
src/lib/files.ts - Add
src/lib/errors.tsfor structured error types - Target: ~5-8 files changed
Benefits
- Eliminates shell injection attack surface entirely
- Fixes silent batch failures for large file sets
- Per-file error tracking instead of all-or-nothing
- Conflict detection prevents accidental overwrites
- Zero user-facing breaking changes (same commands, same names)
Activity
TurboCoder13 commentedon Mar 28, 2026
AI Implementation Prompt
Use this prompt in a new Claude Code session to implement this fix:
5 remaining items
Update menucloak extension (raycast#30372)
Add capd extension (raycast#29979)
Add logbook extension (raycast#30026)
Add sidecar-display extension (raycast#29572)
Update ClaudeCast: Session Inbox, Agent Controls, Windows Support, an…
Add agentcfg extension (raycast#29477)
Add layoutlock extension (raycast#30146)
Add dimmer extension (raycast#29764)
Update tuya-smart extension (raycast#30561)
Update clockodo extension (raycast#31255)
Update desktoprenamer extension (raycast#31345)
Update raycast-store-updates extension (raycast#31453)
Update replicate extension (raycast#31630)
Add heed extension (raycast#31010)
Add switcheroo extension (raycast#31064)