Skip to content

fix(action): timeout remote post-serve HTTP client (GHSA-42j2-w334-qxw7)#1228

Merged
tommysitu merged 1 commit into
masterfrom
fix/postserve-action-timeout-ghsa-42j2-w334-qxw7
May 27, 2026
Merged

fix(action): timeout remote post-serve HTTP client (GHSA-42j2-w334-qxw7)#1228
tommysitu merged 1 commit into
masterfrom
fix/postserve-action-timeout-ghsa-42j2-w334-qxw7

Conversation

@tommysitu
Copy link
Copy Markdown
Member

Summary

  • Remote post-serve actions used http.DefaultClient (no timeout) inside an unbounded goroutine, so a non-responsive endpoint would leak the calling goroutine forever — an attacker with admin-API access could exhaust memory and crash the process (GHSA-42j2-w334-qxw7).
  • Switch to a dedicated *http.Client with a 30s Timeout, which caps dial → TLS handshake → request write → response read. Every in-flight remote-action goroutine is now guaranteed to terminate.
  • Timeout is exposed as action.RemoteActionTimeout so tests can override it.

Test plan

  • go test ./core/action/... -count=1 (all green)
  • New regression test Test_ExecuteRemotePostServeAction_TimesOutOnSlowEndpoint against an httptest server that never responds — fails (hangs past timeout) without the fix, passes in ~0.3s with it
  • go vet ./core/action/...

🤖 Generated with Claude Code

Remote post-serve actions were issued through http.DefaultClient, which
has no timeout. A non-responsive endpoint (accepts TCP but never replies,
half-open TLS, zero-window stall) would block the calling goroutine
indefinitely. Because each matched request spawns a fresh goroutine with
no cap or recovery, an attacker with admin-API access could exhaust
memory by pointing a registered remote action at a black-hole URL.

Use a dedicated *http.Client with a 30s Timeout so every in-flight
remote-action goroutine is guaranteed to terminate. The timeout is
exposed as a package var (RemoteActionTimeout) so tests can lower it.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@tommysitu tommysitu merged commit 4be8340 into master May 27, 2026
4 checks passed
@tommysitu tommysitu deleted the fix/postserve-action-timeout-ghsa-42j2-w334-qxw7 branch May 27, 2026 22:50
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