Skip to content

fix(onboard): preserve the remote gateway TLS pin for an unchanged endpoint - #131042

Merged
steipete merged 2 commits into
mainfrom
steipete/remote-tls-pin-preserve
Aug 27, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/remote-tls-pin-preserve

Conversation

@steipete

Copy link
Copy Markdown
Contributor

REVIEW REQUIRED — endpoint trust scoping. Prepared by the auto-QA campaign; intentionally left as a draft for maintainer review, not autonomous landing.

What Problem This Solves

Reconfiguring a working remote gateway interactively silently discarded its TLS certificate pin. promptRemoteGatewayConfig() reconstructed gateway.remote from scratch, including only a pin discovered in the current invocation — so openclaw configure --section gateway → Remote → decline discovery → keep URL → keep credential reported "Remote gateway configured" while removing tlsFingerprint (and transport/remotePort/SSH routing fields). Private-certificate connections then break outright; CA connections lose the explicit fingerprint check (gateway/tls-fingerprint.ts:26; websocket-transport.ts:137,162). The non-interactive sibling already preserves the whole remote block for an unchanged URL (6d39d3cf0ba); the interactive defect ships in stable v2026.7.1-2.

Why This Change Was Made

The interactive producer now preserves the remote block only when the chosen URL exactly equals the original URL after whitespace trimming — no hostname/port/path equivalence is inferred, so trust never follows a changed endpoint. Key scoping decisions for review: classic onboarding can pre-seed a changed URL into the producer's input, so comparison uses the original configured URL (the internal edgeAuthOriginUrl option renamed to remoteOriginUrl and reused for both trust decisions — comparing the seeded URL would transfer an old pin and SSH routing to a different endpoint); omitted-vs-explicitly-absent original URLs are distinguished so a partial config can't attach old trust to a newly seeded URL; explicit auth selection overwrites both credential slots and separately-scoped edge auth (the spread can't bypass its scope check); a confirmed discovery pin wins only for its exact confirmed URL. Full field matrix (all 10 gateway.remote schema fields × unchanged/changed URL) in the worker report and tests. The "not advertised" discovery prompt no longer implies a saved pin is useless (en/zh-CN/zh-TW); docs/gateway/remote.md documents reconfiguration behavior.

User Impact

Re-running the wizard against an unchanged remote endpoint keeps its certificate pin, transport, and SSH routing; changing the endpoint still clears them all.

Evidence

  • Failing-first: unchanged-pinned-endpoint case fails pre-fix (pin gone); URL-change still clears; discovery still sets; seeded-URL scenarios (changed seed, edited-back-to-original, no-original-URL) all covered.
  • Existing discovery tests re-tabled without weakened assertions; non-interactive sibling suite untouched and green.
  • check-changed and Codex autoreview: pass/clean.
  • LOC: production +14/−12 (+2, both comment lines — preservation absorbed into existing caller/auth construction); tests +90 net; docs +6.
  • Named adjacent follow-up: an existing env-secret-ref test assigns OPENCLAW_GATEWAY_TOKEN outside its capture/restore list (test-isolation cleanup candidate).

@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.

@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 marked this pull request as ready for review August 27, 2026 17:24
Carry the discovery URL, transport, and optional pin together so a trusted Direct choice overrides saved SSH transport and a new manual tunnel cannot retain an old route behind the same loopback URL. Keep manual same-endpoint pin preservation and existing auth scoping.

Strengthen the explicit-absent origin assertion, restore test-owned environment keys, and document the discovery override behavior.
@steipete
steipete force-pushed the steipete/remote-tls-pin-preserve branch from 7c4deab to e72ba4f Compare August 27, 2026 18:12
@steipete
steipete merged commit fa09ec4 into main Aug 27, 2026
197 checks passed
@steipete
steipete deleted the steipete/remote-tls-pin-preserve branch August 27, 2026 18:42
@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
…dpoint (openclaw#131042)

* fix(onboard): preserve the remote gateway TLS pin for an unchanged endpoint

* fix(onboard): honor discovery transport when preserving remote settings

Carry the discovery URL, transport, and optional pin together so a trusted Direct choice overrides saved SSH transport and a new manual tunnel cannot retain an old route behind the same loopback URL. Keep manual same-endpoint pin preservation and existing auth scoping.

Strengthen the explicit-absent origin assertion, restore test-owned environment keys, and document the discovery override behavior.
steipete added a commit that referenced this pull request Aug 28, 2026
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.
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