Skip to content

Commit

Permalink
regression fix because of last prototype pollution fix in v19.8.5
Browse files Browse the repository at this point in the history
  • Loading branch information
adrai committed Feb 1, 2021
1 parent aeab3ca commit 87a2449
Show file tree
Hide file tree
Showing 4 changed files with 16 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.6

- regression fix because of last prototype pollution fix in v19.8.5

### 19.8.5

- fix potential prototype pollution when backend plugin resolves a malicious language value
Expand Down
7 changes: 6 additions & 1 deletion i18next.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,12 @@
if (canNotTraverseDeeper()) return {};
var key = cleanKey(stack.shift());
if (!object[key] && Empty) object[key] = new Empty();
if (object.hasOwnProperty(key)) object = object[key];

if (object.hasOwnProperty(key)) {
object = object[key];
} else {
object = {};

This comment has been minimized.

Copy link
@jamuhl

jamuhl Feb 2, 2021

Member

shouldn't that be object = new Empty()

}
}

if (canNotTraverseDeeper()) return {};
Expand Down
2 changes: 1 addition & 1 deletion i18next.min.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ 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)) object = object[key];
if (object.hasOwnProperty(key)) {
object = object[key];
} else {
object = {};
}
}

if (canNotTraverseDeeper()) return {};
Expand Down

0 comments on commit 87a2449

Please sign in to comment.