fix: bound RPC preauth without blocking admitted callers

Closed
TH
19h ago
+682-174

Closed as superseded by #5343 on the 0.22 remediation line. Continue review and implementation there. Historical validation below remains attributed to its original commits; closure does not claim the replacements are merge-ready.

Summary

The daemon and proxy share a five-second preauthorization deadline for the RPC body and authentication. The daemon caps concurrent preauthorization and releases each slot before dispatch. The existing buffered-byte budget remains through execution. Hookless loopback remains local. Stacked on #5281.

Before / after

  • A preauthorization timeout returns a typed, retriable 408 with dispatched: no and preserves a bounded, valid RPC ID when the body has arrived.
  • A full daemon preauthorization pool returns a typed, retriable 503 before dispatch.
  • The proxy preserves valid IDs for ordinary refusals, including strings over 128 characters. Checked-protocol refusals retain their own ID validation.

Validation

At da479265c9, all four focused ingress tests passed with loopback required. Both production HTTP listeners and the default proxy upstream transport verified retriable 408s from proxy and daemon authentication. Each refusal preserved its RPC ID and reported dispatched: no. A fresh RPC reached the fixture handler after each timeout. Daemon-capacity 503 and overlapping native dispatch remain open.

At 08fb3a0b6f, all eight script admission tests and all 19 hosted checks passed.

At bb5053d270, all 14 previous patches match by range-diff after rebasing onto #5281 0cd48fbd30. The follow-up shares the timeout-only ID limit. All 14 proxy cancellation tests passed, including a late auth completion with zero upstream calls. All 19 hosted checks passed.

At 2c6b09defd, all 19 hosted checks passed. The iOS 26.2 receipt at that combined tip observed two successful overlapping inventory RPCs through the production proxy and daemon listeners.

2eedab287a passed merge-tree. CI pending.