Skip to content

Commit

Permalink
Merge pull request #39 from evangelion1204/fix-constructor-prototype-…
Browse files Browse the repository at this point in the history
…pollution

Fixed 2nd issue with prototype pollution
  • Loading branch information
evangelion1204 committed Dec 19, 2020
2 parents 49d6027 + 6b2212b commit db03595
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ content = serializer.serialize({

## Changelog

### 2.1.2
* Fixed prototype pollution by ignoring `constructor`

### 2.1.1
* Fixed prototype pollution by ignoring `__proto__`

### 1.0.1
* Fixed bug with `keep_quotes` ignored when writing files

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "multi-ini",
"version": "2.1.1",
"version": "2.1.2",
"license": "MIT",
"description": "An ini-file parser which supports multi line, multiple levels and arrays to get a maximum of compatibility with Zend config files.",
"main": "lib/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const defaults = {
constants: {},
};

const REGEXP_IGNORE_KEYS = /__proto__/;
const REGEXP_IGNORE_KEYS = /__proto__|constructor|prototype/;

class Parser {
constructor(options = {}) {
Expand Down
6 changes: 5 additions & 1 deletion test/data/prototype_pollution.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ value=key
[__proto__]
polluted="polluted"
[other]
__proto__.path_polluted="polluted"
__proto__.path_polluted="polluted"
[constructor]
prototype.polluted = polluted
[prototype]
polluted = polluted

0 comments on commit db03595

Please sign in to comment.