@capacitor/android 8.4.3-nightly-20260730T154011.0 → 8.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -387,6 +387,12 @@ public class Bridge {
387
387
  }
388
388
 
389
389
  public boolean launchIntent(Uri url) {
390
+ // The proxy returns a remote body at the app origin, so block it before plugins can allow it.
391
+ String path = url.getPath();
392
+ if (path != null && path.startsWith(CAPACITOR_HTTP_INTERCEPTOR_START)) {
393
+ return true;
394
+ }
395
+
390
396
  /*
391
397
  * Give plugins the chance to handle the url
392
398
  */
@@ -1003,7 +1003,8 @@ public class Plugin {
1003
1003
  * Give the plugins a chance to take control when a URL is about to be loaded in the WebView.
1004
1004
  * Returning true causes the WebView to abort loading the URL.
1005
1005
  * Returning false causes the WebView to continue loading the URL.
1006
- * Returning null will defer to the default Capacitor policy
1006
+ * Returning null will defer to the default Capacitor policy.
1007
+ * Not called for Capacitor's internal HTTP proxy path, which is always blocked.
1007
1008
  */
1008
1009
  @SuppressWarnings("unused")
1009
1010
  public Boolean shouldOverrideLoad(Uri url) {
@@ -185,6 +185,11 @@ public class WebViewLocalServer {
185
185
  Uri loadingUrl = request.getUrl();
186
186
 
187
187
  if (null != loadingUrl.getPath() && loadingUrl.getPath().startsWith(Bridge.CAPACITOR_HTTP_INTERCEPTOR_START)) {
188
+ // Only fetch/XHR should reach the proxy; a document would run remote content at the app origin.
189
+ boolean httpEnabled = bridge.getConfig().getPluginConfiguration("CapacitorHttp").getBoolean("enabled", false);
190
+ if (!httpEnabled || isDocumentRequest(request)) {
191
+ return null;
192
+ }
188
193
  Logger.debug("Handling CapacitorHttp request: " + loadingUrl);
189
194
  try {
190
195
  return handleCapacitorHttpRequest(request);
@@ -210,6 +215,24 @@ public class WebViewLocalServer {
210
215
  }
211
216
  }
212
217
 
218
+ /** isForMainFrame() is false for an iframe and a fetch alike; only navigations send this header. */
219
+ private boolean isDocumentRequest(WebResourceRequest request) {
220
+ if (request.isForMainFrame()) {
221
+ return true;
222
+ }
223
+ Map<String, String> headers = request.getRequestHeaders();
224
+ if (headers == null) {
225
+ // The proxy needs the headers too, so the request fails there anyway.
226
+ return false;
227
+ }
228
+ for (String header : headers.keySet()) {
229
+ if ("Upgrade-Insecure-Requests".equalsIgnoreCase(header)) {
230
+ return true;
231
+ }
232
+ }
233
+ return false;
234
+ }
235
+
213
236
  private boolean isLocalFile(Uri uri) {
214
237
  String path = uri.getPath();
215
238
  return path.startsWith(capacitorContentStart) || path.startsWith(capacitorFileStart);
@@ -333,6 +356,9 @@ public class WebViewLocalServer {
333
356
  int responseCode = connection.getResponseCode();
334
357
  String reasonPhrase = getReasonPhraseFromResponseCode(responseCode);
335
358
 
359
+ // Nothing should render this. If anything does, sandbox keeps it inert and off the app origin.
360
+ responseHeaders.put("Content-Security-Policy", "sandbox; frame-ancestors 'none'");
361
+
336
362
  return new WebResourceResponse(mimeType, encoding, responseCode, reasonPhrase, responseHeaders, inputStream);
337
363
  }
338
364
 
@@ -43,17 +43,17 @@ public class SystemBars extends Plugin {
43
43
  private static final int WEBVIEW_VERSION_WITH_SAFE_AREA_KEYBOARD_FIX = 144;
44
44
 
45
45
  static final String viewportMetaJSFunction = """
46
- function capacitorSystemBarsCheckMetaViewport() {
47
- const meta = document.querySelectorAll("meta[name=viewport]");
48
- if (meta.length == 0) {
49
- return false;
46
+ function capacitorSystemBarsCheckMetaViewport() {
47
+ const meta = document.querySelectorAll("meta[name=viewport]");
48
+ if (meta.length == 0) {
49
+ return false;
50
+ }
51
+ // get the last found meta viewport tag
52
+ const metaContent = meta[meta.length - 1].content;
53
+ return metaContent.includes("viewport-fit=cover");
50
54
  }
51
- // get the last found meta viewport tag
52
- const metaContent = meta[meta.length - 1].content;
53
- return metaContent.includes("viewport-fit=cover");
54
- }
55
- capacitorSystemBarsCheckMetaViewport();
56
- """;
55
+ capacitorSystemBarsCheckMetaViewport();
56
+ """;
57
57
 
58
58
  private String insetsHandling = INSETS_HANDLING_CSS;
59
59
  private boolean hasViewportCover = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/android",
3
- "version": "8.4.3-nightly-20260730T154011.0",
3
+ "version": "8.4.3",
4
4
  "description": "Capacitor: Cross-platform apps with JavaScript and the web",
5
5
  "homepage": "https://capacitorjs.com",
6
6
  "author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
@@ -23,7 +23,7 @@
23
23
  "verify": "./gradlew clean lint build test -b capacitor/build.gradle"
24
24
  },
25
25
  "peerDependencies": {
26
- "@capacitor/core": "^8.4.0-nightly-20260730T154011.0"
26
+ "@capacitor/core": "^8.4.0"
27
27
  },
28
28
  "publishConfig": {
29
29
  "access": "public"