Skip to content

Commit 771ddcf

Browse files
committed
fix(android): trust private LAN credentials
1 parent 5f3d6cd commit 771ddcf

3 files changed

Lines changed: 5 additions & 9 deletions

File tree

apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewaySession.kt

Lines changed: 2 additions & 4 deletions
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
}

apps/android/app/src/main/java/ai/openclaw/app/node/ConnectionManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class ConnectionManager(
4444
}
4545

4646
if (isManual) {
47+
if (!manualTlsEnabled && cleartextAllowedHost) return null
4748
if (!stored.isNullOrBlank()) {
4849
return GatewayTlsParams(
4950
required = true,
@@ -52,7 +53,6 @@ class ConnectionManager(
5253
stableId = stableId,
5354
)
5455
}
55-
if (!manualTlsEnabled && cleartextAllowedHost) return null
5656
return GatewayTlsParams(
5757
required = true,
5858
expectedFingerprint = null,

apps/android/app/src/test/java/ai/openclaw/app/node/ConnectionManagerTest.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class ConnectionManagerTest {
123123
}
124124

125125
@Test
126-
fun resolveTlsParamsForEndpoint_manualPrivateLanPreservesStoredPin() {
126+
fun resolveTlsParamsForEndpoint_manualPrivateLanCleartextCanOverrideStoredPin() {
127127
val endpoint = GatewayEndpoint.manual(host = "192.168.1.20", port = 18789)
128128

129129
val params =
@@ -133,9 +133,7 @@ class ConnectionManagerTest {
133133
manualTlsEnabled = false,
134134
)
135135

136-
assertEquals(true, params?.required)
137-
assertEquals("pinned", params?.expectedFingerprint)
138-
assertEquals(false, params?.allowTOFU)
136+
assertNull(params)
139137
}
140138

141139
@Test

0 commit comments

Comments
 (0)