Fix command injection in link handler

This commit is contained in:
maple 2023-06-19 15:39:03 +08:00 committed by GitHub
parent 723a9e4df3
commit 38e57d5b3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -173,7 +173,7 @@ export class AppEvents {
console.log("token: ", authURI.split("lastfm?token=")[1]); console.log("token: ", authURI.split("lastfm?token=")[1]);
utils utils
.getWindow() .getWindow()
.webContents.executeJavaScript(`ipcRenderer.send('lastfm:auth', "${authURI.split("lastfm?token=")[1]}")`) .webContents.executeJavaScript(`ipcRenderer.send('lastfm:auth', ${JSON.stringify(authURI.split("lastfm?token=")[1])})`)
.catch(console.error); .catch(console.error);
} }
} else if (arg.includes("playpause")) { } else if (arg.includes("playpause")) {
@ -220,7 +220,7 @@ export class AppEvents {
} else if (arg.includes("/beep")) { } else if (arg.includes("/beep")) {
shell.beep(); shell.beep();
} else { } else {
utils.getWindow().webContents.executeJavaScript(`app.appRoute('${arg.split("//")[1]}')`); utils.getWindow().webContents.executeJavaScript(`app.appRoute(${JSON.stringify(arg.split("//")[1])})`);
} }
} }