Skip to content

Commit

Permalink
fix #1542
Browse files Browse the repository at this point in the history
  • Loading branch information
adrai committed Feb 2, 2021
1 parent ffc213c commit 75c6294
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 19.8.7

- use "Object.prototype.hasOwnProperty" instead of "object.hasOwnProperty", fixes [1542](https://github.com/i18next/i18next/issues/1542)

### 19.8.6

- regression fix because of last prototype pollution fix in v19.8.5
Expand Down
2 changes: 1 addition & 1 deletion i18next.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@
var key = cleanKey(stack.shift());
if (!object[key] && Empty) object[key] = new Empty();

if (object.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(object, key)) {
object = object[key];
} else {
object = {};
Expand Down
2 changes: 1 addition & 1 deletion i18next.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function getLastOfPath(object, path, Empty) {
const key = cleanKey(stack.shift());
if (!object[key] && Empty) object[key] = new Empty();
// prevent prototype pollution
if (object.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(object, key)) {
object = object[key];
} else {
object = {};
Expand Down

0 comments on commit 75c6294

Please sign in to comment.