Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/dont-sign-non-binary-resources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
tauri-bundler: "patch:bug"
---

The bundler will no longer try to sign non-binary and already signed binary files on Windows
4 changes: 2 additions & 2 deletions crates/tauri-bundler/src/bundle/windows/msi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
bundle::{
settings::{Arch, Settings},
windows::{
sign::try_sign,
sign::{should_sign, try_sign},
util::{
download_webview2_bootstrapper, download_webview2_offline_installer,
WIX_OUTPUT_FOLDER_NAME, WIX_UPDATER_OUTPUT_FOLDER_NAME,
Expand Down Expand Up @@ -988,7 +988,7 @@ fn generate_resource_data(settings: &Settings) -> crate::Result<ResourceMap> {
}
added_resources.push(resource_path.clone());

if settings.can_sign() {
if settings.can_sign() && should_sign(&resource_path)? {
try_sign(&resource_path, settings)?;
}

Expand Down
4 changes: 2 additions & 2 deletions crates/tauri-bundler/src/bundle/windows/nsis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
bundle::{
settings::Arch,
windows::{
sign::{sign_command, try_sign},
sign::{should_sign, sign_command, try_sign},
util::{
download_webview2_bootstrapper, download_webview2_offline_installer,
NSIS_OUTPUT_FOLDER_NAME, NSIS_UPDATER_OUTPUT_FOLDER_NAME,
Expand Down Expand Up @@ -743,7 +743,7 @@ fn generate_resource_data(settings: &Settings) -> crate::Result<ResourcesMap> {
}
added_resources.push(resource_path.clone());

if settings.can_sign() {
if settings.can_sign() && should_sign(&resource_path)? {
try_sign(&resource_path, settings)?;
}

Expand Down
23 changes: 23 additions & 0 deletions crates/tauri-bundler/src/bundle/windows/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,26 @@ pub fn try_sign<P: AsRef<Path>>(file_path: P, settings: &Settings) -> crate::Res
}
Ok(())
}

/// If the file is signable (is a binary file) and not signed already
/// (will skip the verification if not on Windows since we can't verify it)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well on macOS we could use codesign --verify

@FabianLars FabianLars Jul 31, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on macos we need to sign all files and iirc the signature has to be the same for all files, not sure rn

@Legend-Master Legend-Master Aug 1, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well on macOS we could use codesign --verify

Does it verify Windows binaries?

on macos we need to sign all files and iirc the signature has to be the same for all files, not sure rn

Hmm, does that apply to Windows installers? Or do you mean codesign --verify checks a directory instead of a file?

I'm not familiar about how signing works on macOS, how do they store the signing info? (docs says it's stored in _CodeSignature/CodeResources which seems to be an xml file)

pub fn should_sign(file_path: &Path) -> crate::Result<bool> {
let is_binary = file_path
.extension()
.and_then(|extension| extension.to_str())
.is_some_and(|extension| matches!(extension, "exe" | "dll"));
if !is_binary {
return Ok(false);
}

#[cfg(windows)]
{
let already_signed = verify(file_path)?;
Ok(!already_signed)
}
// Skip verification if not on Windows since we can't verify it
#[cfg(not(windows))]
{
Ok(true)
}
}
Loading