Skip to content

Commit

Permalink
Merge pull request #47 from janl/fix/proto
Browse files Browse the repository at this point in the history
fix: prototype pollution
  • Loading branch information
janl committed Jul 3, 2020
2 parents a4c6115 + 8259111 commit 1935334
Show file tree
Hide file tree
Showing 6 changed files with 6,265 additions and 2,683 deletions.
19 changes: 9 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
language: "node_js"
node_js:
# keep latest first, so gk-lockfile can work its magic
# https://github.com/greenkeeperio/greenkeeper-lockfile#testing-multiple-node-versions
- 14.0
- 12.0
- 10.0
- 8.0
- 6.0
- node
before_install:
# package-lock.json was introduced in npm@5
- npm install -g npm@5
- npm install -g greenkeeper-lockfile@1
before_script: greenkeeper-lockfile-update
after_script: greenkeeper-lockfile-upload
install:
- npm install
# Avoid double build on PRs (See https://github.com/travis-ci/travis-ci/issues/1147)
branches:
only:
- master
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# JSON Pointer for nodejs
# JSON Pointer for Node.js

[![Greenkeeper badge](https://badges.greenkeeper.io/janl/node-jsonpointer.svg)](https://greenkeeper.io/)

This is an implementation of [JSON Pointer](http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-08).
This is an implementation of [JSON Pointer](https://tools.ietf.org/html/rfc6901).

## CLI

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

## Author

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

## License

Expand Down
3 changes: 3 additions & 0 deletions jsonpointer.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ function setter (obj, pointer, value) {
var part
var hasNextPart

if (pointer[1] === 'constructor' && pointer[2] === 'prototype') return obj
if (pointer[1] === '__proto__') return obj

for (var p = 1, len = pointer.length; p < len;) {
part = untilde(pointer[p++])
hasNextPart = len > p
Expand Down
Loading

0 comments on commit 1935334

Please sign in to comment.