Skip to content

Commit ea55aae

Browse files
fix(msi): bake [INSTALLFOLDER] into ExeCommand literally
WiX 4 silently strips ExeCommand="[CustomActionData]" — the compiled MSI has an empty Target column, so msiexec fires the CA with no command line and aborts with error 1721. Both [INSTALLFOLDER] and [CustomActionData] are deferred-safe properties, so embed the exe path via [INSTALLFOLDER] in the literal ExeCommand and move only the args into CustomActionData.
1 parent 9a3a90b commit ea55aae

2 files changed

Lines changed: 17 additions & 19 deletions

File tree

internal/buildinfo/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package buildinfo
33
import "fmt"
44

55
const (
6-
Version = "1.11.2-msi-test3"
6+
Version = "1.11.2-msi-test4"
77
AgentURL = "https://github.com/step-security/dev-machine-guard"
88
)
99

packaging/windows/Product.wxs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -99,66 +99,64 @@
9999
================================================================
100100
-->
101101

102-
<!-- Deferred command-runners. ExeCommand="[CustomActionData]" pulls
103-
the actual command line from the CustomActionData property,
104-
which the SetProperty elements below populate at sequence
105-
time (when [INSTALLFOLDER], [CUSTOMERID], etc. ARE expandable). -->
102+
<!-- ExeCommand uses [INSTALLFOLDER] (deferred-safe, MSI auto-passes
103+
it to deferred CAs) for the exe path, and [CustomActionData] for
104+
the args. WiX 4 strips a bare ExeCommand="[CustomActionData]"
105+
(treats it as an empty Target), so we MUST bake [INSTALLFOLDER]
106+
in literally — that keeps the column non-empty and lets MSI
107+
substitute both placeholders at deferred-execution time. -->
106108

107109
<CustomAction Id="RunConfigureInline"
108110
Directory="INSTALLFOLDER"
109-
ExeCommand="[CustomActionData]"
111+
ExeCommand='"[INSTALLFOLDER]stepsecurity-dev-machine-guard.exe" [CustomActionData]'
110112
Execute="deferred"
111113
Impersonate="no"
112114
Return="check"/>
113115

114116
<CustomAction Id="RunConfigureFromFile"
115117
Directory="INSTALLFOLDER"
116-
ExeCommand="[CustomActionData]"
118+
ExeCommand='"[INSTALLFOLDER]stepsecurity-dev-machine-guard.exe" [CustomActionData]'
117119
Execute="deferred"
118120
Impersonate="no"
119121
Return="check"/>
120122

121123
<CustomAction Id="RunInstallScheduledTask"
122124
Directory="INSTALLFOLDER"
123-
ExeCommand="[CustomActionData]"
125+
ExeCommand='"[INSTALLFOLDER]stepsecurity-dev-machine-guard.exe" [CustomActionData]'
124126
Execute="deferred"
125127
Impersonate="no"
126128
Return="check"/>
127129

128130
<CustomAction Id="RunUninstallScheduledTask"
129131
Directory="INSTALLFOLDER"
130-
ExeCommand="[CustomActionData]"
132+
ExeCommand='"[INSTALLFOLDER]stepsecurity-dev-machine-guard.exe" [CustomActionData]'
131133
Execute="deferred"
132134
Impersonate="no"
133135
Return="ignore"/>
134136

135-
<!-- SetProperty elements: WiX shorthand for an immediate Type 51 CA.
136-
Each one sets a property whose name matches a deferred CA Id;
137-
MSI auto-populates that CA's CustomActionData from this value
138-
at execution time. Property tokens like [INSTALLFOLDER] and
139-
[APIKEY] expand here (in the immediate phase) — so by the time
140-
the deferred CA runs, the command line is fully resolved. -->
137+
<!-- SetProperty values now contain ONLY the args (not the exe path),
138+
which become [CustomActionData] for the matching deferred CA. -->
141139

142140
<SetProperty Id="RunConfigureInline"
143-
Value='"[INSTALLFOLDER]stepsecurity-dev-machine-guard.exe" configure --non-interactive --customer-id "[CUSTOMERID]" --api-endpoint "[APIENDPOINT]" --api-key "[APIKEY]" --scan-frequency "[SCANFREQUENCY]"'
141+
Value='configure --non-interactive --customer-id "[CUSTOMERID]" --api-endpoint "[APIENDPOINT]" --api-key "[APIKEY]" --scan-frequency "[SCANFREQUENCY]"'
144142
Sequence="execute"
145143
Before="RunConfigureInline"
146144
Condition="APIKEY AND NOT BOOTSTRAPFILE AND NOT Installed"/>
147145

148146
<SetProperty Id="RunConfigureFromFile"
149-
Value='"[INSTALLFOLDER]stepsecurity-dev-machine-guard.exe" configure --non-interactive --from-file "[BOOTSTRAPFILE]"'
147+
Value='configure --non-interactive --from-file "[BOOTSTRAPFILE]"'
150148
Sequence="execute"
151149
Before="RunConfigureFromFile"
152150
Condition="BOOTSTRAPFILE AND NOT Installed"/>
153151

154152
<SetProperty Id="RunInstallScheduledTask"
155-
Value='"[INSTALLFOLDER]stepsecurity-dev-machine-guard.exe" install'
153+
Value='install'
156154
Sequence="execute"
157155
Before="RunInstallScheduledTask"
158156
Condition="NOT Installed"/>
159157

160158
<SetProperty Id="RunUninstallScheduledTask"
161-
Value='"[INSTALLFOLDER]stepsecurity-dev-machine-guard.exe" uninstall'
159+
Value='uninstall'
162160
Sequence="execute"
163161
Before="RunUninstallScheduledTask"
164162
Condition="REMOVE=&quot;ALL&quot;"/>

0 commit comments

Comments
 (0)