Skip to content

Commit 289ae55

Browse files
authored
feat: re-enable TLS checks for Android and dev proxy (#10386)
* feat: re-enable TLS checks for Android and dev proxy * update time
1 parent 7aeac39 commit 289ae55

File tree

6 files changed

+22
-37
lines changed

6 files changed

+22
-37
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"tauri-cli": patch:sec
3+
"@tauri-apps/cli": patch:sec
4+
"tauri": patch:sec
5+
---
6+
7+
Re-enable TLS checks that were previously disabled to support an insecure HTTPS custom protocol on Android which is no longer used.
8+

core/tauri/src/protocol/tauri.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,8 @@ fn get_response<R: Runtime>(
103103
.decode_utf8_lossy()
104104
.to_string();
105105
let url = format!("{url}{decoded_path}");
106-
#[allow(unused_mut)]
107-
let mut client_builder = reqwest::ClientBuilder::new();
108-
#[cfg(any(feature = "native-tls", feature = "rustls-tls"))]
109-
{
110-
client_builder = client_builder.danger_accept_invalid_certs(true);
111-
}
112-
let mut proxy_builder = client_builder
106+
107+
let mut proxy_builder = reqwest::ClientBuilder::new()
113108
.build()
114109
.unwrap()
115110
.request(request.method().clone(), &url);

examples/api/src-tauri/Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/api/vite.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ export default defineConfig({
3333
hmr: mobile
3434
? {
3535
protocol: 'ws',
36-
host: internalIpV4Sync(),
37-
port: 1421
36+
host: mobile ? internalIpV4Sync() : 'localhost',
37+
port: 1430
3838
}
3939
: undefined,
4040
fs: {

tooling/cli/src/mobile/android/build.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use cargo_mobile2::{
2626
target::TargetTrait,
2727
};
2828

29-
use std::env::{set_current_dir, set_var};
29+
use std::env::set_current_dir;
3030

3131
#[derive(Debug, Clone, Parser)]
3232
#[clap(
@@ -122,9 +122,6 @@ pub fn command(options: Options, noise_level: NoiseLevel) -> Result<()> {
122122
(interface, app, config, metadata)
123123
};
124124

125-
set_var("WRY_RUSTWEBVIEWCLIENT_CLASS_EXTENSION", "");
126-
set_var("WRY_RUSTWEBVIEW_CLASS_INIT", "");
127-
128125
let profile = if options.debug {
129126
Profile::Debug
130127
} else {

tooling/cli/src/mobile/android/dev.rs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,7 @@ use cargo_mobile2::{
3232
target::TargetTrait,
3333
};
3434

35-
use std::env::{set_current_dir, set_var};
36-
37-
const WEBVIEW_CLIENT_CLASS_EXTENSION: &str = "
38-
@android.annotation.SuppressLint(\"WebViewClientOnReceivedSslError\")
39-
override fun onReceivedSslError(view: WebView?, handler: SslErrorHandler, error: android.net.http.SslError) {
40-
handler.proceed()
41-
}
42-
";
43-
const WEBVIEW_CLASS_INIT: &str =
44-
"this.settings.mixedContentMode = android.webkit.WebSettings.MIXED_CONTENT_ALWAYS_ALLOW";
35+
use std::env::set_current_dir;
4536

4637
#[derive(Debug, Clone, Parser)]
4738
#[clap(
@@ -154,12 +145,6 @@ fn run_command(options: Options, noise_level: NoiseLevel) -> Result<()> {
154145
(interface, app, config, metadata)
155146
};
156147

157-
set_var(
158-
"WRY_RUSTWEBVIEWCLIENT_CLASS_EXTENSION",
159-
WEBVIEW_CLIENT_CLASS_EXTENSION,
160-
);
161-
set_var("WRY_RUSTWEBVIEW_CLASS_INIT", WEBVIEW_CLASS_INIT);
162-
163148
let tauri_path = tauri_dir();
164149
set_current_dir(tauri_path).with_context(|| "failed to change current working directory")?;
165150

0 commit comments

Comments
 (0)