Skip to content

Commit

Permalink
feat(core): add fips_compliant wix config option, closes #4541 (#4843)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored Aug 4, 2022
1 parent 1caf485 commit d88b9de
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changes/fips-compliant-env-var.md
Original file line number Diff line number Diff line change
@@ -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`.
5 changes: 5 additions & 0 deletions .changes/fips-compliant.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri-bundler": patch
---

Add `fips_compliant` configuration option for WiX.
2 changes: 2 additions & 0 deletions tooling/bundler/src/bundle/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ pub struct WixSettings {

/// The required dimensions are 493px × 312px.
pub dialog_image_path: Option<PathBuf>,
/// Enables FIPS compliant algorithms.
pub fips_compliant: bool,
}

/// The Windows bundle settings.
Expand Down
12 changes: 11 additions & 1 deletion tooling/bundler/src/bundle/windows/msi/wix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ fn run_candle(
.find(|bin| bin.main())
.ok_or_else(|| anyhow::anyhow!("Failed to get main binary"))?;

let args = vec![
let mut args = vec![
"-arch".to_string(),
arch.to_string(),
wxs_file_path.to_string_lossy().to_string(),
Expand All @@ -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");

info!(action = "Running"; "candle for {:?}", wxs_file_path);
Expand Down
3 changes: 2 additions & 1 deletion tooling/cli/src/helpers/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub use tauri_utils::config::*;

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

Expand Down

0 comments on commit d88b9de

Please sign in to comment.