Skip to content

feat(configure): surface the trusted-proxy loopback opt-in with its warning - #131132

Merged
steipete merged 2 commits into
mainfrom
steipete/trusted-proxy-loopback-prompt
Aug 27, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/trusted-proxy-loopback-prompt

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The gateway wizard accepted 127.0.0.1 as a trusted-proxy address but never surfaced the required allowLoopback opt-in, so the saved configuration was rejected at runtime with trusted_proxy_loopback_source (src/gateway/auth.ts) — a silent dead-end the docs (docs/gateway/trusted-proxy-auth.md:95) only resolve via a manual config edit. Reruns of working same-host proxy configs also broke, because the wizard rebuilt the nested block and silently dropped an existing allowLoopback: true. Verified in stable v2026.7.1. (Audit finding F-O4; the fix shape — prompt with warning — is the maintainer's explicit product decision.)

Why This Change Was Made

When the operator enters a loopback trusted-proxy address (classified by the same isLoopbackAddress helper runtime auth uses — no new IP parser; loopback literals, mapped IPv6, and loopback-base CIDRs), the wizard shows the security warning (any local process can forge identity headers; enable only when the proxy is the sole local listener) and asks for explicit consent. Consent sets trustedProxy.allowLoopback: true; refusal leaves it unset and states the exact runtime rejection with the docs URL. Same-mode reruns default to the existing opt-in (preserved, or revocable with an explicit No); entering trusted-proxy from another mode never revives dormant consent. deviceAutoApprove — pairing policy where omitted and empty scopes differ — is preserved verbatim, never reconstructed. Copy localized in en/zh-CN/zh-TW.

Two independent passes preceded landing: a deep-context review confirmed the owner and shape ("best owner and shape"; runtime keeps sole authorization ownership — no bypass for HTTP or WebSocket), and the branch was rebased onto #131035's real-builder test harness with a fresh branch-mode autoreview, keeping main's three-mode preservation matrix byte-for-byte plus all 17 consent cases.

User Impact

Same-host reverse-proxy setups configured through the wizard now work at runtime with explicit, informed consent — no more silent rejection loop — and reconfiguring never silently drops or revives the loopback opt-in.

Evidence

  • Consent matrix: 17 cases — seven loopback/address forms, three translated refusal flows, three preserve/revoke reruns, three device-enrollment policy shapes, dormant-consent rejection — through the real promptGatewayConfig → buildGatewayAuthConfig path with live-config write/read proof for revocation.
  • Suites green post-rebase (31 gateway tests on head d158c97; 68 in the rebase validation); check-changed full gates exit 0; Codex autoreview clean three times (implementation, deep review, rebased branch).
  • LOC vs main: production +49/−10 (+39, the consent interaction + three locales), tests +164, docs +12.
  • Named follow-ups (source-grounded, untouched): trusted-proxy address prompt accepts malformed nonempty IP/CIDR strings; device-autoapproval docs/help drift (operator.questions missing from stated defaults; "manual upgrade" claim stale).

…arning

Ask for explicit consent before enabling same-host trusted-proxy authentication,
and explain the runtime rejection when consent is declined. Preserve existing
loopback consent and unprompted device enrollment policy on same-mode reruns.

Reuse runtime loopback classification, add English and Chinese wizard copy,
and document the consent and preservation behavior.
Remove the auth-builder mock and replacement factories so gateway prompt tests verify returned configuration across proxy, token, password, and SecretRef flows. Retain all consent regressions while reducing test scaffolding and reusing tracked environment cleanup.
@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review August 27, 2026 19:13
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime commands Command implementations size: M maintainer Maintainer-authored PR labels Aug 27, 2026
@steipete
steipete merged commit 9be3cef into main Aug 27, 2026
410 of 415 checks passed
@steipete
steipete deleted the steipete/trusted-proxy-loopback-prompt branch August 27, 2026 19:45
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 28, 2026
…arning (openclaw#131132)

* feat(configure): surface the trusted-proxy loopback opt-in with its warning

Ask for explicit consent before enabling same-host trusted-proxy authentication,
and explain the runtime rejection when consent is declined. Preserve existing
loopback consent and unprompted device enrollment policy on same-mode reruns.

Reuse runtime loopback classification, add English and Chinese wizard copy,
and document the consent and preservation behavior.

* test(configure): assert wizard auth through the real builder

Remove the auth-builder mock and replacement factories so gateway prompt tests verify returned configuration across proxy, token, password, and SecretRef flows. Retain all consent regressions while reducing test scaffolding and reusing tracked environment cleanup.
steipete added a commit that referenced this pull request Aug 28, 2026
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.
steipete added a commit that referenced this pull request Aug 28, 2026
…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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 29, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant