Skip to content

fix(gateway): connect bootstrap clients to self-signed WSS - #80204

Merged
vincentkoc merged 3 commits into
openclaw:mainfrom
jetd1:fix/gateway-bootstrap-tls-fingerprint
Aug 5, 2026
Merged

vincentkoc merged 3 commits into
openclaw:mainfrom
jetd1:fix/gateway-bootstrap-tls-fingerprint

Conversation

@jetd1

@jetd1 jetd1 commented May 10, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

ACP, MCP channel bridge, and operator-approval clients could fail certificate
verification when connecting to a local self-signed wss:// Gateway. Those
clients used the shared bootstrap path, but that path did not carry the Gateway
certificate fingerprint.

Why This Change Was Made

TLS fingerprint selection now has one shared Gateway owner used by both
callGateway and bootstrap clients. Configured remote pins apply only to
selected wss:// remote targets, CLI URL overrides remain explicit-only, and
remote-mode local fallback uses the local generated certificate pin.

No Gateway server TLS behavior, auth mode, config schema, environment variable,
or public endpoint changed.

The final follow-ups keep the resolver type file-local, leave the release-owned
changelog entry absent, preserve configured-pin rejection for plaintext targets, and
use one parsed wss: predicate across fingerprint selection and client
transport setup.

User Impact

Operators using a local self-signed TLS Gateway can start ACP, MCP channel, and
native approval clients without those clients failing before authentication.
Existing remote, CLI-override, plaintext, and fallback behavior remains explicit
and covered.

Evidence

Exact reviewed head:
77e5621398572bf4e94a7decaeb1d832178c2a6b

  • Refreshed onto current main at
    39bbd8afd338dde0831dea3214cf17f80594ea44; the aggregate stable patch ID
    remains 9174affea4d45fd5ffb7aa5e31ba054f8b7bd6a8, with range-diff changes only
    for the required Punchcard trailers.
  • Before repair on the frozen base,
    src/gateway/client-bootstrap.test.ts failed because the local WSS bootstrap
    returned undefined instead of sha256:local.
  • Contributor live Linux proof: Gateway health returned OK over local WSS,
    and ACP reached the expected scope-upgrade approval gate without a TLS or
    fingerprint failure.
  • 166 focused tests passed across three Vitest shards for the behavior rewrite.
  • After the hosted dependency gate found an unused exported helper type, the
    type was made file-local; 43 focused tests passed and all production,
    full-tree, and script Knip unused-export scans returned zero entries.
  • git diff --check, changed-file formatting, and targeted type-aware oxlint
    passed.
  • Local changed-gate fallback passed conflict markers, environment and max-lines
    ratchets, extension export guards, duplicate coverage, dependency pins,
    Plugin SDK API contract, deprecated API usage, plugin boundaries, package
    patch policy, and test-temp reporting.
  • Native schema, database-first storage, media helper, runtime sidecar,
    import-cycle, webhook-auth, and pairing-auth guards passed.
  • Autoreview reported no actionable findings for the behavior rewrite at 0.98
    and for the dependency-gate correction at 0.99.
  • Independent final source review covered explicit, remote, environment, CLI,
    local, and fallback TLS-pin branches.
  • Exact-head ClawSweeper found two transport-policy regressions: configured
    remote pins were dropped for plaintext targets, and uppercase WSS://
    targets disagreed with the client's raw scheme checks. Both are repaired at
    the shared parsed URL-policy boundary.
  • The repaired resolver/client regressions passed 39 focused tests twice.
    Original call, ACP, MCP, and approval bootstrap siblings passed 158 tests.
  • After the main refresh, the 39 focused resolver/client tests and all 158
    sibling tests passed again; direct oxlint, targeted oxfmt, and
    git diff --check remained clean.
  • Final current-main replay preserved the patch exactly; all three commits are signed, each has one Punchcard-Session: cobalt-brook-meadow-m9 trailer, and direct oxfmt, oxlint, and git diff --check passed across all 14 changed files.
  • A final Blacksmith Testbox retry reached Run Testbox but produced no result for 31 minutes and was stopped as an infrastructure stall: https://github.com/openclaw/openclaw/actions/runs/30971746545. It is not counted as passing proof.
  • A final branch autoreview retry likewise stalled in its Codex subprocess before returning a report and was stopped after 31 minutes; the prior patch-identical autoreviews remain the available clean reports.
  • Exact-head hosted CI completed green: https://github.com/openclaw/openclaw/actions/runs/30973281735.
  • Exact-head ClawSweeper completed successfully with no findings, sufficient proof, and a best-fix verdict: https://github.com/openclaw/clawsweeper/actions/runs/30973377544. Durable review: fix(gateway): connect bootstrap clients to self-signed WSS #80204 (comment).
  • Direct oxlint, targeted oxfmt, and git diff --check passed on the repaired
    exact head. The repository oxlint wrapper remained blocked only by the
    unchanged packages/terminal-core/src/ansi.ts:194 declaration mismatch.

Change size

Production: +83/-26 (net +57)
Tests:      +290/-1 (net +289)

Blacksmith Testbox capacity fallback: lease
tbx_01kz6nzdm1e2qskf64gqp2bm17 remained queued without a runner IP or Actions
URL, so trusted-source proof fell back locally. Local core typechecking was
blocked by the unchanged packages/terminal-core/src/ansi.ts:194 dependency
signature mismatch already present on main; dependencies were not reconciled
inside the GWT.

Punchcard-Session: clear-orchard-lantern-bc

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: M proof: supplied External PR includes structured after-fix real behavior proof. labels May 10, 2026
@clawsweeper

clawsweeper Bot commented May 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 5, 2026, 1:14 AM ET / 05:14 UTC.

ClawSweeper review

What this changes

The PR shares Gateway TLS fingerprint selection with bootstrap clients so local self-signed WSS connections work for ACP, MCP bridge, and approval flows.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

No blocking correctness finding: current main still omits TLS pins for bootstrap clients, while this PR centralizes the existing call-path policy and propagates it to ACP, MCP, and approval clients. The remaining gate is Gateway-owner acceptance of the audited certificate-trust boundary.

Priority: P2
Reviewed head: 77e5621398572bf4e94a7decaeb1d832178c2a6b
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Strong live and focused proof supports a coherent, security-sensitive owner-boundary repair; only Gateway-owner acceptance remains.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body records an after-fix local WSS health/ACP run reaching the approval gate, supplemented by exact-head focused tests and hosted CI.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body records an after-fix local WSS health/ACP run reaching the approval gate, supplemented by exact-head focused tests and hosted CI.
Evidence reviewed 5 items Current-main gap: Bootstrap resolution returns URL and credentials only, so its ACP, MCP, and approval consumers cannot receive the local generated TLS fingerprint.
Canonical policy owner: The branch moves existing callGateway pin selection into one resolver with explicit-pin, remote-config/env, and configured-local WSS branches.
Sibling coverage: ACP, MCP bridge, and operator approvals forward the resolved pin; focused tests cover each handoff and the resolver’s remote, CLI, plaintext, and fallback branches.
Findings None None.
Security None None.

How this fits together

Gateway clients resolve a target URL, credentials, and TLS policy before opening a WebSocket to the Gateway. Bootstrap-driven ACP, MCP, and approval clients now receive the same certificate pin as ordinary Gateway calls.

flowchart LR
A[Gateway configuration] --> B[Connection target selection]
B --> C[TLS pin resolver]
C --> D[Bootstrap clients]
D --> E[WebSocket transport]
E --> F[Gateway authentication]
Loading

Decision needed

Question Recommendation
Should the Gateway owner accept extending the existing TLS-pin policy to all bootstrap clients with the reviewed precedence rules? Accept the shared policy: Merge after confirming explicit pins, remote configured/env pins, and local generated pins have the intended trust boundaries.

Why: The implementation is consistent with the existing call path, but the policy determines which self-signed Gateway certificate privileged clients trust.

Before merge

  • Resolve merge risk (P1) - Certificate-pin selection is a trust boundary; a Gateway owner should explicitly accept the preserved explicit, remote, local, and plaintext-fail-closed precedence before merge.
  • Complete next step (P2) - No mechanical repair remains; the maintainer action is to accept or reject the certificate-trust policy extension.
Agent review details

Security

None.

PR surface

Source +57, Tests +289. Total +346 across 14 files.

View PR surface stats
Area Files Added Removed Net
Source 8 83 26 +57
Tests 6 290 1 +289
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 14 373 27 +346

Review metrics

Metric Value Why it matters
Production vs test delta production +83/-26; tests +290/-1 The production growth has a named ownership justification: one shared TLS-policy resolver replaces duplicated call-path policy and serves three existing bootstrap clients.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #41740
Summary: The related approval report reaches the current shared operator-approval client, which this PR changes; the PR also covers ACP and MCP bootstrap clients.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Accept the audited pin policy (recommended)
    Approve the PR after a Gateway owner confirms the tested precedence is the intended certificate-trust contract.
  2. Pause for policy revision
    Keep the PR open if maintainers want a different trust rule for remote or fallback targets before merge.

Technical review

Best possible solution:

Merge the single shared resolver after Gateway-owner sign-off, retaining the tested target-source precedence instead of adding per-client TLS exceptions.

Do we have a high-confidence way to reproduce the issue?

Yes: on current main, a local self-signed WSS Gateway selected through bootstrap has no fingerprint to pass to ACP, MCP, or approval clients; the missing handoff is directly traceable in source.

Is this the best way to solve the issue?

Yes: centralizing the existing call-path policy at the bootstrap boundary prevents three consumers from independently reconstructing certificate-pin rules.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 75ef5aebecb8.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: This repairs a bounded Gateway-client failure for operators using a local self-signed WSS Gateway.
  • merge-risk: 🚨 security-boundary: The change controls which certificate pin bootstrap clients use when establishing privileged Gateway connections.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body records an after-fix local WSS health/ACP run reaching the approval gate, supplemented by exact-head focused tests and hosted CI.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body records an after-fix local WSS health/ACP run reaching the approval gate, supplemented by exact-head focused tests and hosted CI.

Evidence

What I checked:

Likely related people:

  • vincentkoc: Current-main blame attributes the bootstrap and transport paths to recent Gateway work, and Vincent authored the exact-head TLS-policy commits. (role: recent Gateway/bootstrap contributor; confidence: high; commits: 8f2850d83e90, c92ec315341c, 77e562139857; files: src/gateway/client-bootstrap.ts, packages/gateway-client/src/client.ts, src/gateway/tls-fingerprint.ts)
  • steipete: The recent Gateway RPC transport refactor changed the shared bootstrap and approval-client seams this patch extends. (role: recent Gateway RPC refactor author; confidence: medium; commits: 3856b4fa1b35; files: src/gateway/client-bootstrap.ts, src/gateway/operator-approvals-client.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (13 earlier review cycles; latest 8 shown)
  • reviewed 2026-07-09T12:32:22.990Z sha 9824b8acaca47907e7c6e987f63e60c1eba4a282 :: needs changes before merge. :: [P1] Use the current normalization-core import
  • reviewed 2026-07-31T11:40:49.915Z sha 9824b8acaca47907e7c6e987f63e60c1eba4a282 :: found issues before merge. :: [P1] Use the current normalization-core import
  • reviewed 2026-08-04T16:06:04.788Z sha 47552c05e3cef499c56974464dc0de65e9036f38 :: found issues before merge. :: [P3] Remove the release-owned changelog entry
  • reviewed 2026-08-04T19:03:24.387Z sha 002cd6176a53da7eae1000f02757d78402dc8733 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-04T19:17:43.803Z sha 002cd6176a53da7eae1000f02757d78402dc8733 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-05T00:11:15.258Z sha c659021a205fa1e6c9f1ac5a4c8f8f2751d2777c :: needs maintainer review before merge. :: none
  • reviewed 2026-08-05T04:07:13.983Z sha 77e5621 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-05T04:17:21.434Z sha 77e5621 :: needs maintainer review before merge. :: none

@jetd1
jetd1 force-pushed the fix/gateway-bootstrap-tls-fingerprint branch from 6a8726e to c714322 Compare May 10, 2026 09:32
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 10, 2026
@jetd1
jetd1 force-pushed the fix/gateway-bootstrap-tls-fingerprint branch from c714322 to 87de5e7 Compare May 12, 2026 18:09
@jetd1
jetd1 requested a review from a team as a code owner May 12, 2026 18:09
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: nextcloud-talk Channel integration: nextcloud-talk channel: nostr Channel integration: nostr channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: tlon Channel integration: tlon channel: voice-call Channel integration: voice-call channel: whatsapp-web Channel integration: whatsapp-web channel: zalo Channel integration: zalo channel: zalouser Channel integration: zalouser extensions: copilot-proxy Extension: copilot-proxy extensions: diagnostics-otel Extension: diagnostics-otel extensions: llm-task Extension: llm-task extensions: lobster Extension: lobster labels May 12, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

Maintainer rewrite pushed at ebc93486d754755af845f09495da063e873c2d35. Please review that exact head. The PR body now records the focused proof, local fallback gates, autoreview result, and Blacksmith Testbox capacity limitation.

@clawsweeper

clawsweeper Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

Please review exact head 23e46cbc5a7e8669e7cef54d788c598b5b26874f.

The previous rank-up moves are addressed: the release-owned changelog entry is removed, the TLS resolver type is file-local, and the final source review covered explicit, remote, environment, CLI override, local, and fallback pin-selection branches.

@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

Please review exact head c659021a205fa1e6c9f1ac5a4c8f8f2751d2777c, refreshed onto scheduler-fixed main at 9ff9aac71a8bd5ec900a799cb27c9f8b5c6448f0.

The patch range is unchanged apart from collapsing the obsolete changelog add/remove pair. Contributor credit, signed commits, focused TLS proof, and the Punchcard trailer are preserved.

@clawsweeper

clawsweeper Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

vincentkoc and others added 3 commits August 5, 2026 11:47
Co-authored-by: Xiaoshuai Zhang <[email protected]>
Punchcard-Session: cobalt-brook-meadow-m9
Punchcard-Session: cobalt-brook-meadow-m9
Punchcard-Session: cobalt-brook-meadow-m9
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

Please review exact head 77e5621398572bf4e94a7decaeb1d832178c2a6b.

The reviewed patch was replayed onto main at 39bbd8afd338dde0831dea3214cf17f80594ea44. Its stable patch ID remains 9174affea4d45fd5ffb7aa5e31ba054f8b7bd6a8; range-diff changes only add the required Punchcard trailers. All three commits are signed, direct oxfmt/oxlint/diff checks passed, and the PR body/native review artifacts record the final proof and helper stalls.

@clawsweeper

clawsweeper Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: M stale Marked as stale due to inactivity status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants