-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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: use renameSync instead of mv #8706
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"electron-updater": patch | ||
--- | ||
|
||
fix: use renameSync instead of mv |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,10 +29,8 @@ export class DebUpdater extends BaseUpdater { | |
|
||
protected doInstall(options: InstallOptions): boolean { | ||
const sudo = this.wrapSudo() | ||
// pkexec doesn't want the command to be wrapped in " quotes | ||
const wrapper = /pkexec/i.test(sudo) ? "" : `"` | ||
const cmd = ["dpkg", "-i", options.installerPath, "||", "apt-get", "install", "-f", "-y"] | ||
this.spawnSyncLog(sudo, [`${wrapper}/bin/bash`, "-c", `'${cmd.join(" ")}'${wrapper}`]) | ||
this.spawnSyncLog(sudo, cmd) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to double check, was this tested? (Same for pacman and Rpm) Pretty sure this will fail as my previous project required piping it to bash
Comment on lines
32
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Imo, this way of installing local You may now do |
||
if (options.isForceRunAfter) { | ||
this.app.relaunch() | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem like it would work due to
installerPath
being a space-escaped string for piping to the cmd shell. Right?electron-builder/packages/electron-updater/src/BaseUpdater.ts
Lines 52 to 60 in 6a6bed4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I found that this was the cause, so I changed it to draft.
I don't think it's handled well here - it shouldn't directly add /. Instead, it should be handled by each deb/rpm/pacman separately.
These linux install commands use string concatenation, so if malicious code is added to the name, it could lead to serious security vulnerabilities.
electron-builder/packages/electron-updater/src/PacmanUpdater.ts
Lines 34 to 35 in 6a6bed4