From 354dd8b615f0cbad866e1ae75bdd9cfc4fb06847 Mon Sep 17 00:00:00 2001 From: Chris Tate Date: Sat, 4 Apr 2026 11:15:48 -0500 Subject: [PATCH] fix: pass --ignore-certificate-errors Chrome flag when --ignore-https-errors is set (#1132) * fix: pass --ignore-certificate-errors Chrome flag when --ignore-https-errors is set The existing CDP-level Security.setIgnoreCertificateErrors only takes effect after Chrome opens a connection, but some TLS errors (e.g. ERR_SSL_PROTOCOL_ERROR) are rejected at the network layer before CDP can intervene. Adding the Chrome launch flag ensures certificate errors are bypassed from process start. Fixes #1124 * test: add unit tests for --ignore-certificate-errors Chrome flag --------- Co-authored-by: ctate <366502+ctate@users.noreply.github.com> --- cli/src/native/cdp/chrome.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/cli/src/native/cdp/chrome.rs b/cli/src/native/cdp/chrome.rs index 387cf3b..5b269a0 100644 --- a/cli/src/native/cdp/chrome.rs +++ b/cli/src/native/cdp/chrome.rs @@ -190,6 +190,10 @@ fn build_chrome_args(options: &LaunchOptions) -> Result { (dir.clone(), Some(dir)) }; + if options.ignore_https_errors { + args.push("--ignore-certificate-errors".to_string()); + } + if options.allow_file_access { args.push("--allow-file-access-from-files".to_string()); args.push("--allow-file-access".to_string()); @@ -1169,6 +1173,35 @@ mod tests { } } + #[test] + fn test_build_args_ignore_https_errors_includes_flag() { + let opts = LaunchOptions { + ignore_https_errors: true, + ..Default::default() + }; + let result = build_chrome_args(&opts).unwrap(); + assert!(result + .args + .iter() + .any(|a| a == "--ignore-certificate-errors")); + if let Some(ref dir) = result.temp_user_data_dir { + let _ = std::fs::remove_dir_all(dir); + } + } + + #[test] + fn test_build_args_ignore_https_errors_default_no_flag() { + let opts = LaunchOptions::default(); + let result = build_chrome_args(&opts).unwrap(); + assert!(!result + .args + .iter() + .any(|a| a == "--ignore-certificate-errors")); + if let Some(ref dir) = result.temp_user_data_dir { + let _ = std::fs::remove_dir_all(dir); + } + } + #[test] fn test_chrome_process_drop_cleans_temp_dir() { let dir = std::env::temp_dir().join(format!(