Repository navigation
fix(gateway): reject unattributable loopback proxy traffic [AI] - #119950
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 16, 2026, 11:36 PM ET / August 17, 2026, 03:36 UTC. ClawSweeper reviewWhat this changesThe PR prepares Gateway ingress attribution before HTTP/WebSocket authentication, rejects unattributable proxy-shaped loopback traffic, and makes managed Tailscale routes lifecycle-owned foreground claims. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessKeep open for explicit security-owner approval: the patch’s ingress owner is coherent and real behavior proof is strong, but it intentionally changes proxy compatibility and Gateway startup availability. Priority: P1 Review scores
Verification
How this fits togetherGateway ingress turns socket and trusted-proxy evidence into an authentication and rate-limit identity before protected HTTP, WebSocket, plugin, and device routes run. Managed Tailscale exposure feeds that same boundary through a private listener and affects Gateway startup and shutdown. flowchart LR
A[HTTP or WebSocket request] --> B[Ingress attribution]
B --> C{Attributable source?}
C -->|No| D[Actionable rejection]
C -->|Yes| E[Limiter subject]
E --> F[Gateway or plugin authentication]
F --> G[Protected route or connection]
H[Managed Tailscale route] --> B
Decision needed
Why: The source and proof support the single-attribution design, but only maintainers can choose the compatibility and availability contract for existing proxy, Service, and Tailscale users. Before merge
Agent review detailsSecurityNone. Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Adopt one ingress-attribution owner only after the Gateway/security owner explicitly accepts the fail-closed proxy migration and startup-critical managed-route contract, with Doctor and public migration guidance as the recovery path. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main can fall back to the loopback socket after forwarded-client resolution, and the PR records a pre-fix nginx reproduction of that limiter behavior. Is this the best way to solve the issue? Unclear on product policy. Preparing one immutable ingress fact at the listener is the best architectural repair, but maintainers must choose whether the fail-closed and startup-critical consequences are the supported upgrade contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 992a88b7281b. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (34 earlier review cycles; latest 8 shown)
|
8f8a812 to
f6b4dda
Compare
Current-head behavior evidenceHead: Production boundary exercised: the Gateway's real Command: Observed denied/fixed scenarios:
Observed positive controls:
Result: Live-environment gap: this run did not use a native Tailscale tailnet, Serve/Funnel daemon, or an external nginx/Caddy process because no approved tailnet credentials or prepared live artifact were available in this session. The evidence therefore proves the current-head Gateway boundary through its nearest production adapter, not native network integration. |
Current-head behavior evidenceHead: Production boundary exercised: the Gateway's real Command: Observed denied/fixed scenarios:
Observed positive controls:
Result: Live-environment gap: this run did not use a native Tailscale tailnet, Serve/Funnel daemon, or an external nginx/Caddy process because no approved tailnet credentials or prepared live artifact were available in this session. The evidence therefore proves the current-head Gateway boundary through its nearest production adapter, not native network integration. |
Current-head behavior evidenceHead: Production boundary exercised: the Gateway's real Command: Observed denied/fixed scenarios:
Observed positive controls:
Result: Live-environment gap: this run did not use a native Tailscale tailnet, Serve/Funnel daemon, or an external nginx/Caddy process because no approved tailnet credentials or prepared live artifact were available in this session. The evidence therefore proves the current-head Gateway boundary through its nearest production adapter, not native network integration. |
1 similar comment
Current-head behavior evidenceHead: Production boundary exercised: the Gateway's real Command: Observed denied/fixed scenarios:
Observed positive controls:
Result: Live-environment gap: this run did not use a native Tailscale tailnet, Serve/Funnel daemon, or an external nginx/Caddy process because no approved tailnet credentials or prepared live artifact were available in this session. The evidence therefore proves the current-head Gateway boundary through its nearest production adapter, not native network integration. |
ClawSweeper reviewReviewed August 12, 2026, 7:45 PM UTC. What this changesThe PR adds canonical Gateway ingress attribution, rejects untrusted forwarded HTTP and WebSocket traffic before authentication, and moves managed Tailscale exposure onto a listener-owned private endpoint with ordered cleanup. PR surface: production +1139/-575 (net +564); tests/support +1942/-261 (net +1681); docs +88/-24 (net +64). Merge readinessResult: needs maintainer review before merge. Overall: 🦞 diamond lobster Reviewed head: Review scores
VerificationStatus: sufficient How this fits togetherGateway ingress attribution sits between incoming HTTP or WebSocket traffic and authentication. It turns socket, trusted-proxy, and managed-Tailscale evidence into a client identity and rate-limit subject, or rejects the request before protected handlers run. flowchart LR
A[HTTP or WebSocket request] --> B[Ingress attribution]
B --> C{Source attributable?}
C -->|No| D[Actionable 403 rejection]
C -->|Yes| E[Client identity and limiter subject]
E --> F[Authentication or plugin-owned auth]
F --> G[Protected route or connection]
Decision needed
Before merge
Review detailsBest possible solution: Land one pre-routing attribution owner after the Gateway/security owner explicitly accepts the fail-closed upgrade contract and startup coupling, retaining the existing recovery guidance, plugin-auth exception, and ordered managed-Tailscale cleanup. Do we have a high-confidence way to reproduce the issue? Yes. The pre-fix order is source-traceable and was observed as a wrong proxied credential failing to lock the later correct attempt, while exact-head focused and real-nginx evidence show rejection before authentication plus direct-local and trusted-proxy controls. Is this the best way to solve the issue? Yes architecturally: preparing one immutable fact at listener ingress is the narrowest maintainable repair and removes downstream rediscovery. The fail-closed compatibility policy, rather than the implementation shape, still requires explicit owner acceptance. AGENTS.md: found_applied Codex review notes: model internal, reasoning high; reviewed against 7b73d33. Label detailsLabel justifications:
Evidence reviewedPR surface: production +1139/-575 (net +564); tests/support +1942/-261 (net +1681); docs +88/-24 (net +64).
|
|
ClawSweeper proof for current head Behavior proved: the production Gateway rejects forwarding-header traffic from an unconfigured nginx peer before authentication, while direct-local traffic and correctly configured per-client proxy budgeting still work. Environment: AWS Crabbox lease Command/artifact:
Evidence:
Compatibility/operator note: forwarding-header traffic now requires a narrowly configured trusted proxy that overwrites or safely rebuilds client headers; clean direct-local traffic remains supported. Live gaps: no native Tailscale daemon or tailnet credentials were available. Managed Serve/Funnel header production and WhoIs behavior are supported by inspected upstream Tailscale source plus focused lifecycle/attribution tests, not a live tailnet run. |
Refuse reset-on-exit publication until Tailscale exposes an atomic owner-bound cleanup operation, and migrate legacy configs with Doctor.
Run managed Serve and Funnel routes as foreground claims tied to the Gateway lifecycle. Retire named Service config through Doctor because Tailscale Services cannot run in foreground mode. Co-authored-by: Pavan Kumar Gondhi <[email protected]>
Remove the retired named-service config from Telegram Mini App URL resolution and register the lifecycle worker as an explicit production entry. Co-authored-by: Pavan Kumar Gondhi <[email protected]>
Keep Funnel enabled when removing an ignored named-Service setting and accept the legacy positive reset flag as a no-op now that managed routes always follow Gateway lifetime. Co-authored-by: Pavan Kumar Gondhi <[email protected]>
Prefer the actionable foreground CLI failure captured during timeout cleanup, and cover the original delayed-failure ordering. Co-authored-by: Pavan Kumar Gondhi <[email protected]>
Preserve current ingress ownership contracts after the rebase, retire the obsolete device-auth migration check, validate route-owner IPC, and move Tailscale auth coverage onto the managed listener. Co-authored-by: Pavan Kumar Gondhi <[email protected]>
Unify the rebased net imports and let module-reset WebSocket tests prepare attribution through the same fresh module instance as the handler. Co-authored-by: Pavan Kumar Gondhi <[email protected]>
Summary
Gateway ingress-attribution hardening associated with GHSA-3q9h-fq44-7qjh and NVIDIA-dev/openclaw-tracking#898. This is defense in depth for header-bearing HTTP proxy traffic; it does not claim to identify the advisory's headerless raw TCP/socat forwarder.
Root cause and owner boundary
The Gateway already knew that forwarded headers made a loopback request non-local, but shared-secret rate limiting could later reconstruct identity from the loopback socket address and regain the configurable loopback exemption. The fix records the authoritative ingress class where the listener accepts the request and reuses that prepared fact everywhere auth state is checked or mutated.
The typed
direct-localclass records direct-local eligibility;gateway.auth.rateLimit.exemptLoopbackremains the authoritative policy for whether loopback is actually exempt. This avoids duplicating runtime limiter configuration inside attribution while still preventing consumers from rediscovering request provenance.Managed Tailscale contract and lifecycle
tailscale serve/tailscale funnelchanges node configuration.resetOnExit: falsecleanup closes listeners before restoring the stable configured Gateway port;resetOnExit: trueclears the OpenClaw-owned route.serve reset/funnel reset, which could erase newer or unrelated operator routes.Authoritative upstream contract review at Tailscale commit
d200b3f18f0ee4cff1f6819a78a9fe8e6a7367f2:ipn/ipnlocal/serve.go:1068-1106overwritesX-Forwarded-Host,X-Forwarded-Proto, andX-Forwarded-For, deletes inbound Tailscale-owned identity/Funnel headers, then sets either the Funnel marker or WhoIs-derived Serve identity: https://github.com/tailscale/tailscale/blob/d200b3f18f0ee4cff1f6819a78a9fe8e6a7367f2/ipn/ipnlocal/serve.go#L1068-L1106client/local/serve.go:17-57obtains the current Serve config/ETag and applies mutations withIf-Match, so concurrent config writes can fail rather than silently overwrite: https://github.com/tailscale/tailscale/blob/d200b3f18f0ee4cff1f6819a78a9fe8e6a7367f2/client/local/serve.go#L17-L57Abrupt process death can still leave a background route targeting the prior ephemeral port until the next startup rewrites it; eliminating that operational limitation requires a foreground-Tailscale or durable-private-socket design outside this repair.
Compatibility and security boundary
gateway.tailscale.preserveFunnelis retained only as a deprecated migration guard. An externally preserved Funnel keeps plugin-authenticated webhook routes, but Gateway-authenticated HTTP/WebSocket routes reject it until the operator migrates to managed Funnel; docs include the migration order.GET /probe also does not exercise Gateway auth. This patch does not claim to identify headerless local TCP forwarding.Maintainer decision requested
This repair intentionally makes two product/security tradeoffs. Please record explicit acceptance of both before merge.
Fail closed for unattributable same-host proxies. A loopback peer that sends forwarding headers but is not narrowly configured in
gateway.trustedProxiesreceivesproxy_attribution_requiredbefore Gateway credentials or fallback auth are evaluated.I accept fail-closed attribution for unconfigured proxy-shaped ingress as the supported upgrade behavior.Treat the managed Tailscale route claim as startup-critical. In Serve/Funnel mode, the Gateway binds its private listener and must successfully inspect/claim the managed Tailscale route before the ordinary listener begins accepting traffic.
gateway.tailscale.modetooffbefore restarting.I accept the managed Tailscale route claim as startup-critical; claim failures should prevent ordinary Gateway ingress from starting.The headerless raw TCP/socat case remains intentionally outside this hardening because it is indistinguishable from direct loopback TCP. No GHSA publication or merge is requested without security-owner approval.
Verification
Exact head:
ef3f1bbe86b1fc11001d85ea9c94083b62524b8c, based onmain2dffeae12692f6524a1b624ae49108f6832486bc.git diff --check 2dffeae12692f6524a1b624ae49108f6832486bc ef3f1bbe86b1fc11001d85ea9c94083b62524b8c -- .: pass.Production/test/docs LOC versus the current exact base (moves and support files classified by role):
+1052/-482, net+570.+1931/-260, net+1671.+88/-24, net+64.The production growth is the canonical ingress owner, bounded diagnostics, and dedicated-listener/lifecycle capability. Connected duplicate WebSocket IP resolution, aggregate-key policy, and destructive cleanup fallback were removed rather than retained as compatibility layers.
AI-assisted implementation.