-
-
Notifications
You must be signed in to change notification settings - Fork 128
fix: Storage safety, gateway stability, auth UX, canvas, deps (#21, #54, #55, #56, #59, #60, #61, #63, #64, #65, #66, #67) #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 14 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
a89e595
feat: Serial over BT/USB (#21), log timestamps (#54), ADB backup (#55)
mithun50 a94c515
fix: Node capabilities not available to AI (#56)
mithun50 448d679
docs: Add #56 fix to changelog
mithun50 1201009
feat: Check for Updates menu option (#59)
mithun50 0c94229
docs: Add #59 update check to changelog
mithun50 720d89d
fix: Terminal ENTER key (#58), ADB backup (#55), background capabilit…
mithun50 5e8144f
fix: Remove invalid exclude rules from backup XML (#55)
mithun50 0140474
fix: SSHD crash with VPN (#61), DNS resolution (#60)
mithun50 67a3969
fix: Kill stale gateway processes before starting new instance (#60)
mithun50 1f41fe7
fix: Prevent deleteRecursively from following symlinks (data loss)
mithun50 5980af5
fix: Include models array in provider config (#60)
mithun50 ecd552f
revert: Remove pkill before gateway start
mithun50 60852aa
fix: Prevent duplicate gateway instances via port check (#60)
mithun50 3618c93
fix: Storage safety, gateway crash loop, auth UX, canvas status, miss…
mithun50 414dd17
fix: Prevent gateway crash loop from orphaned timers and race conditions
mithun50 33773de
fix: Detect actual process death instead of relying on stale boolean …
mithun50 6418a81
fix: Post emitLog to main thread — EventSink.success() requires UI th…
mithun50 8409df6
fix: isProcessAlive reports true while gateway thread is still settin…
mithun50 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,9 @@ | ||||||
| package com.nxg.openclawproot | ||||||
|
|
||||||
| import android.content.Context | ||||||
| import android.net.ConnectivityManager | ||||||
| import android.net.LinkProperties | ||||||
| import android.os.Build | ||||||
| import android.system.Os | ||||||
| import java.io.BufferedInputStream | ||||||
| import java.io.File | ||||||
|
|
@@ -787,6 +790,27 @@ class BootstrapManager( | |||||
| } | ||||||
|
|
||||||
| private fun deleteRecursively(file: File) { | ||||||
| // CRITICAL: Do NOT follow symlinks — the rootfs contains symlinks | ||||||
| // to /storage/emulated/0 (sdcard). Following them would delete the | ||||||
| // user's photos, downloads, and other real files. | ||||||
|
|
||||||
| // Path boundary check: refuse to delete anything outside filesDir. | ||||||
| // This is a secondary safeguard against accidental data loss (#67, #63). | ||||||
| try { | ||||||
| if (!file.canonicalPath.startsWith(filesDir)) { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Path prefix check without a trailing separator: Prompt for AI agents
Suggested change
|
||||||
| return | ||||||
| } | ||||||
| } catch (_: Exception) { | ||||||
| return // If we can't resolve the path, don't risk deleting | ||||||
| } | ||||||
|
|
||||||
| try { | ||||||
| val path = file.toPath() | ||||||
| if (java.nio.file.Files.isSymbolicLink(path)) { | ||||||
| file.delete() | ||||||
| return | ||||||
| } | ||||||
| } catch (_: Exception) {} | ||||||
cubic-dev-ai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| if (file.isDirectory) { | ||||||
| file.listFiles()?.forEach { deleteRecursively(it) } | ||||||
| } | ||||||
|
|
@@ -1212,8 +1236,31 @@ require('/root/.openclaw/proot-compat.js'); | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * Read DNS servers from Android's active network. Falls back to | ||||||
| * Google DNS (8.8.8.8, 8.8.4.4) if system DNS is unavailable (#60). | ||||||
| */ | ||||||
| private fun getSystemDnsServers(): String { | ||||||
| try { | ||||||
| val cm = context.getSystemService(Context.CONNECTIVITY_SERVICE) as? ConnectivityManager | ||||||
| if (cm != null) { | ||||||
| val network = cm.activeNetwork | ||||||
| if (network != null) { | ||||||
| val linkProps: LinkProperties? = cm.getLinkProperties(network) | ||||||
| val dnsServers = linkProps?.dnsServers | ||||||
| if (dnsServers != null && dnsServers.isNotEmpty()) { | ||||||
| val lines = dnsServers.joinToString("\n") { "nameserver ${it.hostAddress}" } | ||||||
| // Always append Google DNS as fallback | ||||||
| return "$lines\nnameserver 8.8.8.8\n" | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| } catch (_: Exception) {} | ||||||
| return "nameserver 8.8.8.8\nnameserver 8.8.4.4\n" | ||||||
| } | ||||||
|
|
||||||
| fun writeResolvConf() { | ||||||
| val content = "nameserver 8.8.8.8\nnameserver 8.8.4.4\n" | ||||||
| val content = getSystemDnsServers() | ||||||
| // Try context.filesDir first (Android-guaranteed), fall back to | ||||||
| // string-based configDir. Always call mkdirs() unconditionally. (#40) | ||||||
| try { | ||||||
|
|
@@ -1230,10 +1277,8 @@ require('/root/.openclaw/proot-compat.js'); | |||||
| // even if the bind-mount fails or hasn't been set up yet (#40). | ||||||
| try { | ||||||
| val rootfsResolv = File(rootfsDir, "etc/resolv.conf") | ||||||
| if (!rootfsResolv.exists() || rootfsResolv.length() == 0L) { | ||||||
| rootfsResolv.parentFile?.mkdirs() | ||||||
| rootfsResolv.writeText(content) | ||||||
| } | ||||||
| rootfsResolv.parentFile?.mkdirs() | ||||||
| rootfsResolv.writeText(content) | ||||||
| } catch (_: Exception) {} | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1:
canonicalPathresolves symlinks, which prevents the symlink guard below from ever being reached. If a symlink inside the rootfs points outsidefilesDir(e.g., to/storage/emulated/0),canonicalPathreturns the target path, the boundary check fails, and the method returns early — leaving the symlink itself undeleted. UseabsolutePathinstead so the check operates on the link's own path.Prompt for AI agents