Skip to content

Commit

Permalink
fix: support powershell constrained language mode (electron-userland#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyspiegel committed Nov 2, 2022
1 parent c21e3b3 commit 346af1d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
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

0 comments on commit 346af1d

Please sign in to comment.