Skip to content

Commit 1935334

Browse files
authored
Merge pull request #47 from janl/fix/proto
fix: prototype pollution
2 parents a4c6115 + 8259111 commit 1935334

File tree

6 files changed

+6265
-2683
lines changed

6 files changed

+6265
-2683
lines changed

.travis.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
language: "node_js"
22
node_js:
3-
# keep latest first, so gk-lockfile can work its magic
4-
# https://github.com/greenkeeperio/greenkeeper-lockfile#testing-multiple-node-versions
3+
- 14.0
4+
- 12.0
5+
- 10.0
56
- 8.0
6-
- 6.0
7-
- node
8-
before_install:
9-
# package-lock.json was introduced in npm@5
10-
- npm install -g npm@5
11-
- npm install -g greenkeeper-lockfile@1
12-
before_script: greenkeeper-lockfile-update
13-
after_script: greenkeeper-lockfile-upload
7+
install:
8+
- npm install
9+
# Avoid double build on PRs (See https://github.com/travis-ci/travis-ci/issues/1147)
10+
branches:
11+
only:
12+
- master

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# JSON Pointer for nodejs
1+
# JSON Pointer for Node.js
22

3-
[![Greenkeeper badge](https://badges.greenkeeper.io/janl/node-jsonpointer.svg)](https://greenkeeper.io/)
4-
5-
This is an implementation of [JSON Pointer](http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-08).
3+
This is an implementation of [JSON Pointer](https://tools.ietf.org/html/rfc6901).
64

75
## CLI
86

@@ -38,7 +36,7 @@ pointer.set(obj, 1) // sets obj.foo = 1
3836

3937
## Author
4038

41-
(c) 2011-2015 Jan Lehnardt <jan@apache.org> & Marc Bachmann <https://github.com/marcbachmann>
39+
(c) 2011-2020 Jan Lehnardt <jan@apache.org> & Marc Bachmann <https://github.com/marcbachmann>
4240

4341
## License
4442

jsonpointer.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ function setter (obj, pointer, value) {
1717
var part
1818
var hasNextPart
1919

20+
if (pointer[1] === 'constructor' && pointer[2] === 'prototype') return obj
21+
if (pointer[1] === '__proto__') return obj
22+
2023
for (var p = 1, len = pointer.length; p < len;) {
2124
part = untilde(pointer[p++])
2225
hasNextPart = len > p

0 commit comments

Comments
 (0)