You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: LICENSE
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
Copyright (c) 2011-2018 Phillip Clark
1
+
Copyright (c) 2011-2021 Phillip Clark
2
2
3
3
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
I wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.
12
-
13
-
## Security Vulnerability prior to v2.1.0
14
-
15
-
There is a security vulnerability in versions prior to v2.1.0 in which an unscrupulous actor may execute arbitrary code. If your code sends un-sanitized user input to `json-ptr`'s `.get()` method, your project is vulnerable to this injection-style vulnerability.
16
-
17
-
If your code is vulnerable, you should upgrade immediately, and also, stop sending un-sanitized user input to `json-ptr`.
18
-
19
-
## Breaking Changes at v1.3.0
20
-
21
-
As was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.
11
+
I wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.
22
12
23
13
## Install
24
14
25
15
```bash
26
16
npm install json-ptr
27
17
```
28
18
19
+
## Release Bundles
20
+
21
+
As of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference to `json-ptr`, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.
-**prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.
152
+
153
+
-**prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!
154
+
155
+
## Breaking Changes at v1.3.0
156
+
157
+
As was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.
158
+
145
159
### Where did the Global Functions Go?
146
160
147
161
In version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.
148
162
149
-
| Global Fn | Static Fn | Documentation |
150
-
|---|---|---|
151
-
|`create()`|`JsonPointer.create()`|[Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)|
|`create()`|`JsonPointer.create()`|[Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)|
152
166
|`decode()`|`JsonPointer.decode()`|[Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)|
153
167
|`flatten()`|`JsonPointer.flatten()`|[DEvaluates the target's object graph, returning a Record<Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten)|
154
168
|`get()`|`JsonPointer.get()`|[Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)|
@@ -241,54 +255,63 @@ It is important to recognize in the performance results that _compiled_ options
- When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.
244
260
- 2021-05-14 — **2.2.0**_Added Handling for Relative JSON Pointers_
- 2021-05-12 — **2.1.1**_Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_
247
263
-@CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.
248
264
- 2021-05-12 — **2.1.0**_Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_
249
-
- When compiling the accessors for quickly points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.
265
+
266
+
- When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.
250
267
251
268
- If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!
252
-
269
+
253
270
- 2020-10-21 — **2.0.0**_*Breaking Change*_
254
271
- Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26)[@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.
255
272
- Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.
256
273
257
274
> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)
258
275
259
-
- 2020-07-20 — **1.3.2**
260
-
- Added missing `tslib` dependency.
261
-
- Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).
276
+
- 2020-07-20 — **1.3.2**
277
+
278
+
- Added missing `tslib` dependency.
279
+
- Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).
280
+
281
+
- 2020-07-10 — **1.3.0****BREAKING CHANGES**
282
+
283
+
-**BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)
284
+
- Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.
285
+
- Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.
286
+
- 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.
287
+
288
+
- 2019-09-14 — **1.2.0**
289
+
290
+
- Merged new `.concat` function contributed by @vuwuv, updated dependencies.
291
+
292
+
- 2019-03-10 — **1.1.2**
262
293
294
+
- Updated packages to remove critical security concern among dev dependencies'
263
295
264
-
- 2020-07-10 — **1.3.0****BREAKING CHANGES**
265
-
-**BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)
266
-
- Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.
267
-
- Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.
268
-
- 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.
296
+
- 2016-07-26 — **1.0.1**
269
297
270
-
- 2019-09-14 — **1.2.0**
271
-
- Merged new `.concat` function contributed by @vuwuv, updated dependencies.
298
+
- Fixed a problem with the Babel configuration
272
299
273
-
- 2019-03-10 — **1.1.2**
274
-
- Updated packages to remove critical security concern among dev dependencies'
300
+
- 2016-01-12 — **1.0.0**
275
301
276
-
- 2016-07-26 — **1.0.1**
277
-
- Fixed a problem with the Babel configuration
302
+
- Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.
278
303
279
-
- 2016-01-12 — **1.0.0**
280
-
- Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.
304
+
- 2016-01-02 — **0.3.0**
281
305
282
-
- 2016-01-02 — **0.3.0**
283
-
- Retooled for node 4+
284
-
- Better compiled pointers
285
-
- Unrolled recursive `.list` function
286
-
- Added `.map` function
287
-
- Fully linted
288
-
- Lots more tests and examples.
289
-
- Documented many previously undocumented features.
306
+
- Retooled for node 4+
307
+
- Better compiled pointers
308
+
- Unrolled recursive `.list` function
309
+
- Added `.map` function
310
+
- Fully linted
311
+
- Lots more tests and examples.
312
+
- Documented many previously undocumented features.
290
313
291
-
-2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.
314
+
- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.
0 commit comments