Skip to content

Commit 746e2ef

Browse files
committed
Added optional fips_compliant field to WixConfig
This allows users to set the `-fips` flag at the `tauri.windows.conf.json` level instead of using the environment variable `TAURI_BUNDLER_WIX_FIPS_COMPLIANT`. To me this makes for smoother FIPS-compliant builds. As with other environment variables that also have config fields, the environment variable will override whatever is set in the config.
1 parent 916aeaa commit 746e2ef

File tree

8 files changed

+50
-3
lines changed

8 files changed

+50
-3
lines changed

.changes/add-fips-to-wix-config.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@tauri-apps/tauri-utils": patch:enhance
3+
---
4+
5+
Added optional `fips_compliant` field to `WixConfig`

crates/tauri-cli/config.schema.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2735,6 +2735,14 @@
27352735
"string",
27362736
"null"
27372737
]
2738+
},
2739+
"fipsCompliant": {
2740+
"description": "Enables FIPS compliant algorithms.",
2741+
"default": null,
2742+
"type": [
2743+
"boolean",
2744+
"null"
2745+
]
27382746
}
27392747
},
27402748
"additionalProperties": false

crates/tauri-cli/schema.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2330,6 +2330,14 @@
23302330
"string",
23312331
"null"
23322332
]
2333+
},
2334+
"fipsCompliant": {
2335+
"description": "Enables FIPS compliant algorithms.",
2336+
"default": null,
2337+
"type": [
2338+
"boolean",
2339+
"null"
2340+
]
23332341
}
23342342
},
23352343
"additionalProperties": false

crates/tauri-cli/src/helpers/config.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
1+
// Copyright 2019-2025 Tauri Programme within The Commons Conservancy
22
// SPDX-License-Identifier: Apache-2.0
33
// SPDX-License-Identifier: MIT
44

@@ -11,7 +11,7 @@ pub use tauri_utils::{config::*, platform::Target};
1111

1212
use std::{
1313
collections::HashMap,
14-
env::{current_dir, set_current_dir, set_var, var_os},
14+
env::{current_dir, set_current_dir, set_var},
1515
ffi::OsStr,
1616
process::exit,
1717
sync::{Arc, Mutex, OnceLock},
@@ -70,6 +70,11 @@ pub fn wix_settings(config: WixConfig) -> tauri_bundler::WixSettings {
7070
tauri_bundler::WixSettings {
7171
version: config.version,
7272
upgrade_code: config.upgrade_code,
73+
fips_compliant: std::env::var("TAURI_BUNDLER_WIX_FIPS_COMPLIANT")
74+
.ok()
75+
.map(|v| v == "true")
76+
.or(config.fips_compliant)
77+
.unwrap_or_default(),
7378
language: tauri_bundler::WixLanguage(match config.language {
7479
WixLanguage::One(lang) => vec![(lang, Default::default())],
7580
WixLanguage::List(languages) => languages
@@ -98,7 +103,6 @@ pub fn wix_settings(config: WixConfig) -> tauri_bundler::WixSettings {
98103
enable_elevated_update_task: config.enable_elevated_update_task,
99104
banner_path: config.banner_path,
100105
dialog_image_path: config.dialog_image_path,
101-
fips_compliant: var_os("TAURI_BUNDLER_WIX_FIPS_COMPLIANT").is_some_and(|v| v == "true"),
102106
}
103107
}
104108

crates/tauri-cli/tauri.config.schema.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2330,6 +2330,14 @@
23302330
"string",
23312331
"null"
23322332
]
2333+
},
2334+
"fipsCompliant": {
2335+
"description": "Enables FIPS compliant algorithms.",
2336+
"default": null,
2337+
"type": [
2338+
"boolean",
2339+
"null"
2340+
]
23332341
}
23342342
},
23352343
"additionalProperties": false

crates/tauri-schema-generator/schemas/config.schema.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2735,6 +2735,14 @@
27352735
"string",
27362736
"null"
27372737
]
2738+
},
2739+
"fipsCompliant": {
2740+
"description": "Enables FIPS compliant algorithms.",
2741+
"default": null,
2742+
"type": [
2743+
"boolean",
2744+
"null"
2745+
]
27382746
}
27392747
},
27402748
"additionalProperties": false

crates/tauri-utils/src/config.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,9 @@ pub struct WixConfig {
788788
/// The required dimensions are 493px × 312px.
789789
#[serde(alias = "dialog-image-path")]
790790
pub dialog_image_path: Option<PathBuf>,
791+
/// Enables FIPS compliant algorithms.
792+
#[serde(default, alias = "fips-compliant")]
793+
pub fips_compliant: Option<bool>,
791794
}
792795

793796
/// Compression algorithms used in the NSIS installer.

crates/tauri-utils/src/config_v1/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,9 @@ pub struct WixConfig {
486486
/// The required dimensions are 493px × 312px.
487487
#[serde(alias = "dialog-image-path")]
488488
pub dialog_image_path: Option<PathBuf>,
489+
/// Enables FIPS compliant algorithms.
490+
#[serde(default, alias = "fips-compliant")]
491+
pub fips_compliant: Option<bool>,
489492
}
490493

491494
/// Compression algorithms used in the NSIS installer.

0 commit comments

Comments
 (0)