From 03818b7c45bf7022755c8e16f9687719466e3b45 Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Fri, 3 Sep 2021 00:52:39 +0200 Subject: [PATCH] Disallow setting, deleting or defining properties on packages --- ts/lib/register-package.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ts/lib/register-package.ts b/ts/lib/register-package.ts index d4f926000..62eaf3042 100644 --- a/ts/lib/register-package.ts +++ b/ts/lib/register-package.ts @@ -3,6 +3,8 @@ import { runtimeLibraries } from "./runtime-require"; +const prohibit = () => false; + export function registerPackage( name: string, entries: Record, @@ -10,6 +12,9 @@ export function registerPackage( ): void { const pack = deprecation ? new Proxy(entries, { + set: prohibit, + defineProperty: prohibit, + deleteProperty: prohibit, get: (target, name: string) => { if (name in deprecation) { console.log(`anki: ${name} is deprecated: ${deprecation[name]}`);