Skip to content

🛡️ Sentinel: [MEDIUM] Fix DoS pipe deadlock in AutomationExecutor - #104

Open
NSEvent wants to merge 2 commits into
mainfrom
sentinel/fix-triggerkit-pipe-deadlock-17774223866840477895
Open

🛡️ Sentinel: [MEDIUM] Fix DoS pipe deadlock in AutomationExecutor#104
NSEvent wants to merge 2 commits into
mainfrom
sentinel/fix-triggerkit-pipe-deadlock-17774223866840477895

Conversation

@NSEvent

@NSEvent NSEvent commented Jul 23, 2026

Copy link
Copy Markdown
Owner

🚨 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.swift to ensure pipe.fileHandleForReading.readDataToEndOfFile() is called before process.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

  • Bug Fixes
    • Fixed an issue that could cause automation processes to hang when producing substantial command output.
    • Improved process and child-process detection by reading command output before waiting for completion.
  • Documentation
    • Added guidance for identifying and preventing similar process pipe deadlocks.

…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>
@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 23, 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: bc5622c9-e46c-4751-a9a5-6aabfd5f926d

📥 Commits

Reviewing files that changed from the base of the PR and between 5cdd395 and 5a1e07a.

📒 Files selected for processing (2)
  • .Jules/sentinel.md
  • TriggerKit/Sources/TriggerKitRuntime/AutomationExecutor.swift

📝 Walkthrough

Walkthrough

AutomationExecutor now drains shell and pgrep pipe output before waiting for child processes to exit. Documentation records the pipe-deadlock pattern and guidance for applying the ordering consistently.

Changes

Pipe drain ordering

Layer / File(s) Summary
AutomationExecutor pipe-drain ordering
TriggerKit/Sources/TriggerKitRuntime/AutomationExecutor.swift, .Jules/sentinel.md
runProcess and childPIDs(of:) read subprocess output before waiting for termination, preserving existing result and error handling; documentation records the related deadlock pattern and guidance.

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

Possibly related PRs

🚥 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 and accurately summarizes the main change: fixing a pipe-deadlock DoS in AutomationExecutor.
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-triggerkit-pipe-deadlock-17774223866840477895

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.

…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>
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