step-node-agent 3.24.2 → 3.24.3

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.
Files changed (31) hide show
  1. package/node_modules/express/History.md +14 -5
  2. package/node_modules/express/Readme.md +1 -1
  3. package/node_modules/express/lib/router/index.js +1 -1
  4. package/node_modules/express/lib/router/route.js +7 -2
  5. package/node_modules/express/lib/utils.js +3 -4
  6. package/node_modules/express/package.json +5 -6
  7. package/node_modules/side-channel/CHANGELOG.md +9 -0
  8. package/node_modules/side-channel/index.d.ts +27 -0
  9. package/node_modules/side-channel/index.js +19 -7
  10. package/node_modules/side-channel/package.json +11 -9
  11. package/node_modules/side-channel/test/index.js +1 -1
  12. package/node_modules/side-channel/tsconfig.json +50 -0
  13. package/package.json +1 -1
  14. package/node_modules/express/node_modules/body-parser/HISTORY.md +0 -657
  15. package/node_modules/express/node_modules/body-parser/LICENSE +0 -23
  16. package/node_modules/express/node_modules/body-parser/README.md +0 -464
  17. package/node_modules/express/node_modules/body-parser/SECURITY.md +0 -25
  18. package/node_modules/express/node_modules/body-parser/index.js +0 -156
  19. package/node_modules/express/node_modules/body-parser/lib/read.js +0 -205
  20. package/node_modules/express/node_modules/body-parser/lib/types/json.js +0 -236
  21. package/node_modules/express/node_modules/body-parser/lib/types/raw.js +0 -101
  22. package/node_modules/express/node_modules/body-parser/lib/types/text.js +0 -121
  23. package/node_modules/express/node_modules/body-parser/lib/types/urlencoded.js +0 -284
  24. package/node_modules/express/node_modules/body-parser/package.json +0 -56
  25. package/node_modules/express/node_modules/raw-body/HISTORY.md +0 -303
  26. package/node_modules/express/node_modules/raw-body/LICENSE +0 -22
  27. package/node_modules/express/node_modules/raw-body/README.md +0 -223
  28. package/node_modules/express/node_modules/raw-body/SECURITY.md +0 -24
  29. package/node_modules/express/node_modules/raw-body/index.d.ts +0 -87
  30. package/node_modules/express/node_modules/raw-body/index.js +0 -329
  31. package/node_modules/express/node_modules/raw-body/package.json +0 -49
@@ -1,223 +0,0 @@
1
- # raw-body
2
-
3
- [![NPM Version][npm-image]][npm-url]
4
- [![NPM Downloads][downloads-image]][downloads-url]
5
- [![Node.js Version][node-version-image]][node-version-url]
6
- [![Build status][github-actions-ci-image]][github-actions-ci-url]
7
- [![Test coverage][coveralls-image]][coveralls-url]
8
-
9
- Gets the entire buffer of a stream either as a `Buffer` or a string.
10
- Validates the stream's length against an expected length and maximum limit.
11
- Ideal for parsing request bodies.
12
-
13
- ## Install
14
-
15
- This is a [Node.js](https://nodejs.org/en/) module available through the
16
- [npm registry](https://www.npmjs.com/). Installation is done using the
17
- [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
18
-
19
- ```sh
20
- $ npm install raw-body
21
- ```
22
-
23
- ### TypeScript
24
-
25
- This module includes a [TypeScript](https://www.typescriptlang.org/)
26
- declaration file to enable auto complete in compatible editors and type
27
- information for TypeScript projects. This module depends on the Node.js
28
- types, so install `@types/node`:
29
-
30
- ```sh
31
- $ npm install @types/node
32
- ```
33
-
34
- ## API
35
-
36
- ```js
37
- var getRawBody = require('raw-body')
38
- ```
39
-
40
- ### getRawBody(stream, [options], [callback])
41
-
42
- **Returns a promise if no callback specified and global `Promise` exists.**
43
-
44
- Options:
45
-
46
- - `length` - The length of the stream.
47
- If the contents of the stream do not add up to this length,
48
- an `400` error code is returned.
49
- - `limit` - The byte limit of the body.
50
- This is the number of bytes or any string format supported by
51
- [bytes](https://www.npmjs.com/package/bytes),
52
- for example `1000`, `'500kb'` or `'3mb'`.
53
- If the body ends up being larger than this limit,
54
- a `413` error code is returned.
55
- - `encoding` - The encoding to use to decode the body into a string.
56
- By default, a `Buffer` instance will be returned when no encoding is specified.
57
- Most likely, you want `utf-8`, so setting `encoding` to `true` will decode as `utf-8`.
58
- You can use any type of encoding supported by [iconv-lite](https://www.npmjs.org/package/iconv-lite#readme).
59
-
60
- You can also pass a string in place of options to just specify the encoding.
61
-
62
- If an error occurs, the stream will be paused, everything unpiped,
63
- and you are responsible for correctly disposing the stream.
64
- For HTTP requests, you may need to finish consuming the stream if
65
- you want to keep the socket open for future requests. For streams
66
- that use file descriptors, you should `stream.destroy()` or
67
- `stream.close()` to prevent leaks.
68
-
69
- ## Errors
70
-
71
- This module creates errors depending on the error condition during reading.
72
- The error may be an error from the underlying Node.js implementation, but is
73
- otherwise an error created by this module, which has the following attributes:
74
-
75
- * `limit` - the limit in bytes
76
- * `length` and `expected` - the expected length of the stream
77
- * `received` - the received bytes
78
- * `encoding` - the invalid encoding
79
- * `status` and `statusCode` - the corresponding status code for the error
80
- * `type` - the error type
81
-
82
- ### Types
83
-
84
- The errors from this module have a `type` property which allows for the programmatic
85
- determination of the type of error returned.
86
-
87
- #### encoding.unsupported
88
-
89
- This error will occur when the `encoding` option is specified, but the value does
90
- not map to an encoding supported by the [iconv-lite](https://www.npmjs.org/package/iconv-lite#readme)
91
- module.
92
-
93
- #### entity.too.large
94
-
95
- This error will occur when the `limit` option is specified, but the stream has
96
- an entity that is larger.
97
-
98
- #### request.aborted
99
-
100
- This error will occur when the request stream is aborted by the client before
101
- reading the body has finished.
102
-
103
- #### request.size.invalid
104
-
105
- This error will occur when the `length` option is specified, but the stream has
106
- emitted more bytes.
107
-
108
- #### stream.encoding.set
109
-
110
- This error will occur when the given stream has an encoding set on it, making it
111
- a decoded stream. The stream should not have an encoding set and is expected to
112
- emit `Buffer` objects.
113
-
114
- #### stream.not.readable
115
-
116
- This error will occur when the given stream is not readable.
117
-
118
- ## Examples
119
-
120
- ### Simple Express example
121
-
122
- ```js
123
- var contentType = require('content-type')
124
- var express = require('express')
125
- var getRawBody = require('raw-body')
126
-
127
- var app = express()
128
-
129
- app.use(function (req, res, next) {
130
- getRawBody(req, {
131
- length: req.headers['content-length'],
132
- limit: '1mb',
133
- encoding: contentType.parse(req).parameters.charset
134
- }, function (err, string) {
135
- if (err) return next(err)
136
- req.text = string
137
- next()
138
- })
139
- })
140
-
141
- // now access req.text
142
- ```
143
-
144
- ### Simple Koa example
145
-
146
- ```js
147
- var contentType = require('content-type')
148
- var getRawBody = require('raw-body')
149
- var koa = require('koa')
150
-
151
- var app = koa()
152
-
153
- app.use(function * (next) {
154
- this.text = yield getRawBody(this.req, {
155
- length: this.req.headers['content-length'],
156
- limit: '1mb',
157
- encoding: contentType.parse(this.req).parameters.charset
158
- })
159
- yield next
160
- })
161
-
162
- // now access this.text
163
- ```
164
-
165
- ### Using as a promise
166
-
167
- To use this library as a promise, simply omit the `callback` and a promise is
168
- returned, provided that a global `Promise` is defined.
169
-
170
- ```js
171
- var getRawBody = require('raw-body')
172
- var http = require('http')
173
-
174
- var server = http.createServer(function (req, res) {
175
- getRawBody(req)
176
- .then(function (buf) {
177
- res.statusCode = 200
178
- res.end(buf.length + ' bytes submitted')
179
- })
180
- .catch(function (err) {
181
- res.statusCode = 500
182
- res.end(err.message)
183
- })
184
- })
185
-
186
- server.listen(3000)
187
- ```
188
-
189
- ### Using with TypeScript
190
-
191
- ```ts
192
- import * as getRawBody from 'raw-body';
193
- import * as http from 'http';
194
-
195
- const server = http.createServer((req, res) => {
196
- getRawBody(req)
197
- .then((buf) => {
198
- res.statusCode = 200;
199
- res.end(buf.length + ' bytes submitted');
200
- })
201
- .catch((err) => {
202
- res.statusCode = err.statusCode;
203
- res.end(err.message);
204
- });
205
- });
206
-
207
- server.listen(3000);
208
- ```
209
-
210
- ## License
211
-
212
- [MIT](LICENSE)
213
-
214
- [npm-image]: https://img.shields.io/npm/v/raw-body.svg
215
- [npm-url]: https://npmjs.org/package/raw-body
216
- [node-version-image]: https://img.shields.io/node/v/raw-body.svg
217
- [node-version-url]: https://nodejs.org/en/download/
218
- [coveralls-image]: https://img.shields.io/coveralls/stream-utils/raw-body/master.svg
219
- [coveralls-url]: https://coveralls.io/r/stream-utils/raw-body?branch=master
220
- [downloads-image]: https://img.shields.io/npm/dm/raw-body.svg
221
- [downloads-url]: https://npmjs.org/package/raw-body
222
- [github-actions-ci-image]: https://img.shields.io/github/workflow/status/stream-utils/raw-body/ci/master?label=ci
223
- [github-actions-ci-url]: https://github.com/jshttp/stream-utils/raw-body?query=workflow%3Aci
@@ -1,24 +0,0 @@
1
- # Security Policies and Procedures
2
-
3
- ## Reporting a Bug
4
-
5
- The `raw-body` team and community take all security bugs seriously. Thank you
6
- for improving the security of Express. We appreciate your efforts and
7
- responsible disclosure and will make every effort to acknowledge your
8
- contributions.
9
-
10
- Report security bugs by emailing the current owners of `raw-body`. This information
11
- can be found in the npm registry using the command `npm owner ls raw-body`.
12
- If unsure or unable to get the information from the above, open an issue
13
- in the [project issue tracker](https://github.com/stream-utils/raw-body/issues)
14
- asking for the current contact information.
15
-
16
- To ensure the timely response to your report, please ensure that the entirety
17
- of the report is contained within the email body and not solely behind a web
18
- link or an attachment.
19
-
20
- At least one owner will acknowledge your email within 48 hours, and will send a
21
- more detailed response within 48 hours indicating the next steps in handling
22
- your report. After the initial reply to your report, the owners will
23
- endeavor to keep you informed of the progress towards a fix and full
24
- announcement, and may ask for additional information or guidance.
@@ -1,87 +0,0 @@
1
- import { Readable } from 'stream';
2
-
3
- declare namespace getRawBody {
4
- export type Encoding = string | true;
5
-
6
- export interface Options {
7
- /**
8
- * The expected length of the stream.
9
- */
10
- length?: number | string | null;
11
- /**
12
- * The byte limit of the body. This is the number of bytes or any string
13
- * format supported by `bytes`, for example `1000`, `'500kb'` or `'3mb'`.
14
- */
15
- limit?: number | string | null;
16
- /**
17
- * The encoding to use to decode the body into a string. By default, a
18
- * `Buffer` instance will be returned when no encoding is specified. Most
19
- * likely, you want `utf-8`, so setting encoding to `true` will decode as
20
- * `utf-8`. You can use any type of encoding supported by `iconv-lite`.
21
- */
22
- encoding?: Encoding | null;
23
- }
24
-
25
- export interface RawBodyError extends Error {
26
- /**
27
- * The limit in bytes.
28
- */
29
- limit?: number;
30
- /**
31
- * The expected length of the stream.
32
- */
33
- length?: number;
34
- expected?: number;
35
- /**
36
- * The received bytes.
37
- */
38
- received?: number;
39
- /**
40
- * The encoding.
41
- */
42
- encoding?: string;
43
- /**
44
- * The corresponding status code for the error.
45
- */
46
- status: number;
47
- statusCode: number;
48
- /**
49
- * The error type.
50
- */
51
- type: string;
52
- }
53
- }
54
-
55
- /**
56
- * Gets the entire buffer of a stream either as a `Buffer` or a string.
57
- * Validates the stream's length against an expected length and maximum
58
- * limit. Ideal for parsing request bodies.
59
- */
60
- declare function getRawBody(
61
- stream: Readable,
62
- callback: (err: getRawBody.RawBodyError, body: Buffer) => void
63
- ): void;
64
-
65
- declare function getRawBody(
66
- stream: Readable,
67
- options: (getRawBody.Options & { encoding: getRawBody.Encoding }) | getRawBody.Encoding,
68
- callback: (err: getRawBody.RawBodyError, body: string) => void
69
- ): void;
70
-
71
- declare function getRawBody(
72
- stream: Readable,
73
- options: getRawBody.Options,
74
- callback: (err: getRawBody.RawBodyError, body: Buffer) => void
75
- ): void;
76
-
77
- declare function getRawBody(
78
- stream: Readable,
79
- options: (getRawBody.Options & { encoding: getRawBody.Encoding }) | getRawBody.Encoding
80
- ): Promise<string>;
81
-
82
- declare function getRawBody(
83
- stream: Readable,
84
- options?: getRawBody.Options
85
- ): Promise<Buffer>;
86
-
87
- export = getRawBody;
@@ -1,329 +0,0 @@
1
- /*!
2
- * raw-body
3
- * Copyright(c) 2013-2014 Jonathan Ong
4
- * Copyright(c) 2014-2022 Douglas Christopher Wilson
5
- * MIT Licensed
6
- */
7
-
8
- 'use strict'
9
-
10
- /**
11
- * Module dependencies.
12
- * @private
13
- */
14
-
15
- var asyncHooks = tryRequireAsyncHooks()
16
- var bytes = require('bytes')
17
- var createError = require('http-errors')
18
- var iconv = require('iconv-lite')
19
- var unpipe = require('unpipe')
20
-
21
- /**
22
- * Module exports.
23
- * @public
24
- */
25
-
26
- module.exports = getRawBody
27
-
28
- /**
29
- * Module variables.
30
- * @private
31
- */
32
-
33
- var ICONV_ENCODING_MESSAGE_REGEXP = /^Encoding not recognized: /
34
-
35
- /**
36
- * Get the decoder for a given encoding.
37
- *
38
- * @param {string} encoding
39
- * @private
40
- */
41
-
42
- function getDecoder (encoding) {
43
- if (!encoding) return null
44
-
45
- try {
46
- return iconv.getDecoder(encoding)
47
- } catch (e) {
48
- // error getting decoder
49
- if (!ICONV_ENCODING_MESSAGE_REGEXP.test(e.message)) throw e
50
-
51
- // the encoding was not found
52
- throw createError(415, 'specified encoding unsupported', {
53
- encoding: encoding,
54
- type: 'encoding.unsupported'
55
- })
56
- }
57
- }
58
-
59
- /**
60
- * Get the raw body of a stream (typically HTTP).
61
- *
62
- * @param {object} stream
63
- * @param {object|string|function} [options]
64
- * @param {function} [callback]
65
- * @public
66
- */
67
-
68
- function getRawBody (stream, options, callback) {
69
- var done = callback
70
- var opts = options || {}
71
-
72
- if (options === true || typeof options === 'string') {
73
- // short cut for encoding
74
- opts = {
75
- encoding: options
76
- }
77
- }
78
-
79
- if (typeof options === 'function') {
80
- done = options
81
- opts = {}
82
- }
83
-
84
- // validate callback is a function, if provided
85
- if (done !== undefined && typeof done !== 'function') {
86
- throw new TypeError('argument callback must be a function')
87
- }
88
-
89
- // require the callback without promises
90
- if (!done && !global.Promise) {
91
- throw new TypeError('argument callback is required')
92
- }
93
-
94
- // get encoding
95
- var encoding = opts.encoding !== true
96
- ? opts.encoding
97
- : 'utf-8'
98
-
99
- // convert the limit to an integer
100
- var limit = bytes.parse(opts.limit)
101
-
102
- // convert the expected length to an integer
103
- var length = opts.length != null && !isNaN(opts.length)
104
- ? parseInt(opts.length, 10)
105
- : null
106
-
107
- if (done) {
108
- // classic callback style
109
- return readStream(stream, encoding, length, limit, wrap(done))
110
- }
111
-
112
- return new Promise(function executor (resolve, reject) {
113
- readStream(stream, encoding, length, limit, function onRead (err, buf) {
114
- if (err) return reject(err)
115
- resolve(buf)
116
- })
117
- })
118
- }
119
-
120
- /**
121
- * Halt a stream.
122
- *
123
- * @param {Object} stream
124
- * @private
125
- */
126
-
127
- function halt (stream) {
128
- // unpipe everything from the stream
129
- unpipe(stream)
130
-
131
- // pause stream
132
- if (typeof stream.pause === 'function') {
133
- stream.pause()
134
- }
135
- }
136
-
137
- /**
138
- * Read the data from the stream.
139
- *
140
- * @param {object} stream
141
- * @param {string} encoding
142
- * @param {number} length
143
- * @param {number} limit
144
- * @param {function} callback
145
- * @public
146
- */
147
-
148
- function readStream (stream, encoding, length, limit, callback) {
149
- var complete = false
150
- var sync = true
151
-
152
- // check the length and limit options.
153
- // note: we intentionally leave the stream paused,
154
- // so users should handle the stream themselves.
155
- if (limit !== null && length !== null && length > limit) {
156
- return done(createError(413, 'request entity too large', {
157
- expected: length,
158
- length: length,
159
- limit: limit,
160
- type: 'entity.too.large'
161
- }))
162
- }
163
-
164
- // streams1: assert request encoding is buffer.
165
- // streams2+: assert the stream encoding is buffer.
166
- // stream._decoder: streams1
167
- // state.encoding: streams2
168
- // state.decoder: streams2, specifically < 0.10.6
169
- var state = stream._readableState
170
- if (stream._decoder || (state && (state.encoding || state.decoder))) {
171
- // developer error
172
- return done(createError(500, 'stream encoding should not be set', {
173
- type: 'stream.encoding.set'
174
- }))
175
- }
176
-
177
- if (typeof stream.readable !== 'undefined' && !stream.readable) {
178
- return done(createError(500, 'stream is not readable', {
179
- type: 'stream.not.readable'
180
- }))
181
- }
182
-
183
- var received = 0
184
- var decoder
185
-
186
- try {
187
- decoder = getDecoder(encoding)
188
- } catch (err) {
189
- return done(err)
190
- }
191
-
192
- var buffer = decoder
193
- ? ''
194
- : []
195
-
196
- // attach listeners
197
- stream.on('aborted', onAborted)
198
- stream.on('close', cleanup)
199
- stream.on('data', onData)
200
- stream.on('end', onEnd)
201
- stream.on('error', onEnd)
202
-
203
- // mark sync section complete
204
- sync = false
205
-
206
- function done () {
207
- var args = new Array(arguments.length)
208
-
209
- // copy arguments
210
- for (var i = 0; i < args.length; i++) {
211
- args[i] = arguments[i]
212
- }
213
-
214
- // mark complete
215
- complete = true
216
-
217
- if (sync) {
218
- process.nextTick(invokeCallback)
219
- } else {
220
- invokeCallback()
221
- }
222
-
223
- function invokeCallback () {
224
- cleanup()
225
-
226
- if (args[0]) {
227
- // halt the stream on error
228
- halt(stream)
229
- }
230
-
231
- callback.apply(null, args)
232
- }
233
- }
234
-
235
- function onAborted () {
236
- if (complete) return
237
-
238
- done(createError(400, 'request aborted', {
239
- code: 'ECONNABORTED',
240
- expected: length,
241
- length: length,
242
- received: received,
243
- type: 'request.aborted'
244
- }))
245
- }
246
-
247
- function onData (chunk) {
248
- if (complete) return
249
-
250
- received += chunk.length
251
-
252
- if (limit !== null && received > limit) {
253
- done(createError(413, 'request entity too large', {
254
- limit: limit,
255
- received: received,
256
- type: 'entity.too.large'
257
- }))
258
- } else if (decoder) {
259
- buffer += decoder.write(chunk)
260
- } else {
261
- buffer.push(chunk)
262
- }
263
- }
264
-
265
- function onEnd (err) {
266
- if (complete) return
267
- if (err) return done(err)
268
-
269
- if (length !== null && received !== length) {
270
- done(createError(400, 'request size did not match content length', {
271
- expected: length,
272
- length: length,
273
- received: received,
274
- type: 'request.size.invalid'
275
- }))
276
- } else {
277
- var string = decoder
278
- ? buffer + (decoder.end() || '')
279
- : Buffer.concat(buffer)
280
- done(null, string)
281
- }
282
- }
283
-
284
- function cleanup () {
285
- buffer = null
286
-
287
- stream.removeListener('aborted', onAborted)
288
- stream.removeListener('data', onData)
289
- stream.removeListener('end', onEnd)
290
- stream.removeListener('error', onEnd)
291
- stream.removeListener('close', cleanup)
292
- }
293
- }
294
-
295
- /**
296
- * Try to require async_hooks
297
- * @private
298
- */
299
-
300
- function tryRequireAsyncHooks () {
301
- try {
302
- return require('async_hooks')
303
- } catch (e) {
304
- return {}
305
- }
306
- }
307
-
308
- /**
309
- * Wrap function with async resource, if possible.
310
- * AsyncResource.bind static method backported.
311
- * @private
312
- */
313
-
314
- function wrap (fn) {
315
- var res
316
-
317
- // create anonymous resource
318
- if (asyncHooks.AsyncResource) {
319
- res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')
320
- }
321
-
322
- // incompatible node.js
323
- if (!res || !res.runInAsyncScope) {
324
- return fn
325
- }
326
-
327
- // return bound function
328
- return res.runInAsyncScope.bind(res, fn, null)
329
- }
@@ -1,49 +0,0 @@
1
- {
2
- "name": "raw-body",
3
- "description": "Get and validate the raw body of a readable stream.",
4
- "version": "2.5.1",
5
- "author": "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)",
6
- "contributors": [
7
- "Douglas Christopher Wilson <doug@somethingdoug.com>",
8
- "Raynos <raynos2@gmail.com>"
9
- ],
10
- "license": "MIT",
11
- "repository": "stream-utils/raw-body",
12
- "dependencies": {
13
- "bytes": "3.1.2",
14
- "http-errors": "2.0.0",
15
- "iconv-lite": "0.4.24",
16
- "unpipe": "1.0.0"
17
- },
18
- "devDependencies": {
19
- "bluebird": "3.7.2",
20
- "eslint": "7.32.0",
21
- "eslint-config-standard": "14.1.1",
22
- "eslint-plugin-import": "2.25.4",
23
- "eslint-plugin-markdown": "2.2.1",
24
- "eslint-plugin-node": "11.1.0",
25
- "eslint-plugin-promise": "5.2.0",
26
- "eslint-plugin-standard": "4.1.0",
27
- "mocha": "9.2.1",
28
- "nyc": "15.1.0",
29
- "readable-stream": "2.3.7",
30
- "safe-buffer": "5.2.1"
31
- },
32
- "engines": {
33
- "node": ">= 0.8"
34
- },
35
- "files": [
36
- "HISTORY.md",
37
- "LICENSE",
38
- "README.md",
39
- "SECURITY.md",
40
- "index.d.ts",
41
- "index.js"
42
- ],
43
- "scripts": {
44
- "lint": "eslint .",
45
- "test": "mocha --trace-deprecation --reporter spec --bail --check-leaks test/",
46
- "test-ci": "nyc --reporter=lcovonly --reporter=text npm test",
47
- "test-cov": "nyc --reporter=html --reporter=text npm test"
48
- }
49
- }