惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Apple Machine Learning Research
Apple Machine Learning Research
J
Java Code Geeks
博客园 - 聂微东
Microsoft Azure Blog
Microsoft Azure Blog
量子位
T
Tailwind CSS Blog
Vercel News
Vercel News
I
InfoQ
Stack Overflow Blog
Stack Overflow Blog
U
Unit 42
Engineering at Meta
Engineering at Meta
L
LangChain Blog
大猫的无限游戏
大猫的无限游戏
D
Docker
博客园_首页
P
Proofpoint News Feed
月光博客
月光博客
T
The Blog of Author Tim Ferriss
MyScale Blog
MyScale Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Martin Fowler
Martin Fowler
腾讯CDC
N
Netflix TechBlog - Medium
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(android): allow private LAN pairing · openclaw/opencl...
obviyus · 2026-05-28 · via Recent Commits to openclaw:main

File tree

    • main/java/ai/openclaw/app

    • test/java/ai/openclaw/app

Original file line numberDiff line numberDiff line change

@@ -44,7 +44,7 @@ internal fun isLoopbackGatewayHost(

4444

return isMappedIpv4 && address[12] == 127.toByte()

4545

}

4646
47-

internal fun isPrivateLanGatewayHost(

47+

internal fun isLocalCleartextGatewayHost(

4848

rawHost: String?,

4949

allowEmulatorBridgeAlias: Boolean = isAndroidEmulatorRuntime(),

5050

): Boolean {

Original file line numberDiff line numberDiff line change

@@ -632,7 +632,7 @@ class GatewaySession(

632632
633633

private fun shouldPersistBootstrapHandoffTokens(authSource: GatewayConnectAuthSource): Boolean {

634634

if (authSource != GatewayConnectAuthSource.BOOTSTRAP_TOKEN) return false

635-

if (isLoopbackGatewayHost(endpoint.host)) return true

635+

if (isLocalCleartextGatewayHost(endpoint.host)) return true

636636

return tls != null

637637

}

638638

@@ -1212,9 +1212,7 @@ class GatewaySession(

12121212

endpoint: GatewayEndpoint,

12131213

tls: GatewayTlsParams?,

12141214

): Boolean {

1215-

if (isLoopbackGatewayHost(endpoint.host)) {

1216-

return true

1217-

}

1215+

if (isLocalCleartextGatewayHost(endpoint.host)) return true

12181216

return tls?.expectedFingerprint?.trim()?.isNotEmpty() == true

12191217

}

12201218

}

Original file line numberDiff line numberDiff line change

@@ -8,6 +8,7 @@ import ai.openclaw.app.gateway.GatewayClientInfo

88

import ai.openclaw.app.gateway.GatewayConnectOptions

99

import ai.openclaw.app.gateway.GatewayEndpoint

1010

import ai.openclaw.app.gateway.GatewayTlsParams

11+

import ai.openclaw.app.gateway.isLocalCleartextGatewayHost

1112

import ai.openclaw.app.gateway.isLoopbackGatewayHost

1213

import android.os.Build

1314

@@ -35,7 +36,12 @@ class ConnectionManager(

3536

val stableId = endpoint.stableId

3637

val stored = storedFingerprint?.trim().takeIf { !it.isNullOrEmpty() }

3738

val isManual = stableId.startsWith("manual|")

38-

val cleartextAllowedHost = isLoopbackGatewayHost(endpoint.host)

39+

val cleartextAllowedHost =

40+

if (isManual) {

41+

isLocalCleartextGatewayHost(endpoint.host)

42+

} else {

43+

isLoopbackGatewayHost(endpoint.host)

44+

}

3945
4046

if (isManual) {

4147

if (!manualTlsEnabled && cleartextAllowedHost) return null

Original file line numberDiff line numberDiff line change

@@ -1,6 +1,6 @@

11

package ai.openclaw.app.ui

22
3-

import ai.openclaw.app.gateway.isLoopbackGatewayHost

3+

import ai.openclaw.app.gateway.isLocalCleartextGatewayHost

44

import kotlinx.serialization.json.Json

55

import kotlinx.serialization.json.JsonObject

66

import kotlinx.serialization.json.JsonPrimitive

@@ -56,9 +56,9 @@ internal data class GatewayScannedSetupCodeResult(

5656
5757

private val gatewaySetupJson = Json { ignoreUnknownKeys = true }

5858

private const val remoteGatewaySecurityRule =

59-

"Tailscale and public mobile nodes require wss:// or Tailscale Serve. ws:// is allowed only for localhost and the Android emulator."

59+

"Public gateways require wss:// or Tailscale Serve. ws:// is allowed for localhost, the Android emulator, and private LAN IPs."

6060

private const val remoteGatewaySecurityFix =

61-

"Use localhost/the Android emulator, or enable Tailscale Serve / expose a wss:// gateway URL."

61+

"Use a private LAN IP for local setup, or enable Tailscale Serve / expose a wss:// gateway URL for remote access."

6262
6363

internal fun resolveGatewayConnectConfig(

6464

useSetupCode: Boolean,

@@ -147,7 +147,7 @@ internal fun parseGatewayEndpointResult(rawInput: String): GatewayEndpointParseR

147147

return GatewayEndpointParseResult(error = GatewayEndpointValidationError.INVALID_URL)

148148

}

149149

val tls = scheme == "wss" || scheme == "https"

150-

if (!tls && !isLoopbackGatewayHost(host)) {

150+

if (!tls && !isLocalCleartextGatewayHost(host)) {

151151

return GatewayEndpointParseResult(error = GatewayEndpointValidationError.INSECURE_REMOTE_URL)

152152

}

153153

val defaultPort = if (tls) 443 else 18789

Original file line numberDiff line numberDiff line change

@@ -51,7 +51,7 @@ internal fun buildGatewayDiagnosticsReport(

5151

Please:

5252

- pick one route only: same machine, same LAN, Tailscale, or public URL

5353

- classify this as pairing/auth, TLS trust, wrong advertised route, wrong address/port, or gateway down

54-

- remember: Tailscale/public mobile routes require wss:// or Tailscale Serve; ws:// is loopback-only

54+

- remember: public routes require wss:// or Tailscale Serve; ws:// is allowed for localhost, the Android emulator, and private LAN IPs

5555

- quote the exact app status/error below

5656

- tell me whether `openclaw devices list` should show a pending pairing request

5757

- if more signal is needed, ask for `openclaw qr --json`, `openclaw devices list`, and `openclaw nodes status`

Original file line numberDiff line numberDiff line change

@@ -4,8 +4,8 @@ import ai.openclaw.app.LocationMode

44

import ai.openclaw.app.SecurePrefs

55

import ai.openclaw.app.VoiceWakeMode

66

import ai.openclaw.app.gateway.GatewayEndpoint

7+

import ai.openclaw.app.gateway.isLocalCleartextGatewayHost

78

import ai.openclaw.app.gateway.isLoopbackGatewayHost

8-

import ai.openclaw.app.gateway.isPrivateLanGatewayHost

99

import ai.openclaw.app.protocol.OpenClawCallLogCommand

1010

import ai.openclaw.app.protocol.OpenClawCameraCommand

1111

import ai.openclaw.app.protocol.OpenClawCapability

@@ -109,7 +109,7 @@ class ConnectionManagerTest {

109109

}

110110
111111

@Test

112-

fun resolveTlsParamsForEndpoint_manualPrivateLanForcesTlsWhenToggleIsOff() {

112+

fun resolveTlsParamsForEndpoint_manualPrivateLanRespectsManualTlsToggle() {

113113

val endpoint = GatewayEndpoint.manual(host = "192.168.1.20", port = 18789)

114114
115115

val params =

@@ -119,9 +119,7 @@ class ConnectionManagerTest {

119119

manualTlsEnabled = false,

120120

)

121121
122-

assertEquals(true, params?.required)

123-

assertNull(params?.expectedFingerprint)

124-

assertEquals(false, params?.allowTOFU)

122+

assertNull(params)

125123

}

126124
127125

@Test

@@ -245,11 +243,11 @@ class ConnectionManagerTest {

245243

}

246244
247245

@Test

248-

fun isPrivateLanGatewayHost_acceptsLanIpsButRejectsMdnsAndTailnetHosts() {

249-

assertTrue(isPrivateLanGatewayHost("192.168.1.20"))

250-

assertFalse(isPrivateLanGatewayHost("gateway.local"))

251-

assertFalse(isPrivateLanGatewayHost("100.64.0.9"))

252-

assertFalse(isPrivateLanGatewayHost("gateway.tailnet.ts.net"))

246+

fun isLocalCleartextGatewayHost_acceptsLanIpsButRejectsMdnsAndTailnetHosts() {

247+

assertTrue(isLocalCleartextGatewayHost("192.168.1.20"))

248+

assertFalse(isLocalCleartextGatewayHost("gateway.local"))

249+

assertFalse(isLocalCleartextGatewayHost("100.64.0.9"))

250+

assertFalse(isLocalCleartextGatewayHost("gateway.tailnet.ts.net"))

253251

}

254252
255253

@Test

Original file line numberDiff line numberDiff line change

@@ -99,9 +99,18 @@ class GatewayConfigResolverTest {

9999

}

100100
101101

@Test

102-

fun parseGatewayEndpointRejectsPrivateLanCleartextWsUrls() {

102+

fun parseGatewayEndpointAllowsPrivateLanCleartextWsUrls() {

103103

val parsed = parseGatewayEndpoint("ws://192.168.1.20:18789")

104-

assertNull(parsed)

104+
105+

assertEquals(

106+

GatewayEndpointConfig(

107+

host = "192.168.1.20",

108+

port = 18789,

109+

tls = false,

110+

displayUrl = "http://192.168.1.20:18789",

111+

),

112+

parsed,

113+

)

105114

}

106115
107116

@Test

@@ -146,9 +155,13 @@ class GatewayConfigResolverTest {

146155

}

147156
148157

@Test

149-

fun parseGatewayEndpointRejectsLinkLocalIpv6ZoneCleartextWsUrls() {

158+

fun parseGatewayEndpointAllowsLinkLocalIpv6ZoneCleartextWsUrls() {

150159

val parsed = parseGatewayEndpoint("ws://[fe80::1%25eth0]")

151-

assertNull(parsed)

160+
161+

assertEquals("fe80::1%25eth0", parsed?.host)

162+

assertEquals(18789, parsed?.port)

163+

assertEquals(false, parsed?.tls)

164+

assertEquals("http://[fe80::1%25eth0]:18789", parsed?.displayUrl)

152165

}

153166
154167

@Test

@@ -249,6 +262,16 @@ class GatewayConfigResolverTest {

249262

assertNull(resolved)

250263

}

251264
265+

@Test

266+

fun resolveScannedSetupCodeAcceptsPrivateLanCleartextGateway() {

267+

val setupCode =

268+

encodeSetupCode("""{"url":"ws://192.168.31.100:18789","bootstrapToken":"bootstrap-1"}""")

269+
270+

val resolved = resolveScannedSetupCode(setupCode)

271+
272+

assertEquals(setupCode, resolved)

273+

}

274+
252275

@Test

253276

fun resolveScannedSetupCodeResultFlagsInsecureRemoteGateway() {

254277

val setupCode =

@@ -277,10 +300,19 @@ class GatewayConfigResolverTest {

277300

}

278301
279302

@Test

280-

fun parseGatewayEndpointResultFlagsInsecureLanCleartextGateway() {

303+

fun parseGatewayEndpointResultAllowsPrivateLanCleartextGateway() {

281304

val parsed = parseGatewayEndpointResult("ws://192.168.1.20:18789")

282-

assertNull(parsed.config)

283-

assertEquals(GatewayEndpointValidationError.INSECURE_REMOTE_URL, parsed.error)

305+
306+

assertEquals(

307+

GatewayEndpointConfig(

308+

host = "192.168.1.20",

309+

port = 18789,

310+

tls = false,

311+

displayUrl = "http://192.168.1.20:18789",

312+

),

313+

parsed.config,

314+

)

315+

assertNull(parsed.error)

284316

}

285317
286318

@Test

@@ -421,7 +453,7 @@ class GatewayConfigResolverTest {

421453

}

422454
423455

@Test

424-

fun resolveGatewayConnectConfigRejectsPrivateLanManualCleartextEndpoint() {

456+

fun resolveGatewayConnectConfigAllowsPrivateLanManualCleartextEndpoint() {

425457

val resolved =

426458

resolveGatewayConnectConfig(

427459

useSetupCode = false,

@@ -437,7 +469,9 @@ class GatewayConfigResolverTest {

437469

fallbackPassword = "",

438470

)

439471
440-

assertNull(resolved)

472+

assertEquals("192.168.31.100", resolved?.host)

473+

assertEquals(18789, resolved?.port)

474+

assertEquals(false, resolved?.tls)

441475

}

442476
443477

@Test