Skip to content

Commit 635ce51

Browse files
fix(registry): Prevent prototype polluting
From CodeQL: > Most JavaScript objects inherit the properties of the built-in Object.prototype object. Prototype pollution is a type of vulnerability in which an attacker is able to modify Object.prototype. > Since most objects inherit from the compromised Object.prototype object, the attacker can use this to tamper with the application logic, and often escalate to remote code execution or cross-site scripting. To fix the problem, we need to ensure that the `appId` cannot be used to modify the `Object.prototype`. Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 05be7eb commit 635ce51

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/registry.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ export function registerAppTranslations(
7676
translations: Translations,
7777
pluralFunction: PluralFunction,
7878
) {
79+
if (appId === '__proto__' || appId === 'constructor' || appId === 'prototype') {
80+
throw new Error('Invalid appId');
81+
}
7982
window._oc_l10n_registry_translations = Object.assign(
8083
window._oc_l10n_registry_translations || {},
8184
{

0 commit comments

Comments
 (0)