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: temp save #58

Closed
wants to merge 4 commits into from
Closed

fix: temp save #58

wants to merge 4 commits into from

Conversation

mmaietta
Copy link
Owner

temp save

@mmaietta mmaietta force-pushed the fix-win-verify-path branch from 1fb74f2 to b317ebe Compare June 27, 2024 00:09
@mmaietta
Copy link
Owner Author

mmaietta commented Jul 4, 2024

@thomas-chauchefoin-bentley-systems would you be willing to test this from your end as well using patch-package?

You should see something like this in the electron-updater logs:

LiteralPath: C:\Users\mm\AppData\Local\electron-quick-start-typescript-updater\pending\temp-electron-quick-start-typescript-1.0.6-x64.exe. Update Path: C:\Users\mm\AppData\Local\electron-quick-start-typescript-updater\pending\temp-electron-quick-start-typescript-1.0.6-x64.exe

Filename: electron-updater+6.3.0-alpha.4.patch

diff --git a/node_modules/electron-updater/out/windowsExecutableCodeSignatureVerifier.js b/node_modules/electron-updater/out/windowsExecutableCodeSignatureVerifier.js
index e5615f7..051b30f 100644
--- a/node_modules/electron-updater/out/windowsExecutableCodeSignatureVerifier.js
+++ b/node_modules/electron-updater/out/windowsExecutableCodeSignatureVerifier.js
@@ -4,6 +4,7 @@ exports.verifySignature = void 0;
 const builder_util_runtime_1 = require("builder-util-runtime");
 const child_process_1 = require("child_process");
 const os = require("os");
+const path = require("path");
 // $certificateInfo = (Get-AuthenticodeSignature 'xxx\yyy.exe'
 // | where {$_.Status.Equals([System.Management.Automation.SignatureStatus]::Valid) -and $_.SignerCertificate.Subject.Contains("CN=siemens.com")})
 // | Out-String ; if ($certificateInfo) { exit 0 } else { exit 1 }
@@ -44,6 +45,14 @@ function verifySignature(publisherNames, unescapedTempUpdateFile, logger) {
                 }
                 const data = parseOut(stdout);
                 if (data.Status === 0) {
+                    const normlaizedUpdateFilePath = path.normalize(data.Path);
+                    const normalizedTempUpdateFile = path.normalize(unescapedTempUpdateFile);
+                    logger.info(`LiteralPath: ${normlaizedUpdateFilePath}. Update Path: ${normalizedTempUpdateFile}`);
+                    if (normlaizedUpdateFilePath !== normalizedTempUpdateFile) {
+                        handleError(logger, new Error(`LiteralPath of ${normlaizedUpdateFilePath} is different than ${normalizedTempUpdateFile}`), stderr, reject);
+                        resolve(null);
+                        return;
+                    }
                     const subject = (0, builder_util_runtime_1.parseDn)(data.SignerCertificate.Subject);
                     let match = false;
                     for (const name of publisherNames) {
@@ -92,7 +101,6 @@ function parseOut(out) {
         // duplicates data.SignerCertificate (contains RawData)
         delete signerCertificate.SubjectName;
     }
-    delete data.Path;
     return data;
 }
 function handleError(logger, error, stderr, reject) {

@thomas-chauchefoin-bentley-systems

@mmaietta That works as expected on my side, thanks!

@mmaietta mmaietta marked this pull request as ready for review July 4, 2024 15:56
@mmaietta mmaietta closed this Jul 11, 2024
@mmaietta mmaietta deleted the fix-win-verify-path branch July 11, 2024 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants