Kill unsafe require

This commit is contained in:
Vendicated 2022-10-05 14:20:34 +02:00
parent 98cfa090d4
commit 7e526e4172
No known key found for this signature in database
GPG key ID: EC781ADFB93EFFA3
3 changed files with 0 additions and 18 deletions

View file

@ -27,14 +27,5 @@ export default {
assertEventAllowed(event);
return ipcRenderer.invoke(event, ...args);
}
},
require(mod: string) {
const settings = ipcRenderer.sendSync(IPC_EVENTS.GET_SETTINGS);
try {
if (!JSON.parse(settings).unsafeRequire) throw "no";
} catch {
throw new Error("Unsafe require is not allowed. Enable it in settings and try again.");
}
return require(mod);
}
};