v0.1.0-canary.6
Summary
Security hardening for the Catalyst Framework WebView layer across Android and iOS,
with native test suites added for all new bridge commands and pre-existing test
failures fixed.
Security fixes
-
allowBackup(Android): Replaced patchAndroidManifest Gradle task with
manifestPlaceholders["allowBackup"]. Config-driven via
WEBVIEW_CONFIG.android.security.allowBackupinconfig.json. -
App switcher screen caching: Added
setScreenSecure/getScreenSecure
bridge commands. Android setsFLAG_SECURE; iOS manages aScreenSecureManager
overlay onsceneWillDeactivate. -
Screenshots / local storage on logout: Added
clearWebDatabridge command.
Clears WebView built-in cache + custom native disk cache (WebCacheManageron
Android,CacheManageron iOS). -
JSON injection (Android
NativeBridge.kt): Fixed 3 error callback sites that
were building JSON strings manually. Now usenotifyWebJson+JSONObjectfor
all responses.
JS bridge fixes
-
SSR / web safety (
NativeBridge.js,useBaseHook.js):NativeBridgeUtil
was constructed at module load time during SSR, freezingisNativeEnvironment = falsepermanently. FixedisAvailable()to perform a live_detectAndroid() || _detectIOS()check at call time. AddedcallNative(fn)helper in
useBaseHook.jsfor fire-and-forget native calls that silently no-op on web.
Updatedhooks.jsto usecallNativeforsetScreenSecure,getScreenSecure,
andclearWebData. -
BridgeMessageValidator(BridgeMessageValidator.kt): Replaced hardcoded
validCommandsset withCatalystConstants.Bridge.VALID_COMMANDSas single
source of truth, addingsetScreenSecure,getScreenSecure, andclearWebData.
Native test suites added
| File | Platform | Tests |
|---|---|---|
SecurityBridgeTest.kt |
Android | 12 |
ScreenSecureManagerTests.swift |
iOS | 8 |
BridgeCommandHandlerSecurityTests.swift |
iOS | 8 |
Pre-existing test failures fixed
| Test | Root cause | Fix |
|---|---|---|
testNavigationHandling_AllowedURLLoading / BlockedURLNavigation |
decisionHandler called inside unstructured Task {} → await MainActor.run; Task.yield() + 0.1s was racy |
|
| under load | Replaced with XCTestExpectation + fulfillment(of:timeout:2.0) |
|
testHTTPSServerSetup_ServerInitialization |
NWListener setup on main thread triggered UI-responsiveness warning |
Made test async, wrapped startServer() in Task.detached |
|
| testFileServing_AddFileToServe | NWListener state race — handler could set isServerRunning = false after startServer() returned | Added Thread.sleep(0.3s) after start to
let listener state settle |
| testSizeManagement_DiskUsageTracking | getCacheStatistics() read URLCache.currentDiskUsage which doesn't count custom .cache files | Fixed to enumerate .cache files and
sum sizes |
| WebViewTests navigation tests | WebViewNavigationDelegate.init gained initialURL: URL? param in last merge but WebViewTests was not updated | Passed initialURL: nil |
iOS code coverage
Enabled codeCoverage: true in iosnativeWebView.xctestplan for all targets.
Test coverage
376 tests passing, 0 failures (196 Android · 180 iOS) · iOS code coverage 89%