🛡️ Sentinel: [MEDIUM] Fix DoS pipe deadlock in AutomationExecutor - #104
🛡️ Sentinel: [MEDIUM] Fix DoS pipe deadlock in AutomationExecutor#104NSEvent wants to merge 2 commits into
Conversation
…TriggerKit In AutomationExecutor.swift, `process.waitUntilExit()` was called before draining standard output pipes using `readDataToEndOfFile()`. When a child process spawned via TriggerKit (such as `pgrep` or arbitrary shell scripts) produces more output than the default ~64KB pipe buffer size, it blocks. The parent application (ControllerKeys) waiting indefinitely at `waitUntilExit()` also blocks, resulting in a deadlock/Denial of Service. This commit reorders the instructions so that the pipe's output is read before or concurrently with `waitUntilExit()`. Co-authored-by: NSEvent <44446865+NSEvent@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAutomationExecutor now drains shell and ChangesPipe drain ordering
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
…TriggerKit In AutomationExecutor.swift, `process.waitUntilExit()` was called before draining standard output pipes using `readDataToEndOfFile()`. When a child process spawned via TriggerKit (such as `pgrep` or arbitrary shell scripts) produces more output than the default ~64KB pipe buffer size, it blocks. The parent application (ControllerKeys) waiting indefinitely at `waitUntilExit()` also blocks, resulting in a deadlock/Denial of Service. This commit reorders the instructions so that the pipe's output is read before or concurrently with `waitUntilExit()`. Co-authored-by: NSEvent <44446865+NSEvent@users.noreply.github.com>
🚨 Severity: MEDIUM
💡 Vulnerability: AutomationExecutor within TriggerKit executes shell commands/pgrep and waits for them to exit (
waitUntilExit()) before reading the pipe. If child output exceeds ~64KB, the pipe buffer fills up, blocking the child, which in turn blocks the parent indefinitely.🎯 Impact: Potential Denial of Service (DoS) resulting from deadlocks if TriggerKit executes a command emitting large outputs.
🔧 Fix: Reordered operations in
AutomationExecutor.swiftto ensurepipe.fileHandleForReading.readDataToEndOfFile()is called beforeprocess.waitUntilExit().✅ Verification: Validated that static syntax checks pass. Code review approved the fix logic.
PR created automatically by Jules for task 17774223866840477895 started by @NSEvent
Summary by CodeRabbit