Skip to content

fix(onboard): probe remote gateways with saved TLS pins and validate trusted proxies - #131475

Merged
steipete merged 3 commits into
mainfrom
steipete/wizard-probe-validation
Aug 28, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/wizard-probe-validation

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Important

review-required: TLS trust + auth-config surface. Prepared under the auto-QA campaign; onboarding TLS trust and trusted-proxy validation are review-required, so this stays a draft for maintainer review.

What Problem This Solves

Two onboarding/configure-wizard hardening gaps found by deep-review passes:

  1. Readiness probes ignored saved TLS pins (src/gateway/probe.ts): after configuring a pinned self-signed remote gateway (pin preserved by the TLS-pin work in fix(onboard): preserve the remote gateway TLS pin for an unchanged endpoint #131042), the wizard's own readiness probe built its connection without forwarding that pin, so it failed to verify — or trusted differently than the runtime would. The probe now forwards the saved pin, but only for the exact configured URL (trim-normalized): a different host, port, path, query, or case cannot acquire another endpoint's pin, and a mid-wizard URL override cannot relabel an old pin onto its new target. The same fix also repairs configure --section health, whose readiness poll discarded all connection inputs except URL/token/password.
  2. Trusted-proxy prompt accepted malformed IP/CIDR (src/commands/configure.gateway.ts): the prompt only rejected blank input, so a malformed address could be written to config that the runtime then silently never matches. It now validates every entry with the same canonical parser the runtime uses (parseIpAddressOrCidr, extracted from the existing isIpInCidr implementation in packages/net-policy), rejecting junk with an actionable message. This also fixes a connected loopback-consent miss: the runtime accepts 127.1/8, but the old string-split+canonical-IP path missed its loopback identity, so consent wasn't prompted.

Why This Change Was Made

Both fixes land at the producer: pin selection at the probe connection producer (one place, so status/daemon/future callers stay consistent), and address validation via the runtime's own parser (no second regex that could diverge from matching semantics). The parser extraction is behavior-preserving — verified against installed ipaddr.js 2.5.0 with a 19,950-combination parity probe (zero mismatches, zero throws) and confirmed byte-identical by the deep review.

The consent predicate now checks the parsed base plus IPv4/IPv6 loopback representatives through both runtime loopback classification and isTrustedProxyAddress, covering subnets within loopback and ranges containing it (126.0.0.0/7, ::/127, ::/0) without substituting hand-rolled CIDR arithmetic for runtime semantics.

User Impact

Configuring a pinned remote gateway through the wizard now verifies readiness with the runtime's exact trust; a malformed trusted-proxy entry is rejected at the prompt with guidance instead of silently never matching; loopback consent is asked whenever the entry actually matches loopback.

Evidence

  • Production net +15 (exact-endpoint trust binding + shared runtime parser + consent/readiness alignment); tests net +236; docs +5. No config option, schema, or persistence change.
  • Failing-first: three containing-range consent cases, a scoped-address over-consent, the remote-health config loss, and ten malformed trusted-proxy inputs each reproduced then fixed; real self-signed TLS fixture proves rejected trust sends no connect frames.
  • Rebased onto current main (which includes the landed TLS pin-before-upgrade fix fix(gateway-client): verify TLS pin before websocket upgrade #131435); the shared probe.tls.test.ts was union-merged with the transport PR's cases — 48 TLS/worker tests green including the zero-byte exposure assertions, proving pin forwarding does not reintroduce pre-pin bytes.
  • 19,950-combination ipaddr.js parity probe; post-rebase focused suites green; changed-file gate exit 0; two Codex autoreviews clean.
  • Named follow-ups (not here): local-listener generated-certificate readiness (waitForGatewayReachable carries no pins); bootstrap environment-override pin contract vs exact-target diagnostics; mapped-IPv4 CIDR prefix interpretation.

@clawsweeper

clawsweeper Bot commented Aug 28, 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: L maintainer Maintainer-authored PR labels Aug 28, 2026
@clawsweeper clawsweeper Bot added 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. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 28, 2026
@clawsweeper

clawsweeper Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 4:42 PM ET / 20:42 UTC.

ClawSweeper review

What this changes

The PR carries saved remote TLS pins through onboarding and configure readiness probes, validates trusted-proxy addresses with the runtime parser, and prompts for loopback consent whenever runtime matching can reach loopback.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open for gateway-security maintainer review. The submitted head fixes a real caller-side gap still present on fetched main; no introduced correctness defect was found, but the TLS-pin and loopback-consent trust boundary merits explicit confirmation.

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

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has focused boundary coverage and no actionable defect, while the altered security contract appropriately awaits maintainer confirmation.
Proof confidence 🌊 off-meta tidepool Not applicable: The repository state identifies this as a member-authored PR, so the external-contributor proof gate does not apply; checked-in tests nevertheless exercise the production probe owner through a real self-signed TLS socket and polling entrypoint.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The repository state identifies this as a member-authored PR, so the external-contributor proof gate does not apply; checked-in tests nevertheless exercise the production probe owner through a real self-signed TLS socket and polling entrypoint.
Evidence reviewed 7 items Current main lacks saved-pin forwarding: Fetched main passes only an explicit probe fingerprint to GatewayClient; it does not select the saved remote TLS fingerprint for a configured probe.
Introduced probe binding: The PR selects the saved fingerprint only when the trimmed probe URL exactly equals the configured remote URL, while retaining explicit-pin precedence.
Caller and polling path: Remote health checks pass configuration into polling, and polling now preserves all probe parameters instead of reconstructing URL/token/password only.
Findings None None.
Security None None.

How this fits together

Gateway setup saves a remote endpoint and its trust material, then probes that endpoint before reporting readiness. Trusted-proxy setup saves source ranges which Gateway authentication later checks before accepting proxy-provided identity headers.

flowchart LR
  A[Setup or configure] --> B[Remote endpoint settings]
  B --> C[Gateway readiness probe]
  C --> D[Remote TLS connection]
  A --> E[Trusted proxy ranges]
  E --> F[Gateway authorization]
  D --> G[Operator result]
  F --> G
Loading

Decision needed

Question Recommendation
Should a saved remote TLS pin apply only to the trim-identical configured URL, and should loopback consent be required whenever a configured trusted-proxy range can match loopback at runtime? Confirm the strict boundary: Keep the PR’s exact saved-pin binding and runtime-matching loopback-consent predicate.

Why: This is an intentional security boundary in setup behavior, not a mechanical compatibility detail that review automation can choose.

Before merge

  • Resolve merge risk (P1) - Certificate-pin selection and loopback trusted-proxy consent are security-sensitive setup semantics; maintainers should explicitly affirm the trim-identical URL scope and runtime-matching consent predicate before merge.
  • Resolve merge risk (P1) - Production changes are +15 net lines, justified by one shared parser and preserved probe inputs; no smaller absorbing refactor was evident in the existing owners.
  • Complete next step (P2) - A maintainer must confirm the intended TLS and proxy trust boundary; there is no narrow mechanical repair remaining.
Agent review details

Security

None.

PR surface

Source +15, Tests +236, Docs +5. Total +256 across 15 files.

View PR surface stats
Area Files Added Removed Net
Source 6 71 56 +15
Tests 6 307 71 +236
Docs 3 9 4 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 15 387 131 +256

Review metrics

Metric Value Why it matters
Production versus test delta production +71/-56 (net +15); tests +307/-71 (net +236); docs +9/-4 The small production increase implements shared parsing and preserves probe inputs; the larger test delta covers TLS and authorization boundaries.

Merge-risk options

Maintainer options:

  1. Confirm the trust boundary before merge (recommended)
    Have a gateway-security owner affirm the saved-pin URL scope and loopback-consent rule exercised by this PR.
  2. Pause for a different URL scope
    If certificate pins should follow a canonicalized endpoint instead, revise the owner logic, tests, and docs before merge.

Technical review

Best possible solution:

Retain one readiness-probe path that receives the saved remote configuration and one parser shared with runtime matching, with the selected URL-scope and loopback-consent contract explicitly confirmed.

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

Yes, from source: current main’s probe accepts only an explicit pin while these setup callers have the saved remote configuration; the exact-head TLS fixture exercises the repaired polling path.

Is this the best way to solve the issue?

Yes, subject to the maintainer security choice: passing the existing configuration into the existing probe and extracting its parser avoids parallel TLS or CIDR logic in wizard callers.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 4c6ed51733d3.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • remove proof: sufficient: Current real behavior proof status is not_applicable, not sufficient.
  • remove rating: 🦞 diamond lobster: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This repairs bounded remote setup and trusted-proxy configuration behavior, without an observed default-runtime outage.
  • merge-risk: 🚨 security-boundary: Merging changes saved certificate-pin selection and the condition for authorizing loopback proxy identity headers.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository state identifies this as a member-authored PR, so the external-contributor proof gate does not apply; checked-in tests nevertheless exercise the production probe owner through a real self-signed TLS socket and polling entrypoint.

Evidence

What I checked:

  • Current main lacks saved-pin forwarding: Fetched main passes only an explicit probe fingerprint to GatewayClient; it does not select the saved remote TLS fingerprint for a configured probe. (src/gateway/probe.ts:428, 4c6ed51733d3)
  • Introduced probe binding: The PR selects the saved fingerprint only when the trimmed probe URL exactly equals the configured remote URL, while retaining explicit-pin precedence. (src/gateway/probe.ts:428, ea46bf57cd4e)
  • Caller and polling path: Remote health checks pass configuration into polling, and polling now preserves all probe parameters instead of reconstructing URL/token/password only. (src/commands/configure.wizard.ts:162, ea46bf57cd4e)
  • Runtime authorization alignment: Runtime trusted-proxy matching delegates each configured address/range to isIpInCidr; the new wizard validator shares that parsing path and its loopback check uses the same matcher. (src/gateway/net.ts:196, ea46bf57cd4e)
  • Boundary-level test coverage: The TLS fixture runs a real self-signed HTTPS/WebSocket server, verifies saved-pin polling succeeds, and asserts failed pin paths send no application bytes or connect frame. (src/gateway/probe.tls.test.ts:172, ea46bf57cd4e)
  • Feature provenance: The baseline probe and trusted-proxy prompt lines date to the current gateway implementation commit; the PR directly changes those lines rather than adding a downstream workaround. (src/gateway/probe.ts:428, 7a6a7945cecb)

Likely related people:

  • steipete: Current-main blame identifies Peter Steinberger on the original probe and trusted-proxy prompt; the submitted commits continue work in both owners. (role: recent gateway and configuration contributor; confidence: high; commits: 7a6a7945cecb, 0dad0a7b98b1, 214e8a1e3b79; files: src/gateway/probe.ts, src/commands/configure.gateway.ts, packages/net-policy/src/ip.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Confirm the saved-pin URL scope and loopback-consent policy before merge.

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 (1 earlier review cycle)
  • reviewed 2026-08-28T03:39:24.791Z sha 6aec88a :: needs maintainer review before merge. :: none

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.
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.
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.
@steipete
steipete force-pushed the steipete/wizard-probe-validation branch from 6aec88a to ea46bf5 Compare August 28, 2026 20:23
@steipete
steipete marked this pull request as ready for review August 28, 2026 20:23
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Aug 28, 2026
@steipete
steipete merged commit 3645cde into main Aug 28, 2026
295 of 304 checks passed
@steipete
steipete deleted the steipete/wizard-probe-validation branch August 28, 2026 21:27
@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 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.
obviyus added a commit that referenced this pull request Sep 8, 2026
Closes #137665
Related: #131475

## What Problem This Solves

Fixes an issue where an accepted IPv4-mapped CIDR such as `::ffff:10.0.0.0/104` rejected proxy addresses that belong to the equivalent `10.0.0.0/8` range. Proxied requests returned HTTP 403 `proxy_attribution_required`. The same matcher left eligible node pairing requests pending for mapped `autoApproveCidrs` and `sshVerify.cidrs` entries.

## Why This Change Was Made

Normalize the prefix into IPv4's bit space before the existing IPv4 match. The shared matcher now handles plain and mapped ranges in one path, without a second mapped-address matcher. Exact addresses, native IPv6, parsing, and downstream authorization keep their existing paths.

## User Impact

Mapped `/104`, `/120`, and `/128` ranges behave like IPv4 `/8`, `/24`, and exact addresses. Prefixes at or below `/96` cover all IPv4, including loopback; the wizard keeps its explicit loopback-consent prompt. Native IPv6 peers do not match mapped ranges. Keep proxy allowlists narrow: a catch-all still consumes every IPv4 forwarded hop and cannot attribute a client through that chain.

Automatic pairing still requires a fresh, signed, scopeless node request. Roles, scopes, browser requests, manual approval, and SSH host/device identity checks retain their own gates. No configuration field, schema, dependency, or permission policy is added.

## Evidence

Real source Gateway and CLI runs use isolated documentation-address peers, a real overwriting loopback reverse proxy, TLS, and actual SSH reading `openclaw node identity --json`.

| Caller | Pinned main | Repair |
| --- | --- | --- |
| Matching mapped proxy range | HTTP 403 | HTTP 200 from protected `/v1/models` |
| Plain equivalent proxy range | HTTP 200 | HTTP 200 |
| Nearby nonmatching proxy range | HTTP 403 | HTTP 403 |
| Matching mapped node auto-approval range | Manual pending | Approved via trusted CIDR and connected |
| Matching mapped SSH-verification range | Manual pending | SSH verified and connected |

Additional real controls cover `/64`, `/95`, `/96`, `/104`, `/128`, exact nonmatches, native IPv6, loopback consent, missing/disallowed identities, missing headers, invalid/loopback forwarded clients, origin allow/deny, scope caps, and SSH identity/key failures. Signed WebSocket checks retain manual role upgrades, scoped/browser requests, signature rejection, and manual read-only enrollment. The enrolled operator can read after restart and cannot invoke an administrative write. CIDR device pairing retains separate capability approval.

The three focused regression files show nine intended failures on main and 123 passes with the repair. Another 232 focused network/pairing/SSH tests pass. The exact installed ipaddr.js 2.5.0 source was inspected: IPv4 matching consumes 32 bits, so mapped prefixes must subtract 96.

Paired runtime proof uses main `1a7224b69f09b8e7a9edb8d9de27c3c534397f1e` plus this repair, preserving newer Gateway callers. The changed matcher has exact byte identity with the candidate; the old contributor branch retains its ancestry. The contributor-based tree separately passes its own runtime build, formatter check, and 120 focused tests with its pinned dependencies. An independent validator completed 47 fresh runtime cases without an observed defect; source, historical, wizard-presentation, broader-policy and cleanup observations are assessed separately rather than claimed as independent passes. Historical setup and probe-assumption corrections remain recorded privately.

AI-assisted.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 9, 2026
Closes openclaw#137665
Related: openclaw#131475

## What Problem This Solves

Fixes an issue where an accepted IPv4-mapped CIDR such as `::ffff:10.0.0.0/104` rejected proxy addresses that belong to the equivalent `10.0.0.0/8` range. Proxied requests returned HTTP 403 `proxy_attribution_required`. The same matcher left eligible node pairing requests pending for mapped `autoApproveCidrs` and `sshVerify.cidrs` entries.

## Why This Change Was Made

Normalize the prefix into IPv4's bit space before the existing IPv4 match. The shared matcher now handles plain and mapped ranges in one path, without a second mapped-address matcher. Exact addresses, native IPv6, parsing, and downstream authorization keep their existing paths.

## User Impact

Mapped `/104`, `/120`, and `/128` ranges behave like IPv4 `/8`, `/24`, and exact addresses. Prefixes at or below `/96` cover all IPv4, including loopback; the wizard keeps its explicit loopback-consent prompt. Native IPv6 peers do not match mapped ranges. Keep proxy allowlists narrow: a catch-all still consumes every IPv4 forwarded hop and cannot attribute a client through that chain.

Automatic pairing still requires a fresh, signed, scopeless node request. Roles, scopes, browser requests, manual approval, and SSH host/device identity checks retain their own gates. No configuration field, schema, dependency, or permission policy is added.

## Evidence

Real source Gateway and CLI runs use isolated documentation-address peers, a real overwriting loopback reverse proxy, TLS, and actual SSH reading `openclaw node identity --json`.

| Caller | Pinned main | Repair |
| --- | --- | --- |
| Matching mapped proxy range | HTTP 403 | HTTP 200 from protected `/v1/models` |
| Plain equivalent proxy range | HTTP 200 | HTTP 200 |
| Nearby nonmatching proxy range | HTTP 403 | HTTP 403 |
| Matching mapped node auto-approval range | Manual pending | Approved via trusted CIDR and connected |
| Matching mapped SSH-verification range | Manual pending | SSH verified and connected |

Additional real controls cover `/64`, `/95`, `/96`, `/104`, `/128`, exact nonmatches, native IPv6, loopback consent, missing/disallowed identities, missing headers, invalid/loopback forwarded clients, origin allow/deny, scope caps, and SSH identity/key failures. Signed WebSocket checks retain manual role upgrades, scoped/browser requests, signature rejection, and manual read-only enrollment. The enrolled operator can read after restart and cannot invoke an administrative write. CIDR device pairing retains separate capability approval.

The three focused regression files show nine intended failures on main and 123 passes with the repair. Another 232 focused network/pairing/SSH tests pass. The exact installed ipaddr.js 2.5.0 source was inspected: IPv4 matching consumes 32 bits, so mapped prefixes must subtract 96.

Paired runtime proof uses main `db7fff94b0f516759efdb04f47fc4d2fc65996a7` plus this repair, preserving newer Gateway callers. The changed matcher has exact byte identity with the candidate; the old contributor branch retains its ancestry. The contributor-based tree separately passes its own runtime build, formatter check, and 120 focused tests with its pinned dependencies. An independent validator completed 47 fresh runtime cases without an observed defect; source, historical, wizard-presentation, broader-policy and cleanup observations are assessed separately rather than claimed as independent passes. Historical setup and probe-assumption corrections remain recorded privately.

AI-assisted.

Co-authored-by: Ayaan Zaidi <[email protected]>
necromman pushed a commit to necromman/openclaw that referenced this pull request Sep 16, 2026
Closes openclaw#137665
Related: openclaw#131475

## What Problem This Solves

Fixes an issue where an accepted IPv4-mapped CIDR such as `::ffff:10.0.0.0/104` rejected proxy addresses that belong to the equivalent `10.0.0.0/8` range. Proxied requests returned HTTP 403 `proxy_attribution_required`. The same matcher left eligible node pairing requests pending for mapped `autoApproveCidrs` and `sshVerify.cidrs` entries.

## Why This Change Was Made

Normalize the prefix into IPv4's bit space before the existing IPv4 match. The shared matcher now handles plain and mapped ranges in one path, without a second mapped-address matcher. Exact addresses, native IPv6, parsing, and downstream authorization keep their existing paths.

## User Impact

Mapped `/104`, `/120`, and `/128` ranges behave like IPv4 `/8`, `/24`, and exact addresses. Prefixes at or below `/96` cover all IPv4, including loopback; the wizard keeps its explicit loopback-consent prompt. Native IPv6 peers do not match mapped ranges. Keep proxy allowlists narrow: a catch-all still consumes every IPv4 forwarded hop and cannot attribute a client through that chain.

Automatic pairing still requires a fresh, signed, scopeless node request. Roles, scopes, browser requests, manual approval, and SSH host/device identity checks retain their own gates. No configuration field, schema, dependency, or permission policy is added.

## Evidence

Real source Gateway and CLI runs use isolated documentation-address peers, a real overwriting loopback reverse proxy, TLS, and actual SSH reading `openclaw node identity --json`.

| Caller | Pinned main | Repair |
| --- | --- | --- |
| Matching mapped proxy range | HTTP 403 | HTTP 200 from protected `/v1/models` |
| Plain equivalent proxy range | HTTP 200 | HTTP 200 |
| Nearby nonmatching proxy range | HTTP 403 | HTTP 403 |
| Matching mapped node auto-approval range | Manual pending | Approved via trusted CIDR and connected |
| Matching mapped SSH-verification range | Manual pending | SSH verified and connected |

Additional real controls cover `/64`, `/95`, `/96`, `/104`, `/128`, exact nonmatches, native IPv6, loopback consent, missing/disallowed identities, missing headers, invalid/loopback forwarded clients, origin allow/deny, scope caps, and SSH identity/key failures. Signed WebSocket checks retain manual role upgrades, scoped/browser requests, signature rejection, and manual read-only enrollment. The enrolled operator can read after restart and cannot invoke an administrative write. CIDR device pairing retains separate capability approval.

The three focused regression files show nine intended failures on main and 123 passes with the repair. Another 232 focused network/pairing/SSH tests pass. The exact installed ipaddr.js 2.5.0 source was inspected: IPv4 matching consumes 32 bits, so mapped prefixes must subtract 96.

Paired runtime proof uses main `1a7224b69f09b8e7a9edb8d9de27c3c534397f1e` plus this repair, preserving newer Gateway callers. The changed matcher has exact byte identity with the candidate; the old contributor branch retains its ancestry. The contributor-based tree separately passes its own runtime build, formatter check, and 120 focused tests with its pinned dependencies. An independent validator completed 47 fresh runtime cases without an observed defect; source, historical, wizard-presentation, broader-policy and cleanup observations are assessed separately rather than claimed as independent passes. Historical setup and probe-assumption corrections remain recorded privately.

AI-assisted.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit 7069a47)
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 merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

1 participant