π‘οΈ Sentinel: Fix DoS pipe deadlock in shell execution#87
Conversation
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 (1)
π WalkthroughWalkthrough
ChangesProcess output handling
Estimated code review effort: 2 (Simple) | ~5 minutes Possibly related PRs
Suggested reviewers: π₯ 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 |
When executing shell commands via Foundation.Process, `process.waitUntilExit()` was called before draining the standard output/error pipes (`pipe.fileHandleForReading.readDataToEndOfFile()`). If the shell command outputs more data than the OS pipe buffer capacity (~64KB), the child process hangs waiting for space in the pipe, while the parent hangs waiting for the process to exit. This was fixed by reversing the order. Co-authored-by: NSEvent <44446865+NSEvent@users.noreply.github.com>
π¨ Severity: HIGH
π‘ Vulnerability: When executing shell commands via Foundation.Process,
process.waitUntilExit()was called before draining the standard output/error pipes (pipe.fileHandleForReading.readDataToEndOfFile()). If the shell command outputs more data than the OS pipe buffer capacity (~64KB), the child process hangs waiting for space in the pipe, while the parent hangs waiting for the process to exit.π― Impact: An attacker or a malfunctioning script could trivially cause a Denial of Service by printing a large amount of text, causing the application thread to deadlock indefinitely.
π§ Fix: Swapped the order so that the pipe buffer is drained completely via
readDataToEndOfFile()before callingwaitUntilExit().β Verification: Statically verified that the data read now correctly precedes the exit wait across instances within
AutomationExecutor.swift.PR created automatically by Jules for task 17038624719230680235 started by @NSEvent
Summary by CodeRabbit