Skip to content

Comments

Sam/harden no https#700

Merged
samholmes merged 3 commits intomasterfrom
sam/harden-no-https
Feb 7, 2026
Merged

Sam/harden no https#700
samholmes merged 3 commits intomasterfrom
sam/harden-no-https

Conversation

@samholmes
Copy link
Contributor

@samholmes samholmes commented Jan 30, 2026

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

none

Note

Medium Risk
Touches core WebView asset loading and plugin URI handling on both iOS and Android, which could regress boot/plugin loading or cross-origin isolation behavior if any paths/headers differ across OS versions.

Overview
Refactors React Native bundling to stop running a loopback BundleHTTPServer and instead serve edge-core-js assets via platform-native mechanisms while preserving COOP/COEP headers needed for SharedArrayBuffer.

On Android, EdgeCoreWebView now blocks file:// access and intercepts https://edge.bundle/... requests via LocalContentWebViewClient, serving assets directly from android_asset with COOP/COEP (+ CORS) headers; a new EdgeCoreModule exports bundleBaseUri/rootBaseUri constants to JS.

On iOS, the HTTP server is removed and WKURLSchemeHandler (EdgeAssetsSchemeHandler) serves edgebundle://edge.bundle/... requests (including plugin files) with the same headers; the podspec is updated to include the new files.

JS is updated to normalize plugin URIs using the native constants (removing /plugin proxying and direct URI conversion in the worker), adjust index.html script pathing, and simplify webpack devServer by dropping the /plugin proxy; mixFetchOptions is also trimmed to forceTls only.

Written by Cursor Bugbot for commit c9169c5. This will update automatically on new commits. Configure here.


@samholmes samholmes force-pushed the sam/harden-no-https branch from 7d46ab0 to b1224f5 Compare January 31, 2026 01:37
}
}
} else {
// Core file - look in edge-core-js.bundle
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to Android - can we just pass the right URL to begin with, and avoid this auto-lookup logic?

Maybe change <script charset="utf-8" defer src="/edge-core.js"></script> to not have the /, thereby making the path relative to index.html? Then we can make edgebundle://edge.bundle/edge-core-js.bundle/index.html the default URL on iOS.

We might also consider exporting a constant up to JavaScript, similar to how edge-currency-accountbased does it. See @objc func constantsToExport() on accountbased iOS and the public Map<String, Object> getConstants() on Android. Then JS doesn't need to know where stuff is located - the constants will tell us how to smush paths correctly. For instance, we might export a legacyPrefix and bundlePrefix constant, so we can just do if (url.startsWith(legacyPrefix) return url.replace(legacyPrefix, bundlePrefix) in JavaScript, thereby simplifying things a bunch.

@samholmes samholmes requested a review from swansontec February 5, 2026 20:57
@samholmes samholmes force-pushed the sam/harden-no-https branch 2 times, most recently from a1be93e to 3804709 Compare February 6, 2026 00:30
},
forceTls: true, // force WSS
extra: {}
forceTls: true // force WSS
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated NYM configuration removal changes network behavior

Medium Severity

The PR removes preferredGateway, preferredNetworkRequester, and mixFetchOverride.requestTimeoutMs (60 second timeout) from the NYM configuration. These changes are unrelated to the PR's stated purpose of refactoring the bundler to use platform-native asset loaders. The timeout removal in particular could cause privacy-mode fetch requests to fail with shorter default timeouts.

Fix in Cursor Fix in Web

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was intentional. We want to be as near to default behavior as is observed to be working.

Copy link
Contributor

@swansontec swansontec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving, because we need to get this shipped. But there is on more block of dead code I found, which is probably harmless for now.

print("EdgeAssetsSchemeHandler: Error reading file at \(fullPath): \(error)")
}
}
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to delete this else block as well.

Android: Use custom WebViewClient to serve assets via https://edge.bundle
- Eliminates local HTTP server and TLS certificate management
- Assets served directly from app bundle without network stack
- COOP/COEP headers added via LocalContentWebViewClient

iOS: Use WKURLSchemeHandler to serve assets via edgebundle://edge.bundle
- Eliminates local HTTP server and TLS certificate management
- Custom URL scheme provides non-null origin for same-origin policy
- COOP/COEP headers added via HTTPURLResponse

Both platforms:
- SharedArrayBuffer support maintained via cross-origin isolation headers
- Split handler classes into separate files (LocalContentWebViewClient.java,
  EdgeAssetsSchemeHandler.swift)
@samholmes samholmes force-pushed the sam/harden-no-https branch from 31f0741 to c9169c5 Compare February 7, 2026 18:42
@samholmes samholmes enabled auto-merge February 7, 2026 18:42
@samholmes samholmes merged commit fe301a6 into master Feb 7, 2026
3 checks passed
@samholmes samholmes deleted the sam/harden-no-https branch February 7, 2026 18:45
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

}
}
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS loadFile else branch is unreachable dead code

Low Severity

The else branch in loadFile is dead code. On iOS, DEFAULT_SOURCE resolves to edgebundle://edge.bundle/edge-core-js.bundle/index.html, so all core file paths contain .bundle/ and take the if branch. Relative resources (like edge-core.js) resolve under the .bundle/ directory too, and plugin paths either contain .bundle/ or start with edge-core/. No normal request can reach the else branch. The reviewer also flagged this block for deletion.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants