Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support powershell constrained language mode #7230

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 .changeset/real-olives-film.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"electron-updater": patch
---

fix: support powershell constrained language mode
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,10 @@ export function verifySignature(publisherNames: Array<string>, unescapedTempUpda
// https://github.com/electron-userland/electron-builder/issues/2421
// https://github.com/electron-userland/electron-builder/issues/2535
execFile(
"powershell.exe",
[
"-NoProfile",
"-NonInteractive",
"-InputFormat",
"None",
"-Command",
`Get-AuthenticodeSignature -LiteralPath '${tempUpdateFile}' | ConvertTo-Json -Compress | ForEach-Object { [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($_)) }`,
],
"chcp 65001 >NUL & powershell.exe",
["-NoProfile", "-NonInteractive", "-InputFormat", "None", "-Command", `"Get-AuthenticodeSignature -LiteralPath '${tempUpdateFile}' | ConvertTo-Json -Compress"`],
{
shell: true,
timeout: 20 * 1000,
},
(error, stdout, stderr) => {
Expand All @@ -51,7 +45,7 @@ export function verifySignature(publisherNames: Array<string>, unescapedTempUpda
return
}

const data = parseOut(Buffer.from(stdout, "base64").toString("utf-8"))
const data = parseOut(stdout)
if (data.Status === 0) {
const subject = parseDn(data.SignerCertificate.Subject)
let match = false
Expand Down