@suveren/gateway 0.8.4 → 0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/control-plane/index.mjs +170 -83
- package/dist/mcp-server/http.mjs +75 -0
- package/dist/ui/assets/index-BJqF5rmx.css +1 -0
- package/dist/ui/assets/index-DWpjjPIf.js +110 -0
- package/dist/ui/index.html +2 -2
- package/node_modules/@types/node/README.md +2 -2
- package/node_modules/@types/node/buffer.d.ts +1 -0
- package/node_modules/@types/node/child_process.d.ts +1 -1
- package/node_modules/@types/node/crypto.d.ts +20 -8
- package/node_modules/@types/node/diagnostics_channel.d.ts +4 -4
- package/node_modules/@types/node/ffi.d.ts +14 -0
- package/node_modules/@types/node/http.d.ts +1 -1
- package/node_modules/@types/node/http2.d.ts +3 -2
- package/node_modules/@types/node/net.d.ts +16 -4
- package/node_modules/@types/node/package.json +3 -18
- package/node_modules/@types/node/perf_hooks.d.ts +31 -19
- package/node_modules/@types/node/process.d.ts +1 -0
- package/node_modules/@types/node/quic.d.ts +45 -5
- package/node_modules/@types/node/stream/iter.d.ts +9 -12
- package/node_modules/@types/node/stream/web.d.ts +20 -0
- package/node_modules/@types/node/test/reporters.d.ts +1 -0
- package/node_modules/@types/node/test.d.ts +72 -0
- package/node_modules/@types/node/tls.d.ts +40 -25
- package/node_modules/@types/node/vfs.d.ts +7 -6
- package/node_modules/@types/node/vm.d.ts +2 -1
- package/node_modules/@types/node/web-globals/streams.d.ts +4 -0
- package/node_modules/@types/node/worker_threads.d.ts +4 -1
- package/node_modules/@types/node/zlib.d.ts +17 -0
- package/node_modules/body-parser/HISTORY.md +156 -145
- package/node_modules/body-parser/package.json +2 -2
- package/node_modules/express/History.md +583 -576
- package/node_modules/express/lib/request.js +2 -2
- package/node_modules/express/package.json +3 -3
- package/node_modules/fast-uri/index.js +10 -6
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/fast-uri/test/security-normalization.test.js +38 -0
- package/node_modules/hono/README.md +1 -1
- package/node_modules/hono/dist/adapter/aws-lambda/handler.js +5 -4
- package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +5 -4
- package/node_modules/hono/dist/cjs/context.js +1 -1
- package/node_modules/hono/dist/cjs/helper/accepts/accepts.js +1 -1
- package/node_modules/hono/dist/cjs/jsx/dom/render.js +44 -8
- package/node_modules/hono/dist/cjs/middleware/language/language.js +4 -1
- package/node_modules/hono/dist/cjs/request.js +4 -1
- package/node_modules/hono/dist/cjs/utils/accept.js +4 -7
- package/node_modules/hono/dist/context.js +1 -1
- package/node_modules/hono/dist/helper/accepts/accepts.js +1 -1
- package/node_modules/hono/dist/jsx/dom/render.js +44 -8
- package/node_modules/hono/dist/middleware/language/language.js +4 -1
- package/node_modules/hono/dist/request.js +4 -1
- package/node_modules/hono/dist/types/helper/proxy/index.d.ts +1 -1
- package/node_modules/hono/dist/types/helper/route/index.d.ts +2 -2
- package/node_modules/hono/dist/types/middleware/combine/index.d.ts +3 -1
- package/node_modules/hono/dist/types/utils/types.d.ts +1 -1
- package/node_modules/hono/dist/utils/accept.js +4 -7
- package/node_modules/hono/package.json +1 -1
- package/node_modules/ip-address/README.md +114 -114
- package/node_modules/ip-address/dist/common.d.ts +5 -0
- package/node_modules/ip-address/dist/common.js +12 -0
- package/node_modules/ip-address/dist/common.js.map +1 -1
- package/node_modules/ip-address/dist/ipv4.d.ts +10 -3
- package/node_modules/ip-address/dist/ipv4.js +20 -5
- package/node_modules/ip-address/dist/ipv4.js.map +1 -1
- package/node_modules/ip-address/dist/ipv6.d.ts +5 -1
- package/node_modules/ip-address/dist/ipv6.js +18 -3
- package/node_modules/ip-address/dist/ipv6.js.map +1 -1
- package/node_modules/ip-address/package.json +1 -1
- package/node_modules/proxy-addr/HISTORY.md +60 -54
- package/node_modules/proxy-addr/README.md +1 -1
- package/node_modules/proxy-addr/index.js +32 -0
- package/node_modules/proxy-addr/package.json +8 -4
- package/node_modules/qs/.github/THREAT_MODEL.md +3 -3
- package/node_modules/qs/CHANGELOG.md +15 -0
- package/node_modules/qs/README.md +19 -1
- package/node_modules/qs/dist/qs.js +21 -21
- package/node_modules/qs/eslint.config.mjs +1 -1
- package/node_modules/qs/lib/parse.js +3 -4
- package/node_modules/qs/lib/stringify.js +23 -8
- package/node_modules/qs/lib/utils.js +10 -3
- package/node_modules/qs/package.json +4 -4
- package/node_modules/qs/test/parse.js +192 -3
- package/node_modules/qs/test/stringify.js +317 -0
- package/node_modules/qs/test/utils.js +12 -0
- package/node_modules/undici-types/client.d.ts +8 -3
- package/node_modules/undici-types/connector.d.ts +1 -0
- package/node_modules/undici-types/cookies.d.ts +1 -1
- package/node_modules/undici-types/dispatcher.d.ts +3 -3
- package/node_modules/undici-types/errors.d.ts +10 -0
- package/node_modules/undici-types/fetch.d.ts +5 -1
- package/node_modules/undici-types/handlers.d.ts +2 -0
- package/node_modules/undici-types/interceptors.d.ts +1 -1
- package/node_modules/undici-types/mock-interceptor.d.ts +5 -1
- package/node_modules/undici-types/package.json +1 -1
- package/node_modules/undici-types/proxy-agent.d.ts +7 -0
- package/package.json +1 -1
- package/dist/ui/assets/index-BYVb_0oG.css +0 -1
- package/dist/ui/assets/index-Z0OQ-dd1.js +0 -110
|
@@ -1,144 +1,150 @@
|
|
|
1
|
-
2.0.
|
|
2
|
-
|
|
1
|
+
2.0.8
|
|
2
|
+
=====
|
|
3
|
+
|
|
4
|
+
* Fix [CVE-2026-90711](https://www.cve.org/CVERecord?id=CVE-2026-90711) ([GHSA-jqcg-44mw-7w3h](https://github.com/jshttp/proxy-addr/security/advisories/GHSA-jqcg-44mw-7w3h))
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
2.0.7
|
|
8
|
+
=====
|
|
3
9
|
|
|
4
10
|
* deps: forwarded@0.2.0
|
|
5
11
|
- Use `req.socket` over deprecated `req.connection`
|
|
6
12
|
|
|
7
|
-
2.0.6
|
|
8
|
-
|
|
13
|
+
2.0.6
|
|
14
|
+
=====
|
|
9
15
|
|
|
10
16
|
* deps: ipaddr.js@1.9.1
|
|
11
17
|
|
|
12
|
-
2.0.5
|
|
13
|
-
|
|
18
|
+
2.0.5
|
|
19
|
+
=====
|
|
14
20
|
|
|
15
21
|
* deps: ipaddr.js@1.9.0
|
|
16
22
|
|
|
17
|
-
2.0.4
|
|
18
|
-
|
|
23
|
+
2.0.4
|
|
24
|
+
=====
|
|
19
25
|
|
|
20
26
|
* deps: ipaddr.js@1.8.0
|
|
21
27
|
|
|
22
|
-
2.0.3
|
|
23
|
-
|
|
28
|
+
2.0.3
|
|
29
|
+
=====
|
|
24
30
|
|
|
25
31
|
* deps: ipaddr.js@1.6.0
|
|
26
32
|
|
|
27
|
-
2.0.2
|
|
28
|
-
|
|
33
|
+
2.0.2
|
|
34
|
+
=====
|
|
29
35
|
|
|
30
36
|
* deps: forwarded@~0.1.2
|
|
31
37
|
- perf: improve header parsing
|
|
32
38
|
- perf: reduce overhead when no `X-Forwarded-For` header
|
|
33
39
|
|
|
34
|
-
2.0.1
|
|
35
|
-
|
|
40
|
+
2.0.1
|
|
41
|
+
=====
|
|
36
42
|
|
|
37
43
|
* deps: forwarded@~0.1.1
|
|
38
44
|
- Fix trimming leading / trailing OWS
|
|
39
45
|
- perf: hoist regular expression
|
|
40
46
|
* deps: ipaddr.js@1.5.2
|
|
41
47
|
|
|
42
|
-
2.0.0
|
|
43
|
-
|
|
48
|
+
2.0.0
|
|
49
|
+
=====
|
|
44
50
|
|
|
45
51
|
* Drop support for Node.js below 0.10
|
|
46
52
|
|
|
47
|
-
1.1.5
|
|
48
|
-
|
|
53
|
+
1.1.5
|
|
54
|
+
=====
|
|
49
55
|
|
|
50
56
|
* Fix array argument being altered
|
|
51
57
|
* deps: ipaddr.js@1.4.0
|
|
52
58
|
|
|
53
|
-
1.1.4
|
|
54
|
-
|
|
59
|
+
1.1.4
|
|
60
|
+
=====
|
|
55
61
|
|
|
56
62
|
* deps: ipaddr.js@1.3.0
|
|
57
63
|
|
|
58
|
-
1.1.3
|
|
59
|
-
|
|
64
|
+
1.1.3
|
|
65
|
+
=====
|
|
60
66
|
|
|
61
67
|
* deps: ipaddr.js@1.2.0
|
|
62
68
|
|
|
63
|
-
1.1.2
|
|
64
|
-
|
|
69
|
+
1.1.2
|
|
70
|
+
=====
|
|
65
71
|
|
|
66
72
|
* deps: ipaddr.js@1.1.1
|
|
67
73
|
- Fix IPv6-mapped IPv4 validation edge cases
|
|
68
74
|
|
|
69
|
-
1.1.1
|
|
70
|
-
|
|
75
|
+
1.1.1
|
|
76
|
+
=====
|
|
71
77
|
|
|
72
78
|
* Fix regression matching mixed versions against multiple subnets
|
|
73
79
|
|
|
74
|
-
1.1.0
|
|
75
|
-
|
|
80
|
+
1.1.0
|
|
81
|
+
=====
|
|
76
82
|
|
|
77
83
|
* Fix accepting various invalid netmasks
|
|
78
84
|
- IPv4 netmasks must be contingous
|
|
79
85
|
- IPv6 addresses cannot be used as a netmask
|
|
80
86
|
* deps: ipaddr.js@1.1.0
|
|
81
87
|
|
|
82
|
-
1.0.10
|
|
83
|
-
|
|
88
|
+
1.0.10
|
|
89
|
+
======
|
|
84
90
|
|
|
85
91
|
* deps: ipaddr.js@1.0.5
|
|
86
92
|
- Fix regression in `isValid` with non-string arguments
|
|
87
93
|
|
|
88
|
-
1.0.9
|
|
89
|
-
|
|
94
|
+
1.0.9
|
|
95
|
+
=====
|
|
90
96
|
|
|
91
97
|
* deps: ipaddr.js@1.0.4
|
|
92
98
|
- Fix accepting some invalid IPv6 addresses
|
|
93
99
|
- Reject CIDRs with negative or overlong masks
|
|
94
100
|
* perf: enable strict mode
|
|
95
101
|
|
|
96
|
-
1.0.8
|
|
97
|
-
|
|
102
|
+
1.0.8
|
|
103
|
+
=====
|
|
98
104
|
|
|
99
105
|
* deps: ipaddr.js@1.0.1
|
|
100
106
|
|
|
101
|
-
1.0.7
|
|
102
|
-
|
|
107
|
+
1.0.7
|
|
108
|
+
=====
|
|
103
109
|
|
|
104
110
|
* deps: ipaddr.js@0.1.9
|
|
105
111
|
- Fix OOM on certain inputs to `isValid`
|
|
106
112
|
|
|
107
|
-
1.0.6
|
|
108
|
-
|
|
113
|
+
1.0.6
|
|
114
|
+
=====
|
|
109
115
|
|
|
110
116
|
* deps: ipaddr.js@0.1.8
|
|
111
117
|
|
|
112
|
-
1.0.5
|
|
113
|
-
|
|
118
|
+
1.0.5
|
|
119
|
+
=====
|
|
114
120
|
|
|
115
121
|
* deps: ipaddr.js@0.1.6
|
|
116
122
|
|
|
117
|
-
1.0.4
|
|
118
|
-
|
|
123
|
+
1.0.4
|
|
124
|
+
=====
|
|
119
125
|
|
|
120
126
|
* deps: ipaddr.js@0.1.5
|
|
121
127
|
- Fix edge cases with `isValid`
|
|
122
128
|
|
|
123
|
-
1.0.3
|
|
124
|
-
|
|
129
|
+
1.0.3
|
|
130
|
+
=====
|
|
125
131
|
|
|
126
132
|
* Use `forwarded` npm module
|
|
127
133
|
|
|
128
|
-
1.0.2
|
|
129
|
-
|
|
134
|
+
1.0.2
|
|
135
|
+
=====
|
|
130
136
|
|
|
131
137
|
* Fix a global leak when multiple subnets are trusted
|
|
132
138
|
* Support Node.js 0.6
|
|
133
139
|
* deps: ipaddr.js@0.1.3
|
|
134
140
|
|
|
135
|
-
1.0.1
|
|
136
|
-
|
|
141
|
+
1.0.1
|
|
142
|
+
=====
|
|
137
143
|
|
|
138
144
|
* Fix links in npm package
|
|
139
145
|
|
|
140
|
-
1.0.0
|
|
141
|
-
|
|
146
|
+
1.0.0
|
|
147
|
+
=====
|
|
142
148
|
|
|
143
149
|
* Add `trust` argument to determine proxy trust on
|
|
144
150
|
* Accepts custom function
|
|
@@ -150,12 +156,12 @@
|
|
|
150
156
|
* Add `proxyaddr.compile` to pre-compile `trust` function
|
|
151
157
|
to make subsequent calls faster
|
|
152
158
|
|
|
153
|
-
0.0.1
|
|
154
|
-
|
|
159
|
+
0.0.1
|
|
160
|
+
=====
|
|
155
161
|
|
|
156
162
|
* Fix bad npm publish
|
|
157
163
|
|
|
158
|
-
0.0.0
|
|
159
|
-
|
|
164
|
+
0.0.0
|
|
165
|
+
=====
|
|
160
166
|
|
|
161
167
|
* Initial release
|
|
@@ -37,7 +37,7 @@ proxyaddr(req, function (addr) { return addr === '127.0.0.1' })
|
|
|
37
37
|
proxyaddr(req, function (addr, i) { return i < 1 })
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
The `trust`
|
|
40
|
+
The `trust` argument may also be a single IP address string or an
|
|
41
41
|
array of trusted addresses, as plain IP addresses, CIDR-formatted
|
|
42
42
|
strings, or IP/netmask strings.
|
|
43
43
|
|
|
@@ -256,6 +256,13 @@ function trustMulti (subnets) {
|
|
|
256
256
|
if (!isip(addr)) return false
|
|
257
257
|
|
|
258
258
|
var ip = parseip(addr)
|
|
259
|
+
|
|
260
|
+
if (ip.kind() === 'ipv6' && ip.isIPv4MappedAddress()) {
|
|
261
|
+
// Canonicalize IPv4-mapped candidates to IPv4 so a mapped address
|
|
262
|
+
// cannot bypass the cross-family guard via the same-family path
|
|
263
|
+
ip = ip.toIPv4Address()
|
|
264
|
+
}
|
|
265
|
+
|
|
259
266
|
var ipconv
|
|
260
267
|
var kind = ip.kind()
|
|
261
268
|
|
|
@@ -272,6 +279,12 @@ function trustMulti (subnets) {
|
|
|
272
279
|
continue
|
|
273
280
|
}
|
|
274
281
|
|
|
282
|
+
if (subnetkind !== 'ipv4' && !(subnetrange >= 96 && subnetip.isIPv4MappedAddress())) {
|
|
283
|
+
// IPv6 subnet only spans IPv4 when it is a mapped subnet whose
|
|
284
|
+
// prefix covers the ::ffff: marker; otherwise it must not match IPv4
|
|
285
|
+
continue
|
|
286
|
+
}
|
|
287
|
+
|
|
275
288
|
if (!ipconv) {
|
|
276
289
|
// Convert IP to match subnet IP kind
|
|
277
290
|
ipconv = subnetkind === 'ipv4'
|
|
@@ -280,6 +293,9 @@ function trustMulti (subnets) {
|
|
|
280
293
|
}
|
|
281
294
|
|
|
282
295
|
trusted = ipconv
|
|
296
|
+
} else if (kind === 'ipv6' && subnetip.isIPv4MappedAddress()) {
|
|
297
|
+
// A native IPv6 candidate cannot match an IPv4-mapped subnet
|
|
298
|
+
continue
|
|
283
299
|
}
|
|
284
300
|
|
|
285
301
|
if (trusted.match(subnetip, subnetrange)) {
|
|
@@ -308,6 +324,13 @@ function trustSingle (subnet) {
|
|
|
308
324
|
if (!isip(addr)) return false
|
|
309
325
|
|
|
310
326
|
var ip = parseip(addr)
|
|
327
|
+
|
|
328
|
+
if (ip.kind() === 'ipv6' && ip.isIPv4MappedAddress()) {
|
|
329
|
+
// Canonicalize IPv4-mapped candidates to IPv4 so a mapped address
|
|
330
|
+
// cannot bypass the cross-family guard via the same-family path
|
|
331
|
+
ip = ip.toIPv4Address()
|
|
332
|
+
}
|
|
333
|
+
|
|
311
334
|
var kind = ip.kind()
|
|
312
335
|
|
|
313
336
|
if (kind !== subnetkind) {
|
|
@@ -316,10 +339,19 @@ function trustSingle (subnet) {
|
|
|
316
339
|
return false
|
|
317
340
|
}
|
|
318
341
|
|
|
342
|
+
if (!subnetisipv4 && !(subnetrange >= 96 && subnetip.isIPv4MappedAddress())) {
|
|
343
|
+
// IPv6 subnet only spans IPv4 when it is a mapped subnet whose
|
|
344
|
+
// prefix covers the ::ffff: marker; otherwise it must not match IPv4
|
|
345
|
+
return false
|
|
346
|
+
}
|
|
347
|
+
|
|
319
348
|
// Convert IP to match subnet IP kind
|
|
320
349
|
ip = subnetisipv4
|
|
321
350
|
? ip.toIPv4Address()
|
|
322
351
|
: ip.toIPv4MappedAddress()
|
|
352
|
+
} else if (kind === 'ipv6' && subnetip.isIPv4MappedAddress()) {
|
|
353
|
+
// A native IPv6 candidate cannot match an IPv4-mapped subnet
|
|
354
|
+
return false
|
|
323
355
|
}
|
|
324
356
|
|
|
325
357
|
return ip.match(subnetip, subnetrange)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "proxy-addr",
|
|
3
3
|
"description": "Determine address of proxied request",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.8",
|
|
5
5
|
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
"x-forwarded-for"
|
|
11
11
|
],
|
|
12
12
|
"repository": "jshttp/proxy-addr",
|
|
13
|
+
"funding": {
|
|
14
|
+
"type": "opencollective",
|
|
15
|
+
"url": "https://opencollective.com/express"
|
|
16
|
+
},
|
|
13
17
|
"dependencies": {
|
|
14
18
|
"forwarded": "0.2.0",
|
|
15
19
|
"ipaddr.js": "1.9.1"
|
|
@@ -17,11 +21,11 @@
|
|
|
17
21
|
"devDependencies": {
|
|
18
22
|
"benchmark": "2.1.4",
|
|
19
23
|
"beautify-benchmark": "0.2.4",
|
|
20
|
-
"deep-equal": "1.
|
|
24
|
+
"deep-equal": "1.1.2",
|
|
21
25
|
"eslint": "7.26.0",
|
|
22
26
|
"eslint-config-standard": "14.1.1",
|
|
23
|
-
"eslint-plugin-import": "2.
|
|
24
|
-
"eslint-plugin-markdown": "2.2.
|
|
27
|
+
"eslint-plugin-import": "2.32.0",
|
|
28
|
+
"eslint-plugin-markdown": "2.2.1",
|
|
25
29
|
"eslint-plugin-node": "11.1.0",
|
|
26
30
|
"eslint-plugin-promise": "4.3.1",
|
|
27
31
|
"eslint-plugin-standard": "4.1.0",
|
|
@@ -25,7 +25,7 @@ Caller Application → qs.stringify(obj, options) → Stringifying Engine → Ou
|
|
|
25
25
|
|
|
26
26
|
**Trust Boundaries:**
|
|
27
27
|
- **Input string (parse):** May come from untrusted sources (e.g., user input, network requests)
|
|
28
|
-
- **Input object (stringify):** May contain cycles,
|
|
28
|
+
- **Input object (stringify):** The calling application's own data, not a direct untrusted channel. May contain cycles (handled by the cycle detector). Deeply-nested non-cyclic input surfaces as a catchable synchronous `RangeError` (stack overflow), not unbounded resource consumption; callers that serialize externally-influenced objects should bound their depth/size beforehand.
|
|
29
29
|
- **Options:** Provided by the caller
|
|
30
30
|
- **Cycle Tracking:** Used only during stringification to detect and handle circular references
|
|
31
31
|
|
|
@@ -58,7 +58,7 @@ Caller Application → qs.stringify(obj, options) → Stringifying Engine → Ou
|
|
|
58
58
|
|---------------------------------------------------|---------------------|
|
|
59
59
|
| Tampering (malicious input, prototype pollution) | Strict input validation; keep `allowPrototypes: false` by default; use `plainObjects` for output; ensure builtins/globals are never modified by parse[4][8]. |
|
|
60
60
|
| Information Disclosure (error messages) | Generic error messages without stack traces or internal paths. |
|
|
61
|
-
| Denial of Service (memory/CPU exhaustion) |
|
|
61
|
+
| Denial of Service (memory/CPU exhaustion) | `arrayLimit`, `parameterLimit`, and depth limiting apply with safe defaults. Note that `arrayLimit` is a representation threshold (array vs. object), and `parameterLimit` bounds only the number of `&`-delimited parameters - neither caps the elements produced by `comma: true` splitting. For a hard cap that rejects oversized untrusted input, opt in to `throwOnLimitExceeded: true` (default `false`), and always bound input size at the transport layer[7]. On the `stringify` side, the input is the caller's own object rather than an untrusted string, so unbounded nesting manifests as a catchable `RangeError` (stack overflow) rather than exhaustion; callers serializing externally-influenced objects should bound depth/size beforehand, and may opt into `stringify`'s `depth` option (default `Infinity`) for a deterministic, catchable error. |
|
|
62
62
|
| Elevation of Privilege (prototype pollution) | Keep `allowPrototypes: false`; validate options against allowlist; use `plainObjects` to avoid prototype pollution[4][8]. |
|
|
63
63
|
|
|
64
64
|
### 7. Risk Ranking
|
|
@@ -70,7 +70,7 @@ Caller Application → qs.stringify(obj, options) → Stringifying Engine → Ou
|
|
|
70
70
|
### 8. Next Steps & Review
|
|
71
71
|
|
|
72
72
|
1. **Audit option validation logic.**
|
|
73
|
-
2. **
|
|
73
|
+
2. **Depth limiting:** `parse` enforces a `depth` bound by default (with `strictDepth` to throw); `stringify` offers an opt-in `depth` bound (default `Infinity`, since its input is caller-produced) for defense-in-depth.
|
|
74
74
|
3. **Implement fuzz testing for parser and stringifier edge cases.**
|
|
75
75
|
4. **Regularly review dependencies for vulnerabilities.**
|
|
76
76
|
5. **Keep documentation and threat model up to date.**
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## **6.16.0**
|
|
2
|
+
- [New] `stringify`: add a `depth` option to bound recursion depth (default `Infinity`)
|
|
3
|
+
- [Fix] stringify: serialize Date values when a filter is provided
|
|
4
|
+
- [Fix] `parse`: enforce `arrayLimit` on comma groups under `[]=` when `throwOnLimitExceeded` is set
|
|
5
|
+
- [Fix] `parse`: flatten a collection appended to an overflowed array (#571)
|
|
6
|
+
- [Fix] `utils`: `isBuffer`: do not invoke a non-callable `constructor.isBuffer`
|
|
7
|
+
- [Fix] `stringify`: do not let `allowEmptyArrays` skip cycle detection (or drop own keys) on an empty array with own properties
|
|
8
|
+
- [Fix] `stringify`: encode dots in a top-level key with a primitive value when encodeDotInKeys is set (#562)
|
|
9
|
+
- [Docs] threat model: clarify `stringify` deep-nesting DoS is caller-bounded
|
|
10
|
+
- [Docs] clarify `arrayLimit` is a representation threshold, not an element-count cap
|
|
11
|
+
- [Tests] `parse`: remove a test that pinned `[]=` comma groups escaping `arrayLimit`
|
|
12
|
+
- [Tests] `stringify`: pin current `encodeDotInKeys` separator-dot behavior
|
|
13
|
+
- [Dev Deps] update `@ljharb/eslint-config`, `eslint`
|
|
14
|
+
- [Dev Deps] update `eslint`, `evalmd`
|
|
15
|
+
|
|
1
16
|
## **6.15.3**
|
|
2
17
|
- [Fix] `parse`: enforce `throwOnLimitExceeded` for cumulative array growth via `combine`/`merge`
|
|
3
18
|
- [Fix] `utils`: respect encoding of surrogate pairs across chunks (#559)
|
|
@@ -147,6 +147,8 @@ try {
|
|
|
147
147
|
|
|
148
148
|
When `throwOnLimitExceeded` is set to `false` (default), **qs** will parse up to the specified `parameterLimit` and ignore the rest without throwing an error.
|
|
149
149
|
|
|
150
|
+
Note that `parameterLimit` only bounds the number of `&`-delimited parameters; it does not limit how many values a single parameter expands into. In particular, when `comma: true` is enabled, a single parameter's value is split on commas into arbitrarily many elements, which `parameterLimit` does not constrain. To bound the total element count from untrusted input, set `throwOnLimitExceeded: true` (see `arrayLimit` below), and always bound the input size at the transport layer (e.g. an HTTP body-size limit).
|
|
151
|
+
|
|
150
152
|
To bypass the leading question mark, use `ignoreQueryPrefix`:
|
|
151
153
|
|
|
152
154
|
```javascript
|
|
@@ -313,7 +315,9 @@ try {
|
|
|
313
315
|
}
|
|
314
316
|
```
|
|
315
317
|
|
|
316
|
-
When `throwOnLimitExceeded` is set to `false` (default), **qs** will parse up to the specified `arrayLimit` and if the limit is exceeded, the array will instead be converted to an object with the index as the key
|
|
318
|
+
When `throwOnLimitExceeded` is set to `false` (default), **qs** will parse up to the specified `arrayLimit` and if the limit is exceeded, the array will instead be converted to an object with the index as the key.
|
|
319
|
+
|
|
320
|
+
Note that `arrayLimit` is a *representation* threshold that controls when a numerically-indexed collection switches from an array to an object — it is **not** a hard cap on the total number of elements parsed. With the default `throwOnLimitExceeded: false`, exceeding `arrayLimit` never rejects or truncates input; it only changes the container type, and the resulting object still holds every element (so its size stays proportional to the input). This conversion is itself a safeguard: it avoids allocating a huge sparse array for input like `a[999999999]`. If you need a hard limit that rejects oversized input from untrusted sources, set `throwOnLimitExceeded: true`.
|
|
317
321
|
|
|
318
322
|
To prevent array syntax (`a[]`, `a[0]`) from being parsed as arrays, set `parseArrays` to `false`.
|
|
319
323
|
Note that duplicate keys (e.g. `a=b&a=c`) may still produce arrays when `duplicates` is `'combine'` (the default).
|
|
@@ -410,6 +414,20 @@ var encoded = qs.stringify({ a: { b: 'c' } }, { encoder: function (str) {
|
|
|
410
414
|
|
|
411
415
|
_(Note: the `encoder` option does not apply if `encode` is `false`)_
|
|
412
416
|
|
|
417
|
+
By default, `qs.stringify` serializes an object of any nesting depth.
|
|
418
|
+
For backwards compatibility, and because its input is the caller's own object rather than a query string parsed by **qs**, this is unbounded.
|
|
419
|
+
If you serialize objects whose nesting can be influenced by untrusted input, bound it with the numeric `depth` option (default `Infinity`);
|
|
420
|
+
exceeding it throws a catchable `RangeError` instead of eventually overflowing the call stack:
|
|
421
|
+
|
|
422
|
+
```javascript
|
|
423
|
+
try {
|
|
424
|
+
qs.stringify({ a: { b: { c: { d: 'e' } } } }, { depth: 2 });
|
|
425
|
+
} catch (err) {
|
|
426
|
+
assert(err instanceof RangeError);
|
|
427
|
+
assert.strictEqual(err.message, 'Input depth exceeded depth option of 2');
|
|
428
|
+
}
|
|
429
|
+
```
|
|
430
|
+
|
|
413
431
|
Analogue to the `encoder` there is a `decoder` option for `parse` to override decoding of properties and values:
|
|
414
432
|
|
|
415
433
|
```javascript
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
"use strict";var stringify=require(4),parse=require(3),formats=require(1);module.exports={formats:formats,parse:parse,stringify:stringify};
|
|
6
6
|
|
|
7
7
|
},{"1":1,"3":3,"4":4}],3:[function(require,module,exports){
|
|
8
|
-
"use strict";var utils=require(5),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,defaults={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:utils.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictMerge:!0,strictNullHandling:!1,throwOnLimitExceeded:!1},interpretNumericEntities=function(e){return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},parseArrayValue=function(e,t,r
|
|
8
|
+
"use strict";var utils=require(5),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,defaults={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:utils.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictMerge:!0,strictNullHandling:!1,throwOnLimitExceeded:!1},interpretNumericEntities=function(e){return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},parseArrayValue=function(e,t,r){if(e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1){if(t.throwOnLimitExceeded)for(var i=0,a=e.indexOf(",");a>-1;){if((i+=1)>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");a=e.indexOf(",",a+1)}return e.split(",")}if(t.throwOnLimitExceeded&&r>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return e},isoSentinel="utf8=%26%2310003%3B",charsetSentinel="utf8=%E2%9C%93",parseValues=function parseQueryStringValues(e,t){var r={__proto__:null},i=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;i=i.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var a=t.parameterLimit===1/0?void 0:t.parameterLimit,o=i.split(t.delimiter,t.throwOnLimitExceeded&&void 0!==a?a+1:a);if(t.throwOnLimitExceeded&&void 0!==a&&o.length>a)throw new RangeError("Parameter limit exceeded. Only "+a+" parameter"+(1===a?"":"s")+" allowed.");var l,n=-1,s=t.charset;if(t.charsetSentinel)for(l=0;l<o.length;++l)0===o[l].indexOf("utf8=")&&(o[l]===charsetSentinel?s="utf-8":o[l]===isoSentinel&&(s="iso-8859-1"),n=l,l=o.length);for(l=0;l<o.length;++l)if(l!==n){var d,c,p=o[l],u=p.indexOf("]="),y=-1===u?p.indexOf("="):u+1;if(-1===y?(d=t.decoder(p,defaults.decoder,s,"key"),c=t.strictNullHandling?null:""):null!==(d=t.decoder(p.slice(0,y),defaults.decoder,s,"key"))&&(c=utils.maybeMap(parseArrayValue(p.slice(y+1),t,isArray(r[d])?r[d].length:0),function(e){return t.decoder(e,defaults.decoder,s,"value")})),c&&t.interpretNumericEntities&&"iso-8859-1"===s&&(c=interpretNumericEntities(String(c))),p.indexOf("[]=")>-1&&(c=isArray(c)?[c]:c),t.comma&&isArray(c)&&c.length>t.arrayLimit&&(c=utils.combine([],c,t.arrayLimit,t.plainObjects,t.throwOnLimitExceeded)),null!==d){var f=has.call(r,d);f&&("combine"===t.duplicates||p.indexOf("[]=")>-1)?r[d]=utils.combine(r[d],c,t.arrayLimit,t.plainObjects,t.throwOnLimitExceeded):f&&"last"!==t.duplicates||(r[d]=c)}}return r},parseObject=function(e,t,r,i){var a=0;if(e.length>0&&"[]"===e[e.length-1]){var o=e.slice(0,-1).join("");a=Array.isArray(t)&&t[o]?t[o].length:0}for(var l=i?t:parseArrayValue(t,r,a),n=e.length-1;n>=0;--n){var s,d=e[n];if("[]"===d&&r.parseArrays)s=utils.isOverflow(l)?l:r.allowEmptyArrays&&(""===l||r.strictNullHandling&&null===l)?[]:utils.combine([],l,r.arrayLimit,r.plainObjects,r.throwOnLimitExceeded);else{s=r.plainObjects?{__proto__:null}:{};var c="["===d.charAt(0)&&"]"===d.charAt(d.length-1)?d.slice(1,-1):d,p=r.decodeDotInKeys?c.replace(/%2E/g,"."):c,u=parseInt(p,10),y=!isNaN(u)&&d!==p&&String(u)===p&&u>=0&&r.parseArrays;if(r.parseArrays||""!==p)if(y&&u<r.arrayLimit)(s=[])[u]=l;else{if(y&&r.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+r.arrayLimit+" element"+(1===r.arrayLimit?"":"s")+" allowed in an array.");y?(s[u]=l,utils.markOverflow(s,u)):"__proto__"!==p&&(s[p]=l)}else s={0:l}}l=s}return l},splitKeyIntoSegments=function splitKeyIntoSegments(e,t){var r=t.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e;if(t.depth<=0){if(!t.plainObjects&&has.call(Object.prototype,r)&&!t.allowPrototypes)return;return[r]}var i=[],a=r.indexOf("["),o=a>=0?r.slice(0,a):r;if(o){if(!t.plainObjects&&has.call(Object.prototype,o)&&!t.allowPrototypes)return;i[i.length]=o}for(var l=r.length,n=a,s=0;n>=0&&s<t.depth;){for(var d=1,c=n+1,p=-1;c<l&&p<0;){var u=r.charCodeAt(c);91===u?d+=1:93===u&&0==(d-=1)&&(p=c),c+=1}if(p<0)return i[i.length]="["+r.slice(n)+"]",i;var y=r.slice(n,p+1),f=y.slice(1,-1);if(!t.plainObjects&&has.call(Object.prototype,f)&&!t.allowPrototypes)return;i[i.length]=y,s+=1,n=r.indexOf("[",p+1)}if(n>=0){if(!0===t.strictDepth)throw new RangeError("Input depth exceeded depth option of "+t.depth+" and strictDepth is true");i[i.length]="["+r.slice(n)+"]"}return i},parseKeys=function parseQueryStringKeys(e,t,r,i){if(e){var a=splitKeyIntoSegments(e,r);if(a)return parseObject(a,t,r,i)}},normalizeParseOptions=function normalizeParseOptions(e){if(!e)return defaults;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.decodeDotInKeys&&"boolean"!=typeof e.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(void 0!==e.throwOnLimitExceeded&&"boolean"!=typeof e.throwOnLimitExceeded)throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var t=void 0===e.charset?defaults.charset:e.charset,r=void 0===e.duplicates?defaults.duplicates:e.duplicates;if("combine"!==r&&"first"!==r&&"last"!==r)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===e.allowDots?!0===e.decodeDotInKeys||defaults.allowDots:!!e.allowDots,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:defaults.allowEmptyArrays,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:defaults.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:defaults.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:defaults.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:defaults.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:defaults.comma,decodeDotInKeys:"boolean"==typeof e.decodeDotInKeys?e.decodeDotInKeys:defaults.decodeDotInKeys,decoder:"function"==typeof e.decoder?e.decoder:defaults.decoder,delimiter:"string"==typeof e.delimiter||utils.isRegExp(e.delimiter)?e.delimiter:defaults.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:defaults.depth,duplicates:r,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:defaults.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:defaults.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:defaults.plainObjects,strictDepth:"boolean"==typeof e.strictDepth?!!e.strictDepth:defaults.strictDepth,strictMerge:"boolean"==typeof e.strictMerge?!!e.strictMerge:defaults.strictMerge,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:defaults.strictNullHandling,throwOnLimitExceeded:"boolean"==typeof e.throwOnLimitExceeded&&e.throwOnLimitExceeded}};module.exports=function(e,t){var r=normalizeParseOptions(t);if(""===e||null==e)return r.plainObjects?{__proto__:null}:{};for(var i="string"==typeof e?parseValues(e,r):e,a=r.plainObjects?{__proto__:null}:{},o=Object.keys(i),l=0;l<o.length;++l){var n=o[l],s=parseKeys(n,i[n],r,"string"==typeof e);a=utils.merge(a,s,r)}return!0===r.allowSparse?a:utils.compact(a)};
|
|
9
9
|
|
|
10
10
|
},{"5":5}],4:[function(require,module,exports){
|
|
11
|
-
"use strict";var getSideChannel=require(46),utils=require(5),formats=require(1),has=Object.prototype.hasOwnProperty,arrayPrefixGenerators={brackets:function brackets(e){return e+"[]"},comma:"comma",indices:function indices(e,r){return e+"["+r+"]"},repeat:function repeat(e){return e}},isArray=Array.isArray,push=Array.prototype.push,pushToArray=function(e,r){push.apply(e,isArray(r)?r:[r])},toISO=Date.prototype.toISOString,defaultFormat=formats.default,defaults={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:utils.encode,encodeValuesOnly:!1,filter:void 0,format:defaultFormat,formatter:formats.formatters[defaultFormat],indices:!1,serializeDate:function serializeDate(e){return toISO.call(e)},skipNulls:!1,strictNullHandling:!1},isNonNullishPrimitive=function isNonNullishPrimitive(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||"symbol"==typeof e||"bigint"==typeof e},sentinel={},stringify=function stringify(e,r,t,o,a,
|
|
11
|
+
"use strict";var getSideChannel=require(46),utils=require(5),formats=require(1),has=Object.prototype.hasOwnProperty,arrayPrefixGenerators={brackets:function brackets(e){return e+"[]"},comma:"comma",indices:function indices(e,r){return e+"["+r+"]"},repeat:function repeat(e){return e}},isArray=Array.isArray,push=Array.prototype.push,pushToArray=function(e,r){push.apply(e,isArray(r)?r:[r])},toISO=Date.prototype.toISOString,defaultFormat=formats.default,defaults={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",depth:1/0,encode:!0,encodeDotInKeys:!1,encoder:utils.encode,encodeValuesOnly:!1,filter:void 0,format:defaultFormat,formatter:formats.formatters[defaultFormat],indices:!1,serializeDate:function serializeDate(e){return toISO.call(e)},skipNulls:!1,strictNullHandling:!1},isNonNullishPrimitive=function isNonNullishPrimitive(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||"symbol"==typeof e||"bigint"==typeof e},sentinel={},stringify=function stringify(e,r,t,o,n,a,i,l,s,f,u,d,y,c,p,m,h,v,g,w){var b=e;if(w>g)throw new RangeError("Input depth exceeded depth option of "+g);for(var D=v,A=0,S=!1;void 0!==(D=D.get(sentinel))&&!S;){var E=D.get(e);if(A+=1,void 0!==E){if(E===A)throw new RangeError("Cyclic object value");S=!0}void 0===D.get(sentinel)&&(A=0)}if((b="function"==typeof f?f(r,b):b)instanceof Date?b=y(b):"comma"===t&&isArray(b)&&(b=utils.maybeMap(b,function(e){return e instanceof Date?y(e):e})),null===b){if(a)return p(s&&!m?s(r,defaults.encoder,h,"key",c):r);b=""}if(isNonNullishPrimitive(b)||utils.isBuffer(b))return s?[p(m?r:s(r,defaults.encoder,h,"key",c))+"="+p(s(b,defaults.encoder,h,"value",c))]:[p(r)+"="+p(String(b))];var N,O=[];if(void 0===b)return O;if("comma"===t&&isArray(b))m&&s&&(b=utils.maybeMap(b,function(e){return null==e?e:s(e)})),N=[{value:b.length>0?b.join(",")||null:void 0}];else if(isArray(f))N=f;else{var T=Object.keys(b);N=u?T.sort(u):T}var k=l?String(r).replace(/\./g,"%2E"):String(r),I=o&&isArray(b)&&1===b.length?k+"[]":k;if(n&&isArray(b)&&0===b.length&&0===Object.keys(b).length)return I+"[]";for(var P=0;P<N.length;++P){var x=N[P],K="object"==typeof x&&x&&void 0!==x.value?x.value:b[x];if(!i||null!==K){var z=d&&l?String(x).replace(/\./g,"%2E"):String(x),j=isArray(b)?"function"==typeof t?t(I,z):I:I+(d?"."+z:"["+z+"]");v.set(e,A);var F=getSideChannel();F.set(sentinel,v),pushToArray(O,stringify(K,j,t,o,n,a,i,l,"comma"===t&&m&&isArray(b)?null:s,f,u,d,y,c,p,m,h,F,g,w+1))}}return O},normalizeStringifyOptions=function normalizeStringifyOptions(e){if(!e)return defaults;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.encodeDotInKeys&&"boolean"!=typeof e.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var r=e.charset||defaults.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=formats.default;if(void 0!==e.format){if(!has.call(formats.formatters,e.format))throw new TypeError("Unknown format option provided.");t=e.format}var o,n=formats.formatters[t],a=defaults.filter;if(("function"==typeof e.filter||isArray(e.filter))&&(a=e.filter),o=e.arrayFormat in arrayPrefixGenerators?e.arrayFormat:"indices"in e?e.indices?"indices":"repeat":defaults.arrayFormat,"commaRoundTrip"in e&&"boolean"!=typeof e.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var i=void 0===e.allowDots?!0===e.encodeDotInKeys||defaults.allowDots:!!e.allowDots;return{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:defaults.addQueryPrefix,allowDots:i,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:defaults.allowEmptyArrays,arrayFormat:o,charset:r,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:defaults.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:void 0===e.delimiter?defaults.delimiter:e.delimiter,depth:"number"==typeof e.depth?e.depth:defaults.depth,encode:"boolean"==typeof e.encode?e.encode:defaults.encode,encodeDotInKeys:"boolean"==typeof e.encodeDotInKeys?e.encodeDotInKeys:defaults.encodeDotInKeys,encoder:"function"==typeof e.encoder?e.encoder:defaults.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:defaults.encodeValuesOnly,filter:a,format:t,formatter:n,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:defaults.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:defaults.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:defaults.strictNullHandling}};module.exports=function(e,r){var t,o=e,n=normalizeStringifyOptions(r);"function"==typeof n.filter?o=(0,n.filter)("",o):isArray(n.filter)&&(t=n.filter);var a=[];if("object"!=typeof o||null===o)return"";var i=arrayPrefixGenerators[n.arrayFormat],l="comma"===i&&n.commaRoundTrip;t||(t=Object.keys(o)),n.sort&&t.sort(n.sort);for(var s=getSideChannel(),f=0;f<t.length;++f){var u=t[f];if(null!=u){var d=o[u];if(!n.skipNulls||null!==d){var y=n.encodeDotInKeys?String(u).replace(/\./g,"%2E"):String(u);pushToArray(a,stringify(d,y,i,l,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,s,n.depth,0))}}}var c=a.join(n.delimiter),p=!0===n.addQueryPrefix?"?":"";return n.charsetSentinel&&("iso-8859-1"===n.charset?p+="utf8=%26%2310003%3B"+n.delimiter:p+="utf8=%E2%9C%93"+n.delimiter),c.length>0?p+c:""};
|
|
12
12
|
|
|
13
13
|
},{"1":1,"46":46,"5":5}],5:[function(require,module,exports){
|
|
14
|
-
"use strict";var formats=require(1),getSideChannel=require(46),defineProperty=require(14),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,overflowChannel=getSideChannel(),markOverflow=function markOverflow(e,r){return overflowChannel.set(e,r),e},isOverflow=function isOverflow(e){return overflowChannel.has(e)},getMaxIndex=function getMaxIndex(e){return overflowChannel.get(e)},setMaxIndex=function setMaxIndex(e,r){overflowChannel.set(e,r)},hexTable=function(){for(var e=[],r=0;r<256;++r)e[e.length]="%"+((r<16?"0":"")+r.toString(16)).toUpperCase();return e}(),compactQueue=function compactQueue(e){for(;e.length>1;){var r=e.pop(),t=r.obj[r.prop];if(isArray(t)){for(var n=[],a=0;a<t.length;++a)void 0!==t[a]&&(n[n.length]=t[a]);r.obj[r.prop]=n}}},arrayToObject=function arrayToObject(e,r){for(var t=r&&r.plainObjects?{__proto__:null}:{},n=0;n<e.length;++n)void 0!==e[n]&&(t[n]=e[n]);return t},setProperty=function setProperty(e,r,t){"__proto__"===r&&defineProperty?defineProperty(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t},merge=function merge(e,r,t){if(!r)return e;if("object"!=typeof r&&"function"!=typeof r){if(isArray(e)){var n=e.length;if(t&&"number"==typeof t.arrayLimit&&n>=t.arrayLimit){if(t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return markOverflow(arrayToObject(e.concat(r),t),n)}e[n]=r}else{if(!e||"object"!=typeof e)return[e,r];if(isOverflow(e)){var a=getMaxIndex(e)+1;e[a]=r,setMaxIndex(e,a)}else{if(t&&t.strictMerge)return[e,r];(t&&(t.plainObjects||t.allowPrototypes)||!has.call(Object.prototype,r))&&(e[r]=!0)}}return e}if(!e||"object"!=typeof e){if(isOverflow(r)){for(var o=Object.keys(r),i=t&&t.plainObjects?{__proto__:null,0:e}:{0:e},l=0;l<o.length;l++)i[parseInt(o[l],10)+1]=r[o[l]];return markOverflow(i,getMaxIndex(r)+1)}var c=[e].concat(r);if(t&&"number"==typeof t.arrayLimit&&c.length>t.arrayLimit){if(t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return markOverflow(arrayToObject(c,t),c.length-1)}return c}var f=e;if(isArray(e)&&!isArray(r)&&(f=arrayToObject(e,t)),isArray(e)&&isArray(r)){if(r.forEach(function(r,n){if(has.call(e,n)){var a=e[n];a&&"object"==typeof a&&r&&"object"==typeof r?e[n]=merge(a,r,t):e[e.length]=r}else e[n]=r}),t&&"number"==typeof t.arrayLimit&&e.length>t.arrayLimit){if(t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return markOverflow(arrayToObject(e,t),e.length-1)}return e}return Object.keys(r).reduce(function(e,n){var a=r[n];if(has.call(e,n)?setProperty(e,n,merge(e[n],a,t)):setProperty(e,n,a),isOverflow(r)&&!isOverflow(e)&&markOverflow(e,getMaxIndex(r)),isOverflow(e)){var o=parseInt(n,10);String(o)===n&&o>=0&&o>getMaxIndex(e)&&setMaxIndex(e,o)}return e},f)},assign=function assignSingleSource(e,r){return Object.keys(r).reduce(function(e,t){return setProperty(e,t,r[t]),e},e)},decode=function(e,r,t){var n=e.replace(/\+/g," ");if("iso-8859-1"===t)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(e){return n}},limit=1024,encode=function encode(e,r,t,n,a){if(0===e.length)return e;var o=e;if("symbol"==typeof e?o=Symbol.prototype.toString.call(e):"string"!=typeof e&&(o=String(e)),"iso-8859-1"===t)return escape(o).replace(/%u[0-9a-f]{4}/gi,function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"});for(var i="",l=0;l<o.length;l+=limit){var c=o.length>=limit?o.slice(l,l+limit):o;if(l+limit<o.length){var f=c.charCodeAt(c.length-1);f>=55296&&f<=56319&&(c=c.slice(0,-1),l-=1)}for(var s=[],u=0;u<c.length;++u){var y=c.charCodeAt(u);45===y||46===y||95===y||126===y||y>=48&&y<=57||y>=65&&y<=90||y>=97&&y<=122||a===formats.RFC1738&&(40===y||41===y)?s[s.length]=c.charAt(u):y<128?s[s.length]=hexTable[y]:y<2048?s[s.length]=hexTable[192|y>>6]+hexTable[128|63&y]:y<55296||y>=57344?s[s.length]=hexTable[224|y>>12]+hexTable[128|y>>6&63]+hexTable[128|63&y]:(u+=1,y=65536+((1023&y)<<10|1023&c.charCodeAt(u)),s[s.length]=hexTable[240|y>>18]+hexTable[128|y>>12&63]+hexTable[128|y>>6&63]+hexTable[128|63&y])}i+=s.join("")}return i},compact=function compact(e){for(var r=[{obj:{o:e},prop:"o"}],t=getSideChannel(),n=0;n<r.length;++n)for(var a=r[n],o=a.obj[a.prop],i=Object.keys(o),l=0;l<i.length;++l){var c=i[l],f=o[c];"object"!=typeof f||null===f||t.has(f)||(r[r.length]={obj:o,prop:c},t.set(f,!0))}return compactQueue(r),e},isRegExp=function isRegExp(e){return"[object RegExp]"===Object.prototype.toString.call(e)},isBuffer=function isBuffer(e){return!(!e||"object"!=typeof e||!
|
|
14
|
+
"use strict";var formats=require(1),getSideChannel=require(46),defineProperty=require(14),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,overflowChannel=getSideChannel(),markOverflow=function markOverflow(e,r){return overflowChannel.set(e,r),e},isOverflow=function isOverflow(e){return overflowChannel.has(e)},getMaxIndex=function getMaxIndex(e){return overflowChannel.get(e)},setMaxIndex=function setMaxIndex(e,r){overflowChannel.set(e,r)},hexTable=function(){for(var e=[],r=0;r<256;++r)e[e.length]="%"+((r<16?"0":"")+r.toString(16)).toUpperCase();return e}(),compactQueue=function compactQueue(e){for(;e.length>1;){var r=e.pop(),t=r.obj[r.prop];if(isArray(t)){for(var n=[],a=0;a<t.length;++a)void 0!==t[a]&&(n[n.length]=t[a]);r.obj[r.prop]=n}}},arrayToObject=function arrayToObject(e,r){for(var t=r&&r.plainObjects?{__proto__:null}:{},n=0;n<e.length;++n)void 0!==e[n]&&(t[n]=e[n]);return t},setProperty=function setProperty(e,r,t){"__proto__"===r&&defineProperty?defineProperty(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t},merge=function merge(e,r,t){if(!r)return e;if("object"!=typeof r&&"function"!=typeof r){if(isArray(e)){var n=e.length;if(t&&"number"==typeof t.arrayLimit&&n>=t.arrayLimit){if(t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return markOverflow(arrayToObject(e.concat(r),t),n)}e[n]=r}else{if(!e||"object"!=typeof e)return[e,r];if(isOverflow(e)){var a=getMaxIndex(e)+1;e[a]=r,setMaxIndex(e,a)}else{if(t&&t.strictMerge)return[e,r];(t&&(t.plainObjects||t.allowPrototypes)||!has.call(Object.prototype,r))&&(e[r]=!0)}}return e}if(!e||"object"!=typeof e){if(isOverflow(r)){for(var o=Object.keys(r),i=t&&t.plainObjects?{__proto__:null,0:e}:{0:e},l=0;l<o.length;l++)i[parseInt(o[l],10)+1]=r[o[l]];return markOverflow(i,getMaxIndex(r)+1)}var c=[e].concat(r);if(t&&"number"==typeof t.arrayLimit&&c.length>t.arrayLimit){if(t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return markOverflow(arrayToObject(c,t),c.length-1)}return c}var f=e;if(isArray(e)&&!isArray(r)&&(f=arrayToObject(e,t)),isArray(e)&&isArray(r)){if(r.forEach(function(r,n){if(has.call(e,n)){var a=e[n];a&&"object"==typeof a&&r&&"object"==typeof r?e[n]=merge(a,r,t):e[e.length]=r}else e[n]=r}),t&&"number"==typeof t.arrayLimit&&e.length>t.arrayLimit){if(t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return markOverflow(arrayToObject(e,t),e.length-1)}return e}return Object.keys(r).reduce(function(e,n){var a=r[n];if(has.call(e,n)?setProperty(e,n,merge(e[n],a,t)):setProperty(e,n,a),isOverflow(r)&&!isOverflow(e)&&markOverflow(e,getMaxIndex(r)),isOverflow(e)){var o=parseInt(n,10);String(o)===n&&o>=0&&o>getMaxIndex(e)&&setMaxIndex(e,o)}return e},f)},assign=function assignSingleSource(e,r){return Object.keys(r).reduce(function(e,t){return setProperty(e,t,r[t]),e},e)},decode=function(e,r,t){var n=e.replace(/\+/g," ");if("iso-8859-1"===t)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(e){return n}},limit=1024,encode=function encode(e,r,t,n,a){if(0===e.length)return e;var o=e;if("symbol"==typeof e?o=Symbol.prototype.toString.call(e):"string"!=typeof e&&(o=String(e)),"iso-8859-1"===t)return escape(o).replace(/%u[0-9a-f]{4}/gi,function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"});for(var i="",l=0;l<o.length;l+=limit){var c=o.length>=limit?o.slice(l,l+limit):o;if(l+limit<o.length){var f=c.charCodeAt(c.length-1);f>=55296&&f<=56319&&(c=c.slice(0,-1),l-=1)}for(var s=[],u=0;u<c.length;++u){var y=c.charCodeAt(u);45===y||46===y||95===y||126===y||y>=48&&y<=57||y>=65&&y<=90||y>=97&&y<=122||a===formats.RFC1738&&(40===y||41===y)?s[s.length]=c.charAt(u):y<128?s[s.length]=hexTable[y]:y<2048?s[s.length]=hexTable[192|y>>6]+hexTable[128|63&y]:y<55296||y>=57344?s[s.length]=hexTable[224|y>>12]+hexTable[128|y>>6&63]+hexTable[128|63&y]:(u+=1,y=65536+((1023&y)<<10|1023&c.charCodeAt(u)),s[s.length]=hexTable[240|y>>18]+hexTable[128|y>>12&63]+hexTable[128|y>>6&63]+hexTable[128|63&y])}i+=s.join("")}return i},compact=function compact(e){for(var r=[{obj:{o:e},prop:"o"}],t=getSideChannel(),n=0;n<r.length;++n)for(var a=r[n],o=a.obj[a.prop],i=Object.keys(o),l=0;l<i.length;++l){var c=i[l],f=o[c];"object"!=typeof f||null===f||t.has(f)||(r[r.length]={obj:o,prop:c},t.set(f,!0))}return compactQueue(r),e},isRegExp=function isRegExp(e){return"[object RegExp]"===Object.prototype.toString.call(e)},isBuffer=function isBuffer(e){return!(!e||"object"!=typeof e||!e.constructor||"function"!=typeof e.constructor.isBuffer||!e.constructor.isBuffer(e))},combine=function combine(e,r,t,n,a){if(isOverflow(e)){if(a)throw new RangeError("Array limit exceeded. Only "+t+" element"+(1===t?"":"s")+" allowed in an array.");for(var o=isArray(r)?r:[r],i=getMaxIndex(e),l=0;l<o.length;++l)e[i+=1]=o[l];return setMaxIndex(e,i),e}var c=[].concat(e,r);if(c.length>t){if(a)throw new RangeError("Array limit exceeded. Only "+t+" element"+(1===t?"":"s")+" allowed in an array.");return markOverflow(arrayToObject(c,{plainObjects:n}),c.length-1)}return c},maybeMap=function maybeMap(e,r){if(isArray(e)){for(var t=[],n=0;n<e.length;n+=1)t[t.length]=r(e[n]);return t}return r(e)};module.exports={/* common-shake removed: arrayToObject:arrayToObject *//* common-shake removed: assign:assign */combine:combine,compact:compact,decode:decode,encode:encode,isBuffer:isBuffer,isOverflow:isOverflow,isRegExp:isRegExp,markOverflow:markOverflow,maybeMap:maybeMap,merge:merge};
|
|
15
15
|
|
|
16
16
|
},{"1":1,"14":14,"46":46}],46:[function(require,module,exports){
|
|
17
17
|
"use strict";var $TypeError=require(20),inspect=require(42),getSideChannelList=require(43),getSideChannelMap=require(44),getSideChannelWeakMap=require(45),makeChannel=getSideChannelWeakMap||getSideChannelMap||getSideChannelList;module.exports=function getSideChannel(){var e,n={assert:function(e){if(!n.has(e)){var t=e&&Object(e)===e?"the given object key":inspect(e);throw new $TypeError("Side channel does not contain "+t)}},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,t){e||(e=makeChannel()),e.set(n,t)}};return n};
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
},{}],7:[function(require,module,exports){
|
|
25
25
|
"use strict";var bind=require(24),$apply=require(8),$call=require(9),$reflectApply=require(11);module.exports=$reflectApply||bind.call($call,$apply);
|
|
26
26
|
|
|
27
|
-
},{"11":11,"24":24,"8":8,"9":9}],
|
|
28
|
-
"use strict";module.exports=Function.prototype.call;
|
|
29
|
-
|
|
30
|
-
},{}],8:[function(require,module,exports){
|
|
27
|
+
},{"11":11,"24":24,"8":8,"9":9}],8:[function(require,module,exports){
|
|
31
28
|
"use strict";module.exports=Function.prototype.apply;
|
|
32
29
|
|
|
30
|
+
},{}],9:[function(require,module,exports){
|
|
31
|
+
"use strict";module.exports=Function.prototype.call;
|
|
32
|
+
|
|
33
33
|
},{}],24:[function(require,module,exports){
|
|
34
34
|
"use strict";var implementation=require(23);module.exports=Function.prototype.bind||implementation;
|
|
35
35
|
|
|
@@ -78,23 +78,23 @@
|
|
|
78
78
|
},{}],23:[function(require,module,exports){
|
|
79
79
|
"use strict";var ERROR_MESSAGE="Function.prototype.bind called on incompatible ",toStr=Object.prototype.toString,max=Math.max,funcType="[object Function]",concatty=function concatty(t,n){for(var r=[],o=0;o<t.length;o+=1)r[o]=t[o];for(var e=0;e<n.length;e+=1)r[e+t.length]=n[e];return r},slicy=function slicy(t,n){for(var r=[],o=n||0,e=0;o<t.length;o+=1,e+=1)r[e]=t[o];return r},joiny=function(t,n){for(var r="",o=0;o<t.length;o+=1)r+=t[o],o+1<t.length&&(r+=n);return r};module.exports=function bind(t){var n=this;if("function"!=typeof n||toStr.apply(n)!==funcType)throw new TypeError(ERROR_MESSAGE+n);for(var r,o=slicy(arguments,1),e=max(0,n.length-o.length),i=[],c=0;c<e;c++)i[c]="$"+c;if(r=Function("binder","return function ("+joiny(i,",")+"){ return binder.apply(this,arguments); }")(function(){if(this instanceof r){var e=n.apply(this,concatty(o,arguments));return Object(e)===e?e:this}return n.apply(t,concatty(o,arguments))}),n.prototype){var p=function Empty(){};p.prototype=n.prototype,r.prototype=new p,p.prototype=null}return r};
|
|
80
80
|
|
|
81
|
-
},{}],
|
|
82
|
-
"use strict";module.exports=Math.
|
|
83
|
-
|
|
84
|
-
},{}],40:[function(require,module,exports){
|
|
85
|
-
"use strict";module.exports=Math.round;
|
|
81
|
+
},{}],35:[function(require,module,exports){
|
|
82
|
+
"use strict";module.exports=Math.floor;
|
|
86
83
|
|
|
87
84
|
},{}],34:[function(require,module,exports){
|
|
88
85
|
"use strict";module.exports=Math.abs;
|
|
89
86
|
|
|
90
|
-
},{}],
|
|
91
|
-
"use strict";module.exports=Math.
|
|
87
|
+
},{}],37:[function(require,module,exports){
|
|
88
|
+
"use strict";module.exports=Math.max;
|
|
92
89
|
|
|
93
90
|
},{}],39:[function(require,module,exports){
|
|
94
91
|
"use strict";module.exports=Math.pow;
|
|
95
92
|
|
|
96
|
-
},{}],
|
|
97
|
-
"use strict";module.exports=Math.
|
|
93
|
+
},{}],40:[function(require,module,exports){
|
|
94
|
+
"use strict";module.exports=Math.round;
|
|
95
|
+
|
|
96
|
+
},{}],38:[function(require,module,exports){
|
|
97
|
+
"use strict";module.exports=Math.min;
|
|
98
98
|
|
|
99
99
|
},{}],27:[function(require,module,exports){
|
|
100
100
|
"use strict";module.exports="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null;
|
|
@@ -102,13 +102,13 @@
|
|
|
102
102
|
},{}],26:[function(require,module,exports){
|
|
103
103
|
"use strict";var $Object=require(22);module.exports=$Object.getPrototypeOf||null;
|
|
104
104
|
|
|
105
|
-
},{"22":22}],
|
|
106
|
-
"use strict";var call=Function.prototype.call,$hasOwn=Object.prototype.hasOwnProperty,bind=require(24);module.exports=bind.call(call,$hasOwn);
|
|
107
|
-
|
|
108
|
-
},{"24":24}],41:[function(require,module,exports){
|
|
105
|
+
},{"22":22}],41:[function(require,module,exports){
|
|
109
106
|
"use strict";var $isNaN=require(36);module.exports=function sign(i){return $isNaN(i)||0===i?i:i<0?-1:1};
|
|
110
107
|
|
|
111
|
-
},{"36":36}],
|
|
108
|
+
},{"36":36}],33:[function(require,module,exports){
|
|
109
|
+
"use strict";var call=Function.prototype.call,$hasOwn=Object.prototype.hasOwnProperty,bind=require(24);module.exports=bind.call(call,$hasOwn);
|
|
110
|
+
|
|
111
|
+
},{"24":24}],31:[function(require,module,exports){
|
|
112
112
|
"use strict";var origSymbol="undefined"!=typeof Symbol&&Symbol,hasSymbolSham=require(32);module.exports=function hasNativeSymbols(){return"function"==typeof origSymbol&&"function"==typeof Symbol&&"symbol"==typeof origSymbol("foo")&&"symbol"==typeof Symbol("bar")&&hasSymbolSham()};
|
|
113
113
|
|
|
114
114
|
},{"32":32}],28:[function(require,module,exports){
|
|
@@ -36,9 +36,9 @@ var interpretNumericEntities = function (str) {
|
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
var parseArrayValue = function (val, options, currentArrayLength
|
|
39
|
+
var parseArrayValue = function (val, options, currentArrayLength) {
|
|
40
40
|
if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
|
|
41
|
-
if (
|
|
41
|
+
if (options.throwOnLimitExceeded) {
|
|
42
42
|
var commaCount = 0;
|
|
43
43
|
var commaIndex = val.indexOf(',');
|
|
44
44
|
while (commaIndex > -1) {
|
|
@@ -125,8 +125,7 @@ var parseValues = function parseQueryStringValues(str, options) {
|
|
|
125
125
|
parseArrayValue(
|
|
126
126
|
part.slice(pos + 1),
|
|
127
127
|
options,
|
|
128
|
-
isArray(obj[key]) ? obj[key].length : 0
|
|
129
|
-
part.indexOf('[]=') === -1
|
|
128
|
+
isArray(obj[key]) ? obj[key].length : 0
|
|
130
129
|
),
|
|
131
130
|
function (encodedVal) {
|
|
132
131
|
return options.decoder(encodedVal, defaults.decoder, charset, 'value');
|