Repository navigation
fix(security): recognize loopback trusted proxy authentication - #131196
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 27, 2026, 5:39 PM ET / 21:39 UTC. ClawSweeper reviewWhat this changesThe PR updates Gateway security-audit classification so trusted-proxy mode counts as authentication on loopback binds, while retaining Tailscale’s loopback-only allowance. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open: the patch correctly identifies trusted-proxy as an authentication mode, but it also suppresses the loopback missing-auth diagnostic for configurations that runtime rejects because they lack an allowed loopback proxy path. Likely related people: steipete (high-confidence recent owner) and vincentkoc (medium-confidence historical trusted-proxy owner). Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherThe Gateway security audit turns configured bind and authentication settings into operator-facing exposure findings. Gateway startup and request authorization then enforce the actual trusted-proxy source, loopback, header, and identity requirements. flowchart LR
A[Gateway configuration] --> B[Security audit]
B --> C[Authentication classification]
C --> D[Loopback findings]
A --> E[Gateway runtime authorization]
E --> F[Trusted proxy admission]
D --> G[Operator remediation]
Before merge
Findings
Agent review detailsSecurityNeeds attention: The patch weakens a security diagnostic for loopback trusted-proxy configurations that cannot authenticate at runtime. PR surfaceSource -1, Tests +17. Total +16 across 3 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Only suppress or replace the loopback missing-auth diagnostic when trusted-proxy configuration can authenticate a same-host proxy: explicit allowLoopback plus an explicit loopback entry in trustedProxies, while retaining a focused critical diagnostic for invalid loopback proxy setups. Do we have a high-confidence way to reproduce the issue? Yes—source reproducible: use a loopback bind with trusted-proxy mode, trustedProxies set only to a non-loopback address, and no allowLoopback; the PR suppresses the loopback finding while runtime rejects the only possible loopback proxy request. Is this the best way to solve the issue? No. The mode-only predicate is too broad; the audit should follow the documented runtime condition for a usable same-host trusted proxy rather than infer authentication from mode alone. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ef858c0f1bb8. LabelsLabel justifications:
EvidenceSecurity concerns:
What 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
|
|
Addressed the actionable loopback-setup guidance gap and the related Rank-up move without restoring the incorrect missing-auth exposure diagnostic.
This is a diagnostic repair, not an authentication policy change or a claim that mode alone proves usable ingress. Five new regression cases cover missing consent, missing matching loopback source, valid exact IPv4, valid loopback CIDR, and valid IPv6 configuration. Each requires the critical guidance, preserves the existing loopback opt-in warning where enabled, and excludes the false unauthenticated-access finding. All five failed before the guidance change; all 43 focused audit tests pass afterward. Runtime matching remains CIDR-aware; the audit's stricter localhost helper remains scoped to X-Real-IP risk scoring and is not reused as an admission predicate. The final PR is net zero production lines. No config/defaults, runtime authentication, finding severity, or new diagnostic branch changed. Fresh independent isolated review found no P0 issues. Exact-source built CLI and live synthetic Gateway admission proof is recorded separately with its actual source identity and limits; it does not claim external identity-provider or browser proof. |
|
Merged via squash.
|
…law#131196) * fix(security): recognize loopback trusted proxy authentication * fix(security): explain same-host trusted proxy requirements
Share exact-IP and CIDR parsing between the trusted-proxy wizard and runtime matching. Reject malformed and empty list entries with expected-form guidance, preserve runtime matcher behavior, and recognize loopback CIDR aliases for the existing explicit consent prompt. Follow up on #131132; the diagnostic correction in #131196 did not validate this input.
…trusted proxies (#131475) * fix(onboard): probe remote gateways with saved TLS pins Honor the configured remote certificate pin in onboarding and configure readiness probes while keeping trust scoped to the exact saved endpoint. Retain explicit-pin precedence and exercise the real self-signed TLS handshake, rejection before credentials, and wizard config propagation. Follow up on #131042. * fix(configure): validate trusted proxy addresses with the runtime parser Share exact-IP and CIDR parsing between the trusted-proxy wizard and runtime matching. Reject malformed and empty list entries with expected-form guidance, preserve runtime matcher behavior, and recognize loopback CIDR aliases for the existing explicit consent prompt. Follow up on #131132; the diagnostic correction in #131196 did not validate this input. * fix(configure): align readiness and loopback consent with runtime Keep remote TLS pins and edge-auth inputs through health readiness polling by reusing the existing probe parameters. Keep remote config out of local health probes and cover polling through a real TLS socket. Check loopback consent against runtime proxy matching for both parsed bases and containing ranges, preserving mapped IPv4 and exact IPv6 zone semantics. Extend consent and URL-binding coverage without changing runtime authorization or config schemas.
…trusted proxies (openclaw#131475) * fix(onboard): probe remote gateways with saved TLS pins Honor the configured remote certificate pin in onboarding and configure readiness probes while keeping trust scoped to the exact saved endpoint. Retain explicit-pin precedence and exercise the real self-signed TLS handshake, rejection before credentials, and wizard config propagation. Follow up on openclaw#131042. * fix(configure): validate trusted proxy addresses with the runtime parser Share exact-IP and CIDR parsing between the trusted-proxy wizard and runtime matching. Reject malformed and empty list entries with expected-form guidance, preserve runtime matcher behavior, and recognize loopback CIDR aliases for the existing explicit consent prompt. Follow up on openclaw#131132; the diagnostic correction in openclaw#131196 did not validate this input. * fix(configure): align readiness and loopback consent with runtime Keep remote TLS pins and edge-auth inputs through health readiness polling by reusing the existing probe parameters. Keep remote config out of local health probes and cover polling through a real TLS socket. Check loopback consent against runtime proxy matching for both parsed bases and containing ranges, preserving mapped IPv4 and exact IPv6 zone semantics. Extend consent and URL-binding coverage without changing runtime authorization or config schemas.
Additional instructions
Keep Allow edits from maintainers enabled for this PR.
What Problem This Solves
Fixes an issue where operators running the Control UI through an explicitly allowed loopback trusted proxy would receive a critical “Gateway auth missing on loopback” security-audit finding despite configured proxy authentication. Its remediation recommends a token, but trusted-proxy startup rejects mixed token configuration.
Related: #91268 covers the separate Doctor readiness diagnostic; this change only repairs
openclaw security audit.Why This Change Was Made
The audit already recognized trusted-proxy authentication for non-loopback binds, but omitted it from the loopback classification. Both diagnostics now share the same shared-secret-or-trusted-proxy classification; loopback additionally retains its existing Tailscale Serve allowance. The proxy-specific checks reuse the existing trusted-proxy list instead of reading it twice.
This changes diagnostics only. Runtime authentication, startup validation, config/defaults, identity scopes, and the internal direct-client password fallback are unchanged. Missing proxy configuration and exposure warnings remain, including the intentional critical
gateway.trusted_proxy_authreminder.No documentation change is needed: this restores the documented loopback trusted-proxy behavior and security-audit checks. The documented prohibition on mixed token configuration remains enforced.
User Impact
Operators no longer receive a misleading missing-auth finding or token recommendation for a configured loopback trusted proxy. They still receive the proxy-boundary and loopback opt-in warnings that describe the actual trust configuration.
Production delta: +6/−6, net 0 lines. Test delta: +60/−9, net +51 lines. No new configuration or runtime policy.
Evidence
The expanded regression failed before the production change on
gateway.loopback_no_auth. After the change, 38 tests in five files pass, covering proxy guardrails on loopback and LAN, Tailscale scope, shared credentials, auth selection, HTTP auth, and loopback logging. Formatting, targeted lint, andgit diff --checkpass.The local changed-file gate and dist build encountered an unrelated stale shared
pi-tuidependency:TuiMainScreenwas missing, with consequent type errors. Local dependencies were not reconciled. Separate frozen dependency installs in clean remote source checkouts then built both versions successfully. This is not a claim that the entire typecheck or release matrix passed remotely.Built CLI before/after: both versions ran
node scripts/run-node.mjs --version, thennode openclaw.mjs security audit --json, with isolated HOME/state/config and no operator credentials.gateway.loopback_no_authgateway.trusted_proxy_authgateway.trusted_proxy_allow_loopbacksummary.attack_surfaceThe result changed from 2 critical / 1 warn / 1 info to 1 critical / 1 warn / 1 info; only the false-positive finding disappeared.
Real Gateway admission: each built version also ran
node openclaw.mjs gateway run --port <ephemeral>. Actual loopback WebSocket connections with synthetic forwarded headers showed the allowlisted identity connecting and successfully callinghealth; missing and unlisted identities were rejected on both versions. Both rejection responses surfacedCONTROL_UI_DEVICE_IDENTITY_REQUIRED, so this establishes admission outcomes, not distinct proxy-auth error reporting. No external identity provider, deployed reverse proxy, browser rendering, provider request, or npm-package installation was tested. Control UI assets began building at startup and were canceled during controlled shutdown; no GUI proof is claimed.Remote provenance: provider
blacksmith-testbox, leasetbx_01m12hb5xw8f7p6n1t294xjw3b; hosting workflow run. The workflow checkout wasf5ccf4c38135c4cb6c8d3f78a5445c88863bcb75; it was not used as the tested product source. The recipe created two detached temporary checkouts at the exact baseline below and applied only the reviewed patch to the candidate. Every baseline tracked file was checked against its Git blob; candidate tracked content matched the recorded fingerprint. Node was v24.19.0; each checkout ran its ownpnpm install --frozen-lockfile.6e827231257cf7c9c26ecd54fdc73d8c30afa5d84180d10e3037f8bf831fdbc9ef660f404169865f01d93e75e4c3a8924a9796746adf814157af54d233678b96b9c0aad61f832aaff124d929ed4662c93f126723Remote recipe invocation, with
candidate.patch,run-remote.py, andws-proof.mjsstaged under/tmp/proxy-proof:Arguments are the production-owner content SHA256, patch SHA256, and tracked-source fingerprint. The final remote recipe exited 0. Earlier staging attempts failed before proof completion because the workflow checkout had advanced, then because shared workspace dependency links pointed at the wrong checkout; neither is counted as product proof. Saved evidence includes
summary.json, audit JSON, Gateway logs, WebSocket outcomes, build logs, and source manifests. The workflow link identifies the hosting job; it is not a claim that these foreground proof artifacts were published as Actions artifacts. Both Gateway processes and the lease were stopped, and lease completion was verified.AI-assisted implementation. A separate isolated Codex review of the final diff completed with no findings at its P0-only scope; this is not an exhaustive P1/P2 review. No production changes followed that review.
Loopback guidance follow-up
Addressed the review's missing-consent/source guidance concern and Rank-up move in the existing critical
gateway.trusted_proxy_authremediation. Same-host proxy requests are rejected unlessgateway.auth.trustedProxy.allowLoopback=trueandgateway.trustedProxiesincludes their loopback source; the message now states both requirements and limits enablement to a deliberate same-host trust boundary. Restoringgateway.loopback_no_authwould incorrectly allege unauthenticated exposure and recommend a forbidden shared token. No authentication policy, config/default, severity, or new diagnostic branch changed.Five new guidance regressions failed before this correction and pass afterward, including invalid consent/source and valid exact IPv4, CIDR, and IPv6 configurations. 43 focused tests pass. Full PR production delta is now net 0 (+6/−6); tests net +51 (+60/−9). Formatting, targeted lint, and diff checks pass. A fresh isolated independent Codex review found no P0 issues; it was P0-only. No source changed after that review.
Fresh built-CLI and actual Gateway proof used Blacksmith Testbox
tbx_01m12kw942908ej1y5p5txvj1p, hosted by workflow run 33120767365. The workflow checkout was4088c4c11528f48d4f20acfd919f2ecefd933e4e, but the tested baseline and candidate were separate temporary checkouts of exact90a2792a8a527488a34491d0402324d789cab7ae, with only the reviewed guidance patch applied to the candidate. Both received their own frozen dependencies and passed dist-backed builds. Every tracked source file was verified before and after execution.Guidance patch SHA256:
fea84caebe72b84e6a8ab23e987e2637e0ee68796be63addf25873a60b2930f5.Candidate tracked-source fingerprint:
a428d9ed0705dcc7d555abf7094a96658e3e3f756e4e244419f036b657797870.Each version ran four
node openclaw.mjs security audit --jsonconfigurations and real loopback WebSocket admission against four Gateway processes. Missing loopback consent rejected all connections; a nonmatching trusted source rejected them with HTTP 403. Exact127.0.0.1and CIDR127.0.0.0/8setups admitted the allowlisted synthetic identity, whosehealthRPC succeeded; missing and unlisted identities were rejected. All audit IDs/severities remained unchanged, including the critical proxy reminder and applicable loopback warning. Only the candidate included the new critical remediation sentence.Recipe, with the source patch and WebSocket probe staged alongside it:
The remote recipe exited 0; all eight Gateway processes and the lease were stopped, with completion verified. This proves built CLI and process/network behavior with synthetic headers, not an external IdP, deployed reverse proxy, browser UI, provider call, or npm installation. IPv6 coverage is local config-collector coverage only. Missing-consent/identity rejections surfaced
CONTROL_UI_DEVICE_IDENTITY_REQUIRED, so no distinct internal rejection-reason claim is made. The workflow link identifies the host job; foreground evidence was retrieved separately, not published as Actions artifacts.The repeated local changed-file gate passed its guards but remained blocked at core typecheck by shared dependency mismatches (
pi-tui,markdown-it, and GoogleFinishReason). No local dependency reconciliation was attempted. Clean remote dependency builds succeeded; a full remote typecheck/release matrix was not run. AI-assisted follow-up; no transcript included.