Fix security and reliability issues#401
Fix security and reliability issues#401siddharthvaddem merged 3 commits intosiddharthvaddem:mainfrom
Conversation
1. Validate URL scheme in open-external-url handler - Prevent opening file:// or other dangerous schemes via shell.openExternal - Only allow http:, https:, and mailto: protocols 2. Fix latest video detection using mtime instead of lexicographic sort - Lexicographic sort gives wrong results (e.g. recording-9 > recording-10) - Now sorts by file modification time for reliable latest-file detection 3. Add null guard for AudioData.format in cloneWithTimestamp - Replace non-null assertion (!) with proper validation - Throws descriptive error if format is unexpectedly null 4. Prevent encodeQueue counter underflow in VideoExporter - Use Math.max(0, ...) to prevent negative queue count Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughSwapped filename-based selection for newest recorded video to mtime-based scanning with stat error handling; tightened external URL handler with parsing and scheme whitelist; audio cloning now requires AudioData.format; video encoder prevents encodeQueue underflow; removed Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@electron/ipc/handlers.ts`:
- Around line 636-648: The code validates the URL but calls
shell.openExternal(url) with the original string; instead re-serialize the
parsed URL to ensure a normalized, validated value is used—after the
ALLOWED_SCHEMES check and using the parsed variable (e.g., parsed.toString() or
parsed.href) pass that into shell.openExternal rather than the raw url string to
follow Electron's recommended pattern.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0bcf54bc-0dcf-4d1d-a577-ef47abd7f55c
📒 Files selected for processing (3)
electron/ipc/handlers.tssrc/lib/exporter/audioEncoder.tssrc/lib/exporter/videoExporter.ts
|
Looks good on my end tested video encoder/exporer w/ mac |
|
@hobostay please fix ci checks |
- Remove trailing comma in SUPPORTED_LOCALES that caused Locale type to include undefined, fixing all downstream type errors - Remove unused webcamSizePreset from useMemo dependency array - Use parsed.toString() instead of raw url in shell.openExternal per Electron security best practice Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
@siddharthvaddem Fixed! All CI issues addressed in 721e8f4:
|
Summary
open-external-urlhandler — Theshell.openExternal(url)call accepted any URL without validation, allowingfile://,javascript:, or other dangerous schemes. Now onlyhttp:,https:, andmailto:are permitted.get-recorded-video-pathused lexicographic sort to find the latest recording (videoFiles.sort().reverse()[0]), which is unreliable (e.g.recording-9.webmsorts afterrecording-10.webm). Now sorts by file modification time.AudioData.format—cloneWithTimestampused a non-null assertion (src.format!) that could throw an unhelpful error ifformatis null. Now validates upfront with a descriptive error message.encodeQueueunderflow — TheencodeQueuecounter inVideoExportercould go negative if the encoder's output callback fires more times than expected. AddedMath.max(0, ...)guard.Test plan
open-external-urlblocksfile:///etc/passwdand allowshttps://example.com🤖 Generated with Claude Code
Summary by CodeRabbit