Repository navigation
fix(agent-hooks): keep the hook event payload off the curl command line - #4475
Conversation
…ing it on the curl command line
The POSIX agent-hook script for every curl-based agent inlined the full
event payload via `curl --data-urlencode "payload=${payload}"`. Tool
output can be tens of KB, so the resulting process command line could be
multi-KB — which endpoint security tools (e.g. Microsoft Defender for
Endpoint) flag as an oversized/suspicious command line. That produced a
false-positive detection on Orca's own loopback (127.0.0.1) telemetry POST.
Stream the payload to an mktemp file and post it with
`--data-urlencode "payload@$payload_file"` instead. The urlencoded body on
the wire is byte-identical, so the agent-hook receiver is unchanged; the
payload simply never appears on a process command line. `trap ... EXIT`
removes the temp file on every exit path. Small bounded metadata fields
(paneKey/tabId/worktreeId/env/version) stay inline.
Applied to all curl-based agents: claude, codex, command-code, copilot,
cursor, droid, gemini, grok, antigravity. (amp/hermes/opencode post via
the HTTP request body and were never affected.) The Windows post-command
shares the same latent pattern and is flagged as follow-up.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Friendly nudge for review: this one is green (CI passing) and currently the only one of my open PRs that's cleanly mergeable against main. Small diff (+95/-32). Happy to address any feedback. cc @nwparker |
…yload-fix # Conflicts: # src/main/antigravity/hook-service.test.ts # src/main/cursor/hook-service.test.ts # src/main/grok/hook-service.test.ts
|
Ready to review this PR? Stage has broken it down into 5 individual chapters for you: Chapters generated by Stage for commit 6d96deb on Jun 19, 2026 9:49pm UTC. |
📝 WalkthroughWalkthroughAll POSIX managed hook scripts generated by 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
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 |
Resolve conflicts with main (command-code moved to command-code-managed-script.ts, Windows wrapper refactor). Reimplement the payload-off-the-command-line fix as a stdin pipe (printf '%s' "$payload" | curl --data-urlencode "payload@-") instead of a temp file: byte-identical wire, no temp file to secure/clean up, and it matches the codebase's existing Windows curl.exe hook post. Extend to devin and kimi, which have the same inline-payload exposure. Co-authored-by: Orca <[email protected]>
|
Merged — this passed our review bar. @BorjaLL thanks for the contribution and the clear EDR-false-positive diagnosis! A maintainer took this over and rebased it on latest |
|
Thank you, @BorjaLL — great catch. Big hook payloads riding on the curl command line and tripping EDR/AV false positives is the kind of thing that's easy to miss until it bites someone. We landed it via stdin piping so there's no temp file to manage and the wire body stays byte-identical to before. Really appreciate you flagging and fixing it — merged! |
|
Thank you, Borja! 🙏 Great catch — tens of KB of payload on the curl command line tripping EDR is the kind of thing you only find if you're actually watching your process list. We landed it via stdin piping (same goal, no temp file). Sharp contribution — thanks for it. 🐋 |
…ing it on the curl command line (stablyai#4475) The POSIX agent-hook script for every curl-based agent inlined the full event payload via `curl --data-urlencode "payload=${payload}"`. Tool output can be tens of KB, so the resulting process command line could be multi-KB — which endpoint security tools (e.g. Microsoft Defender for Endpoint) flag as an oversized/suspicious command line. That produced a false-positive detection on Orca's own loopback (127.0.0.1) telemetry POST. Stream the payload to an mktemp file and post it with `--data-urlencode "payload@$payload_file"` instead. The urlencoded body on the wire is byte-identical, so the agent-hook receiver is unchanged; the payload simply never appears on a process command line. `trap ... EXIT` removes the temp file on every exit path. Small bounded metadata fields (paneKey/tabId/worktreeId/env/version) stay inline. Applied to all curl-based agents: claude, codex, command-code, copilot, cursor, droid, gemini, grok, antigravity. (amp/hermes/opencode post via the HTTP request body and were never affected.) The Windows post-command shares the same latent pattern and is flagged as follow-up. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> Co-authored-by: Neil <[email protected]> Co-authored-by: Orca <[email protected]>
Description
Keeps the agent-hook event payload off the
curlcommand line. Every managed agent-hook script previously posted the payload as an inline--data-urlencode "payload=${payload}"argument — so tens of KB of tool output landed on the process command line, visible topsand to EDR/antivirus tools that flag oversized or "suspicious" command lines (false positives that could kill the hook or the agent).The fix pipes the payload to curl's stdin and reads it back with curl's
@-form:--data-urlencode "payload@-"reads thepayloadfield's value from stdin and URL-encodes it exactly as before, so the POST wire body is byte-for-byte identical. Applied uniformly across all managed agent hook scripts (claude, codex, cursor, copilot, gemini, grok, kimi, devin, droid, antigravity, command-code), matching the patterninstaller-utilsalready uses for the Windowscurl.exepath.Evidence
--data-urlencode "payload=${payload}"argv element — visible on the command line.payload=${payload}form (asserted by.not.toContain(...)in each hook-service test).pnpm run typecheckclean across node/cli/web; oxlint clean on all touched files.ELI5
When an agent finishes a step, Orca runs a tiny script that phones home to the app with what happened. That script used to shout the whole message on the command line, where security software could see it, get suspicious about the size, and kill it. Now the script whispers the message through a private pipe instead — same message arrives, but it's no longer sitting out in the open for antivirus to trip over.
Trade-offs
payloadform field; command substitution already stripped trailing newlines, andprintf '%s're-emits the same bytes.curl.exepath already used stdin. Works identically over SSH (the change is in the generated script text run on the remote).This PR was taken over, rebased on latest
main, verified, and reviewed by a maintainer before merge. Original author: @BorjaLL.