Skip to content

fix(gateway): normalize TLS certificate pins - #125276

Merged
steipete merged 2 commits into
mainfrom
steipete/tls-pin-normalization
Aug 17, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/tls-pin-normalization

Conversation

@steipete

@steipete steipete commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Live WAN verification on 2026-08-17 (access-live-2026-08-17/REPORT.md) found that a node host accepted a pinned self-signed Gateway certificate when the pin used sha256:<hex>, but worker admission on /__openclaw__/worker rejected the same certificate with gateway tls fingerprint mismatch. Raw or colon-separated hex worked on both paths, so pairing appeared healthy before worker dispatch failed.

The direct worker path added in #122683 used the gateway-client package fallback normalizer, while the node-host facade injected a second, prefix-aware normalizer. The two connection paths therefore compared different strings for the same certificate.

Why This Change Was Made

packages/gateway-client/src/client-address-utils.ts now owns strict TLS-pin normalization. It accepts bare hex, colon-separated hex, and a case-insensitive sha256: prefix, then returns exactly 64 lowercase hexadecimal characters. Short, malformed, and non-hex pins are rejected before certificate verification is disabled.

Every TypeScript TLS-pin comparison now uses that owner. The duplicate core normalizer and node-host-only override are removed, while pairing payloads, generic Gateway resolution, node run/install flags, and worker endpoint parsing canonicalize through the shared contract. The worker descriptor stores the canonical pin, so downstream bundle, workspace, desktop-stream, health-probe, and worker WebSocket paths cannot diverge by display spelling.

Production LOC: +110/-68 (net +42) | Tests: +315/-106. The production growth is the explicit security/input boundary for strict 32-byte validation plus user-visible CLI/pairing rejection; the duplicate normalizer and host-only override were deleted.

User Impact

Pinned self-signed or private-CA deployments can use the documented sha256: spelling without a worker-only dispatch failure. All accepted spellings authenticate identically on the node-host and worker paths. Invalid pins and genuinely different certificate fingerprints still fail closed.

Evidence

  • Pre-fix regression: the exact node-host/worker parity test failed only on the worker path for sha256:<hex>; the owner table also failed for prefixed, short, malformed, and non-hex inputs.
  • Live WAN finding: the prefixed pin authenticated the main node WebSocket and HTTP transfers, but three worker launch rows failed with gateway tls fingerprint mismatch; changing only the spelling to raw colon-delimited SHA-256 completed the worker turn.
  • Focused owner/parity suite passed three consecutive times (normalizer, package transport, node-host/worker parity, worker descriptor, pairing, node run CLI, and generic Gateway resolution).
  • pnpm check:changed
  • pnpm build
  • git diff --check
  • Final Codex autoreview: no accepted/actionable findings.
  • Initial CI identified stale short/non-hex fixtures in four sibling client surfaces; the exact failed files now pass with valid 64-hex fixtures.

The temporary WAN edge, ports, firewall rule, and scratch state were removed at the end of the cited live run, so the exact authenticated WAN topology was not recreated for this patch. The regression now exercises both TLS identity checking and the worker post-open socket validation with the same accepted pins and wrong-pin negative.

@clawsweeper

clawsweeper Bot commented Aug 17, 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 17, 2026 12:40
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime cli CLI command changes commands Command implementations size: L maintainer Maintainer-authored PR labels Aug 17, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready at b243f112c29fa5e0eb4527988f32ca4e884ffe34.

Verification completed:

  • focused owner/parity suite passed three consecutive times: gateway-client normalizer and transport, node-host/worker TLS parity, worker descriptor, pairing payload, node run CLI, and Gateway bootstrap;
  • CI-discovered sibling fixtures were corrected and the exact failed files passed: src/gateway/call.test.ts, src/tui/gateway-chat.connection.test.ts, src/gateway/client.test.ts, and src/cli/run-main.exit.test.ts;
  • pnpm check:changed passed on the rebased code head;
  • pnpm build passed;
  • git diff --check passed;
  • final Codex autoreview reported no accepted/actionable findings;
  • exact-head CI run 32031924768 is green;
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 125276 passed using the hosted exact-head/recent-parent gate.

The 2026-08-17 live WAN report is the before-fix behavior proof. Its temporary edge, ports, firewall rule, and scratch state were removed after that run, so the identical authenticated WAN topology was not recreated. The regression exercises the same node-host and worker TLS identity/post-open validation paths with accepted pins and a wrong-pin negative.

The latest ClawSweeper comment is the pickup acknowledgment only; it contains no findings or Rank-up moves.

@steipete
steipete merged commit 11ebdfc into main Aug 17, 2026
218 checks passed
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete
steipete deleted the steipete/tls-pin-normalization branch August 17, 2026 13:03
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 18, 2026
* fix(gateway): normalize TLS certificate pins

* test(gateway): use valid TLS pin fixtures
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations gateway Gateway runtime maintainer Maintainer-authored PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant