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

@ -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);
}
};

@ -5,7 +5,6 @@ import { mergeDefaults } from '../utils/misc';
interface Settings {
notifyAboutUpdates: boolean;
unsafeRequire: boolean;
useQuickCss: boolean;
plugins: {
[plugin: string]: {
@ -17,7 +16,6 @@ interface Settings {
const DefaultSettings: Settings = {
notifyAboutUpdates: true,
unsafeRequire: false,
useQuickCss: true,
plugins: {}
};

@ -111,13 +111,6 @@ export default ErrorBoundary.wrap(function Settings() {
>
Get notified about new Updates
</Switch>}
{!IS_WEB && <Switch
value={settings.unsafeRequire}
onChange={(v: boolean) => settings.unsafeRequire = v}
note="Enables VencordNative.require. Useful for testing, very bad for security. Leave this off unless you need it."
>
Enable Unsafe Require
</Switch>}
<Forms.FormDivider />