From 3de26e9bf709f01879daefde0a6a9fac0179a02b Mon Sep 17 00:00:00 2001 From: Alejandro Romero Date: Sat, 17 Oct 2020 17:39:03 +0000 Subject: [PATCH] Fix Prototype Pollution --- lib/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/index.ts b/lib/index.ts index 864cbac2..e67144ab 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -135,6 +135,10 @@ class Y18N { } updateLocale (obj: Locale) { + if ('__proto__' === this.locale){ + throw new Error('Prototype pollution attempt detected'); + } + if (!this.cache[this.locale]) this._readLocaleFile() for (const key in obj) {