Skip to content

Commit 2158ee8

Browse files
committed
docs: add documentation for onProtoPoisoning option in README
1 parent 3f26422 commit 2158ee8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`
116116
where `buf` is a `Buffer` of the raw request body and `encoding` is the
117117
encoding of the request. The parsing can be aborted by throwing an error.
118118

119+
##### onProtoPoisoning
120+
121+
Defines what action must be taken when parsing a JSON object with `__proto__`
122+
119123
### bodyParser.raw([options])
120124

121125
Returns middleware that parses all bodies as a `Buffer` and only looks at

test/json.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ describe('bodyParser.json()', function () {
722722
})
723723
})
724724

725-
describe("prototype poisoning", function () {
725+
describe('prototype poisoning', function () {
726726
it('should parse __proto__ when protoAction is set to ignore', function (done) {
727727
request(createServer({ onProtoPoisoning: 'ignore' }))
728728
.post('/')
@@ -738,7 +738,7 @@ describe('bodyParser.json()', function () {
738738
.send('{"user":"tobi","__proto__":{"x":7}}')
739739
.expect(400, '[entity.parse.failed] Object contains forbidden prototype property', done)
740740
})
741-
741+
742742
it('should remove prototype poisoning when protoAction is set to remove', function (done) {
743743
request(createServer({ onProtoPoisoning: 'remove' }))
744744
.post('/')

0 commit comments

Comments
 (0)