Skip to content

Commit 2857c01

Browse files
authored
fix(nsis): embed signed copies of stock plugins, not unsigned system DLLs (#15422)
* fix(nsis): embed signed copies of stock plugins, not unsigned system DLLs * refactor(nsis): hoist !addplugindir above !include to stay ahead of plugin commands
1 parent b5b9de2 commit 2857c01

3 files changed

Lines changed: 18 additions & 4 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-bundler": "patch:bug"
3+
---
4+
5+
Fix NSIS stock plugins (`NSISdl.dll`, `StartMenu.dll`, `System.dll`, `nsDialogs.dll`) being embedded in the final installer as unsigned despite the signing step succeeding. The signed local copies under `<output>/Plugins/x86-unicode/` were not on makensis' plugin search path, so makensis fell back to the unsigned DLLs from the NSIS toolset directory. The fix adds `!addplugindir` for the signed plugin directory before any plugin command is parsed in the script.

crates/tauri-bundler/src/bundle/windows/nsis/installer.nsi

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ ManifestDPIAwareness PerMonitorV2
1313
SetCompressor /SOLID "{{compression}}"
1414
!endif
1515

16+
; Keep above !include to stay ahead of any plugin command
17+
; see https://github.com/tauri-apps/tauri/pull/15422#discussion_r3289239624
18+
{{#if signed_plugins_path}}
19+
!addplugindir "{{signed_plugins_path}}"
20+
{{/if}}
21+
1622
!include MUI2.nsh
1723
!include FileFunc.nsh
1824
!include x64.nsh

crates/tauri-bundler/src/bundle/windows/nsis/mod.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,13 @@ fn build_nsis_app_installer(
282282
to_json(&additional_plugins_path),
283283
);
284284

285+
if let Some(plugin_copy_path) = &maybe_plugin_copy_path {
286+
data.insert(
287+
"signed_plugins_path",
288+
to_json(plugin_copy_path.join("x86-unicode")),
289+
);
290+
}
291+
285292
data.insert("arch", to_json(arch));
286293
data.insert("bundle_id", to_json(bundle_id));
287294
data.insert("manufacturer", to_json(manufacturer));
@@ -683,10 +690,6 @@ fn build_nsis_app_installer(
683690
#[cfg(not(target_os = "windows"))]
684691
let mut nsis_cmd = Command::new("makensis");
685692

686-
if let Some(plugins_path) = &maybe_plugin_copy_path {
687-
nsis_cmd.env("NSISPLUGINS", plugins_path);
688-
}
689-
690693
nsis_cmd
691694
.args(["-INPUTCHARSET", "UTF8", "-OUTPUTCHARSET", "UTF8"])
692695
.arg(match settings.log_level() {

0 commit comments

Comments
 (0)