feat(core): add fips_compliant wix config option, closes #4541 (#4843)

This commit is contained in:
Lucas Fernandes Nogueira 2022-08-04 14:58:26 -03:00 committed by GitHub
parent 1caf485fce
commit d88b9de7aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 2 deletions

View File

@ -0,0 +1,6 @@
---
"cli.rs": patch
"cli.js": patch
---
Enable WiX FIPS compliance when the `TAURI_FIPS_COMPLIANT` environment variable is set to `true`.

View File

@ -0,0 +1,5 @@
---
"tauri-bundler": patch
---
Add `fips_compliant` configuration option for WiX.

View File

@ -237,6 +237,8 @@ pub struct WixSettings {
/// The required dimensions are 493px × 312px. /// The required dimensions are 493px × 312px.
pub dialog_image_path: Option<PathBuf>, pub dialog_image_path: Option<PathBuf>,
/// Enables FIPS compliant algorithms.
pub fips_compliant: bool,
} }
/// The Windows bundle settings. /// The Windows bundle settings.

View File

@ -305,7 +305,7 @@ fn run_candle(
.find(|bin| bin.main()) .find(|bin| bin.main())
.ok_or_else(|| anyhow::anyhow!("Failed to get main binary"))?; .ok_or_else(|| anyhow::anyhow!("Failed to get main binary"))?;
let args = vec![ let mut args = vec![
"-arch".to_string(), "-arch".to_string(),
arch.to_string(), arch.to_string(),
wxs_file_path.to_string_lossy().to_string(), wxs_file_path.to_string_lossy().to_string(),
@ -315,6 +315,16 @@ fn run_candle(
), ),
]; ];
if settings
.windows()
.wix
.as_ref()
.map(|w| w.fips_compliant)
.unwrap_or_default()
{
args.push("-fips".into());
}
let candle_exe = wix_toolset_path.join("candle.exe"); let candle_exe = wix_toolset_path.join("candle.exe");
info!(action = "Running"; "candle for {:?}", wxs_file_path); info!(action = "Running"; "candle for {:?}", wxs_file_path);

View File

@ -11,7 +11,7 @@ pub use tauri_utils::config::*;
use std::{ use std::{
collections::HashMap, collections::HashMap,
env::set_var, env::{set_var, var_os},
ffi::OsStr, ffi::OsStr,
process::exit, process::exit,
sync::{Arc, Mutex}, sync::{Arc, Mutex},
@ -92,6 +92,7 @@ pub fn wix_settings(config: WixConfig) -> tauri_bundler::WixSettings {
enable_elevated_update_task: config.enable_elevated_update_task, enable_elevated_update_task: config.enable_elevated_update_task,
banner_path: config.banner_path, banner_path: config.banner_path,
dialog_image_path: config.dialog_image_path, dialog_image_path: config.dialog_image_path,
fips_compliant: var_os("TAURI_FIPS_COMPLIANT").map_or(false, |v| v == "true"),
} }
} }