Skip to content

πŸ›‘οΈ Sentinel: Fix DoS pipe deadlock in shell execution#87

Open
NSEvent wants to merge 2 commits into
mainfrom
sentinel-fix-dos-pipe-deadlock-17038624719230680235
Open

πŸ›‘οΈ Sentinel: Fix DoS pipe deadlock in shell execution#87
NSEvent wants to merge 2 commits into
mainfrom
sentinel-fix-dos-pipe-deadlock-17038624719230680235

Conversation

@NSEvent

@NSEvent NSEvent commented Jul 14, 2026

Copy link
Copy Markdown
Owner

🚨 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 calling waitUntilExit().
βœ… 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

  • Bug Fixes
    • Improved handling of command output so results are captured more reliably before processes finish.
    • Enhanced retrieval of child-process information for more consistent automation execution.

Co-authored-by: NSEvent <44446865+NSEvent@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

πŸ‘‹ 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. πŸŽ‰

ℹ️ Recent review info
βš™οΈ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 664a0442-4790-4b3b-bf35-607141b70233

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 8821423 and 0fcebc5.

πŸ“’ Files selected for processing (1)
  • TriggerKit/Sources/TriggerKitRuntime/AutomationExecutor.swift

πŸ“ Walkthrough

Walkthrough

AutomationExecutor now drains process output pipes before waiting for process termination in both command execution and child-process discovery paths.

Changes

Process output handling

Layer / File(s) Summary
Drain process pipes before termination wait
TriggerKit/Sources/TriggerKitRuntime/AutomationExecutor.swift
runProcess and childPIDs(of:) read all available pipe data before waiting for their processes to exit.

Estimated code review effort: 2 (Simple) | ~5 minutes

Possibly related PRs

Suggested reviewers: google-labs-jules[bot]

πŸš₯ Pre-merge checks | βœ… 5
βœ… Passed checks (5 passed)
Check name Status Explanation
Description Check βœ… Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check βœ… Passed The title clearly matches the PR’s main change: fixing a pipe deadlock/DoS risk in shell execution.
Docstring Coverage βœ… Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check βœ… Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check βœ… Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
πŸ“ Generate docstrings
  • Create stacked PR
  • Commit on current branch
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sentinel-fix-dos-pipe-deadlock-17038624719230680235

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.

❀️ Share

Comment @coderabbitai help to get the list of available commands.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant