@openclaw/slack 2026.11.3 → 2026.11.5-beta.2
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/.setup/{account-inspect-CmkKiSb9.mjs → account-inspect-BLVha-ov.mjs} +11 -8
- package/dist/.setup/{accounts-msihSF3-.mjs → accounts-CGJScKtk.mjs} +10 -1
- package/dist/.setup/{action-runtime-ChRfnnBu.mjs → action-runtime-D01wBhx5.mjs} +38 -45
- package/dist/.setup/action-runtime.runtime-VQGaR6g8.mjs +1 -0
- package/dist/.setup/{actions-By7tvpvv.mjs → actions-D5S6D_BU.mjs} +89 -76
- package/dist/.setup/{approval-handler.runtime-D8ArtDQt.mjs → approval-handler.runtime-Buw5jh2Y.mjs} +26 -30
- package/dist/.setup/{approval-message-updates-DT7XBPbV.mjs → approval-message-updates-pmXcve5E.mjs} +1 -1
- package/dist/.setup/{channel-DLFiMJm2.mjs → channel-C_R98Nbv.mjs} +569 -339
- package/dist/.setup/{channel-type-BEFP2ORi.mjs → channel-type-B5P3w9eA.mjs} +4 -8
- package/dist/.setup/{channel.setup-CzFw73mU.mjs → channel.setup-Lq2OxKkF.mjs} +13 -13
- package/dist/.setup/{config-schema-DNnh6bWU.mjs → config-schema-BWAaa5au.mjs} +3 -7
- package/dist/.setup/cursor-pages-CATAzbTT.mjs +313 -0
- package/dist/.setup/{directory-config-Cjj0N8R0.mjs → directory-config-D-hf9KGQ.mjs} +3 -3
- package/dist/.setup/{directory-live-BIKD-5B_.mjs → directory-live-onKAFI1E.mjs} +4 -4
- package/dist/.setup/{doctor-contract-Cd4-VzIM.mjs → doctor-contract-9-QJRCXk.mjs} +37 -45
- package/dist/.setup/{message-tool-api-BS5ekEA_.mjs → message-tool-api-LGIgVXJf.mjs} +4 -3
- package/dist/.setup/{monitor-CV6Z6FKP.mjs → monitor-Cm1TuqxN.mjs} +3424 -3703
- package/dist/.setup/{outbound-adapter-9dbnYtL1.mjs → outbound-adapter-C-95EWl2.mjs} +30 -36
- package/dist/.setup/paths-B1u59oLK.mjs +8 -0
- package/dist/.setup/{pipeline.runtime-DLIQf1Bo.mjs → pipeline.runtime-DGnV6akc.mjs} +416 -534
- package/dist/.setup/{policy-yhn48xf5.mjs → policy-DxhGRvc2.mjs} +1 -2
- package/dist/.setup/{session-status-Dv8wNBEt.mjs → probe-DANukR3O.mjs} +1206 -839
- package/dist/.setup/question-delivery-CWC7sRhH.mjs +39 -0
- package/dist/.setup/{relay-source-CxDcrn16.mjs → relay-source-DoyOlTbK.mjs} +5 -3
- package/dist/.setup/{replies-MRkrg3rC.mjs → replies-BcmUKord.mjs} +34 -19
- package/dist/.setup/{reply-blocks-Ca-raz2z.mjs → reply-blocks-BzsXUUUL.mjs} +201 -206
- package/dist/.setup/{resolve-channels-DRRhElwz.mjs → resolve-channels-XDPgnesf.mjs} +4 -7
- package/dist/.setup/{resolve-users-Cz8e17ky.mjs → resolve-users-aDAv24U2.mjs} +8 -16
- package/dist/.setup/runtime-setter-api-Cx_PV-xu.mjs +2 -0
- package/dist/.setup/{scopes-DfQVi8Jw.mjs → scopes-BocHwImV.mjs} +2 -1
- package/dist/.setup/secret-contract-api-BlLz88mj.mjs +2 -0
- package/dist/.setup/{secret-contract-vVRMoE1D.mjs → secret-contract-uiQtoNlu.mjs} +2 -2
- package/dist/.setup/{send-results-eeOu_HYm.mjs → send-results-BGxlroJ-.mjs} +3 -4
- package/dist/.setup/{send-C-8wY0lK.mjs → send-yK6_-px6.mjs} +297 -334
- package/dist/.setup/setup-plugin-api-Cfz58xoh.mjs +2 -0
- package/dist/.setup/{setup-surface--n8VsDvV.mjs → setup-surface-C0KRtyqa.mjs} +5 -6
- package/dist/.setup/{slash-dispatch.runtime-D3Wq45ER.mjs → slash-dispatch.runtime-CyVC3bYx.mjs} +2 -2
- package/dist/.setup/{target-parsing-FFE26kOV.mjs → target-parsing-Bx2UZniD.mjs} +1 -2
- package/dist/.setup/{targets-C6LZQL1Q.mjs → targets-D-ASeWHy.mjs} +1 -1
- package/dist/.source-module-urls/c5ffd0957b234c7c12090e7de4eca2482ef339b8561e078da55b734211b0ba58.json +1 -0
- package/dist/account-inspect-api.js +1 -1
- package/dist/api.js +16 -17
- package/dist/channel-config-api.js +1 -2
- package/dist/channel-plugin-api.js +1 -2
- package/dist/directory-contract-api.js +1 -2
- package/dist/doctor-contract-api.js +1 -2
- package/dist/index.js +0 -6
- package/dist/message-tool-api.js +1 -2
- package/dist/runtime-api.js +10 -12
- package/dist/runtime-setter-api.js +1 -2
- package/dist/secret-contract-api.js +1 -2
- package/dist/security-contract-api.js +1 -2
- package/dist/setup-entry.js +3 -3
- package/dist/setup-plugin-api.js +1 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/util.d.ts +6 -3
- package/node_modules/@slack/bolt/node_modules/content-disposition/README.md +105 -35
- package/node_modules/@slack/bolt/node_modules/content-disposition/dist/index.d.ts +72 -0
- package/node_modules/@slack/bolt/node_modules/content-disposition/dist/index.js +388 -0
- package/node_modules/@slack/bolt/node_modules/content-disposition/dist/index.js.map +1 -0
- package/node_modules/@slack/bolt/node_modules/content-disposition/package.json +31 -19
- package/node_modules/@slack/bolt/node_modules/content-type/README.md +34 -57
- package/node_modules/@slack/bolt/node_modules/content-type/package.json +35 -25
- package/node_modules/@slack/bolt/node_modules/express/Readme.md +15 -9
- package/node_modules/@slack/bolt/node_modules/express/lib/application.js +2 -2
- package/node_modules/@slack/bolt/node_modules/express/lib/request.js +32 -19
- package/node_modules/@slack/bolt/node_modules/express/lib/response.js +27 -30
- package/node_modules/@slack/bolt/node_modules/express/package.json +10 -10
- package/node_modules/@slack/bolt/node_modules/qs/.github/THREAT_MODEL.md +4 -2
- package/node_modules/@slack/bolt/node_modules/qs/CHANGELOG.md +38 -14
- package/node_modules/@slack/bolt/node_modules/qs/README.md +31 -3
- package/node_modules/@slack/bolt/node_modules/qs/dist/qs.js +20 -20
- package/node_modules/@slack/bolt/node_modules/qs/lib/parse.js +94 -4
- package/node_modules/@slack/bolt/node_modules/qs/lib/stringify.js +4 -4
- package/node_modules/@slack/bolt/node_modules/qs/lib/utils.js +130 -6
- package/node_modules/@slack/bolt/node_modules/qs/package.json +4 -4
- package/node_modules/@slack/bolt/node_modules/qs/test/parse.js +174 -0
- package/node_modules/@slack/bolt/node_modules/qs/test/stringify.js +263 -33
- package/node_modules/@slack/bolt/node_modules/qs/test/utils.js +184 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/util.d.ts +6 -3
- package/node_modules/typebox/build/format/duration.d.mts +2 -2
- package/node_modules/typebox/build/format/duration.mjs +2 -2
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_email.mjs +1 -0
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
- package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
- package/node_modules/typebox/build/format/ipv4.mjs +2 -2
- package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
- package/node_modules/typebox/build/format/ipv6.mjs +1 -1
- package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
- package/node_modules/typebox/build/schema/build.mjs +1 -0
- package/node_modules/typebox/build/schema/engine/_unique.d.mts +4 -2
- package/node_modules/typebox/build/schema/engine/_unique.mjs +7 -3
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +0 -3
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +15 -17
- package/node_modules/typebox/build/schema/engine/contains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/index.d.mts +1 -0
- package/node_modules/typebox/build/schema/engine/index.mjs +1 -0
- package/node_modules/typebox/build/schema/engine/items.mjs +7 -4
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/minContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
- package/node_modules/typebox/build/system/hashing/hash.mjs +63 -34
- package/node_modules/typebox/build/system/locale/en_US.mjs +2 -1
- package/node_modules/typebox/build/system/memory/assign.d.mts +2 -8
- package/node_modules/typebox/build/system/memory/assign.mjs +13 -6
- package/node_modules/typebox/build/system/memory/clone.d.mts +4 -5
- package/node_modules/typebox/build/system/memory/clone.mjs +8 -96
- package/node_modules/typebox/build/system/memory/create.d.mts +1 -5
- package/node_modules/typebox/build/system/memory/create.mjs +18 -13
- package/node_modules/typebox/build/system/memory/deep.d.mts +2 -0
- package/node_modules/typebox/build/system/memory/deep.mjs +108 -0
- package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
- package/node_modules/typebox/build/system/memory/discard.mjs +9 -8
- package/node_modules/typebox/build/system/memory/finalize.d.mts +4 -0
- package/node_modules/typebox/build/system/memory/finalize.mjs +30 -0
- package/node_modules/typebox/build/system/memory/keys.d.mts +2 -0
- package/node_modules/typebox/build/system/memory/keys.mjs +8 -0
- package/node_modules/typebox/build/system/memory/update.d.mts +1 -4
- package/node_modules/typebox/build/system/memory/update.mjs +43 -16
- package/node_modules/typebox/build/type/engine/call/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/call/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +2 -24
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +2 -29
- package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -1
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +6 -1
- package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +30 -0
- package/node_modules/typebox/build/type/engine/evaluate/property.mjs +29 -0
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
- package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/this/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/this/index.mjs +1 -0
- package/node_modules/typebox/build/value/clone/clone.d.mts +4 -3
- package/node_modules/typebox/build/value/clone/clone.mjs +5 -7
- package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +2 -0
- package/node_modules/typebox/build/value/repair/from_cyclic.mjs +6 -0
- package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +25 -14
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +1 -1
- package/node_modules/undici/docs/docs/api/Interceptors.md +15 -2
- package/node_modules/undici/lib/dispatcher/client-h2.js +78 -3
- package/node_modules/undici/lib/dispatcher/pool-base.js +20 -3
- package/node_modules/undici/package.json +3 -3
- package/node_modules/undici/types/api.d.ts +1 -1
- package/node_modules/undici/types/utility.d.ts +4 -4
- package/node_modules/zod/package.json +1 -1
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
- package/node_modules/zod/src/v4/core/compile.ts +9 -0
- package/node_modules/zod/src/v4/core/schemas.ts +35 -1
- package/node_modules/zod/src/v4/core/util.ts +13 -0
- package/node_modules/zod/src/v4/core/versions.ts +1 -1
- package/node_modules/zod/v4/core/compile.cjs +8 -0
- package/node_modules/zod/v4/core/compile.js +8 -0
- package/node_modules/zod/v4/core/schemas.cjs +30 -0
- package/node_modules/zod/v4/core/schemas.d.cts +3 -1
- package/node_modules/zod/v4/core/schemas.d.ts +3 -1
- package/node_modules/zod/v4/core/schemas.js +30 -0
- package/node_modules/zod/v4/core/util.cjs +15 -0
- package/node_modules/zod/v4/core/util.d.cts +2 -0
- package/node_modules/zod/v4/core/util.d.ts +2 -0
- package/node_modules/zod/v4/core/util.js +14 -0
- package/node_modules/zod/v4/core/versions.cjs +1 -1
- package/node_modules/zod/v4/core/versions.js +1 -1
- package/openclaw.plugin.json +6 -30
- package/package.json +7 -7
- package/dist/.setup/action-runtime.runtime-vLxx_7s2.mjs +0 -2
- package/dist/.setup/http-C9sM-FXe.mjs +0 -2
- package/dist/.setup/plugin-routes-D4qozHVn.mjs +0 -22
- package/dist/.setup/probe-IiHogLQN.mjs +0 -694
- package/dist/.setup/registry-DizWcnNp.mjs +0 -36
- package/dist/.setup/runtime-setter-api-CMFvhrAr.mjs +0 -3
- package/dist/.setup/secret-contract-api-DK9gZldc.mjs +0 -3
- package/dist/.setup/setup-plugin-api-BGD1TYnK.mjs +0 -3
- package/dist/.setup/shared-BhJHIZs1.mjs +0 -259
- package/dist/http-routes-api.js +0 -2
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/LICENSE +0 -22
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/README.md +0 -71
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/package.json +0 -52
- package/node_modules/@slack/bolt/node_modules/content-disposition/index.js +0 -536
- package/node_modules/@slack/bolt/node_modules/content-type/HISTORY.md +0 -29
- package/node_modules/@slack/bolt/node_modules/content-type/index.js +0 -225
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/LICENSE +0 -22
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/README.md +0 -71
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +0 -46
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.js +0 -176
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.js.map +0 -1
- package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/package.json +0 -52
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/LICENSE +0 -22
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/README.md +0 -71
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.d.ts +0 -46
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js +0 -176
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js.map +0 -1
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/package.json +0 -52
- package/node_modules/typebox/build/system/memory/freeze.d.mts +0 -4
- package/node_modules/typebox/build/system/memory/freeze.mjs +0 -6
- /package/node_modules/@slack/bolt/node_modules/{body-parser/node_modules/content-type → content-type}/dist/index.d.ts +0 -0
- /package/node_modules/@slack/bolt/node_modules/{body-parser/node_modules/content-type → content-type}/dist/index.js +0 -0
- /package/node_modules/@slack/bolt/node_modules/{body-parser/node_modules/content-type → content-type}/dist/index.js.map +0 -0
|
@@ -1,81 +1,57 @@
|
|
|
1
1
|
# content-type
|
|
2
2
|
|
|
3
|
-
[![NPM
|
|
4
|
-
[![NPM
|
|
5
|
-
[![
|
|
6
|
-
[![Build
|
|
7
|
-
[![
|
|
3
|
+
[![NPM version][npm-image]][npm-url]
|
|
4
|
+
[![NPM downloads][downloads-image]][downloads-url]
|
|
5
|
+
[![Build status][build-image]][build-url]
|
|
6
|
+
[![Build coverage][coverage-image]][coverage-url]
|
|
7
|
+
[![License][license-image]][license-url]
|
|
8
8
|
|
|
9
|
-
Create and parse HTTP Content-Type header
|
|
9
|
+
Create and parse HTTP `Content-Type` header.
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
13
13
|
```sh
|
|
14
|
-
|
|
14
|
+
npm install content-type
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## API
|
|
18
18
|
|
|
19
19
|
```js
|
|
20
|
-
|
|
20
|
+
const contentType = require("content-type");
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
### contentType.parse(string)
|
|
23
|
+
### contentType.parse(string, options?)
|
|
24
24
|
|
|
25
25
|
```js
|
|
26
|
-
|
|
26
|
+
const obj = contentType.parse("image/svg+xml; charset=utf-8");
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
Parse a `Content-Type` header. This will return an object with the following
|
|
30
|
-
properties (examples are shown for the string `'image/svg+xml; charset=utf-8'`):
|
|
29
|
+
Parse a `Content-Type` header. This will return an object with the following properties (examples are shown for the string `'image/svg+xml; charset=utf-8'`):
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
- `type`: The media type. Example: `'image/svg+xml'`.
|
|
32
|
+
- `parameters`: An object of the parameters in the media type (parameter name is always lower case). Example: `{charset: 'utf-8'}`.
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
always lower case). Example: `{charset: 'utf-8'}`
|
|
34
|
+
The parser is lenient and does not error. You should validate `type` and `parameters` before trusting them.
|
|
37
35
|
|
|
38
|
-
|
|
36
|
+
#### Options
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
var obj = contentType.parse(req)
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Parse the `Content-Type` header from the given `req`. Short-cut for
|
|
47
|
-
`contentType.parse(req.headers['content-type'])`.
|
|
48
|
-
|
|
49
|
-
Throws a `TypeError` if the `Content-Type` header is missing or invalid.
|
|
50
|
-
|
|
51
|
-
### contentType.parse(res)
|
|
52
|
-
|
|
53
|
-
```js
|
|
54
|
-
var obj = contentType.parse(res)
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Parse the `Content-Type` header set on the given `res`. Short-cut for
|
|
58
|
-
`contentType.parse(res.getHeader('content-type'))`.
|
|
59
|
-
|
|
60
|
-
Throws a `TypeError` if the `Content-Type` header is missing or invalid.
|
|
38
|
+
- `parameters` (default: `true`): Set to `false` to skip parameters.
|
|
39
|
+
- `comma` (default: `false`): Set to `true` to stop on a comma. This can be used to parse the media range in an `Accept` header.
|
|
40
|
+
- `start` (default: `0`): Set index to start parsing from.
|
|
61
41
|
|
|
62
42
|
### contentType.format(obj)
|
|
63
43
|
|
|
64
44
|
```js
|
|
65
|
-
|
|
66
|
-
type:
|
|
67
|
-
parameters: { charset:
|
|
68
|
-
})
|
|
45
|
+
const str = contentType.format({
|
|
46
|
+
type: "image/svg+xml",
|
|
47
|
+
parameters: { charset: "utf-8" },
|
|
48
|
+
});
|
|
69
49
|
```
|
|
70
50
|
|
|
71
|
-
Format an object into a `Content-Type` header. This will return a string of the
|
|
72
|
-
content type for the given object with the following properties (examples are
|
|
73
|
-
shown that produce the string `'image/svg+xml; charset=utf-8'`):
|
|
74
|
-
|
|
75
|
-
- `type`: The media type (will be lower-cased). Example: `'image/svg+xml'`
|
|
51
|
+
Format an object into a `Content-Type` header. This will return a string of the content type for the given object with the following properties (examples are shown that produce the string `'image/svg+xml; charset=utf-8'`):
|
|
76
52
|
|
|
77
|
-
|
|
78
|
-
|
|
53
|
+
- `type`: The media type. Example: `'image/svg+xml'`.
|
|
54
|
+
- `parameters`: An optional object of the parameters in the media type. Example: `{charset: 'utf-8'}`.
|
|
79
55
|
|
|
80
56
|
Throws a `TypeError` if the object contains an invalid type or parameter names.
|
|
81
57
|
|
|
@@ -83,12 +59,13 @@ Throws a `TypeError` if the object contains an invalid type or parameter names.
|
|
|
83
59
|
|
|
84
60
|
[MIT](LICENSE)
|
|
85
61
|
|
|
86
|
-
[
|
|
87
|
-
[ci-url]: https://github.com/jshttp/content-type/actions/workflows/ci.yml
|
|
88
|
-
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/content-type/master
|
|
89
|
-
[coveralls-url]: https://coveralls.io/r/jshttp/content-type?branch=master
|
|
90
|
-
[node-image]: https://badgen.net/npm/node/content-type
|
|
91
|
-
[node-url]: https://nodejs.org/en/download
|
|
92
|
-
[npm-downloads-image]: https://badgen.net/npm/dm/content-type
|
|
62
|
+
[npm-image]: https://img.shields.io/npm/v/content-type
|
|
93
63
|
[npm-url]: https://npmjs.org/package/content-type
|
|
94
|
-
[
|
|
64
|
+
[downloads-image]: https://img.shields.io/npm/dm/content-type
|
|
65
|
+
[downloads-url]: https://npmjs.org/package/content-type
|
|
66
|
+
[build-image]: https://img.shields.io/github/actions/workflow/status/jshttp/content-type/ci.yml?branch=master
|
|
67
|
+
[build-url]: https://github.com/jshttp/content-type/actions/workflows/ci.yml?query=branch%3Amaster
|
|
68
|
+
[coverage-image]: https://img.shields.io/codecov/c/gh/jshttp/content-type
|
|
69
|
+
[coverage-url]: https://codecov.io/gh/jshttp/content-type
|
|
70
|
+
[license-image]: http://img.shields.io/npm/l/content-type.svg?style=flat
|
|
71
|
+
[license-url]: LICENSE
|
|
@@ -1,42 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "content-type",
|
|
3
|
+
"version": "2.1.0",
|
|
3
4
|
"description": "Create and parse HTTP Content-Type header",
|
|
4
|
-
"version": "1.0.5",
|
|
5
|
-
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
|
|
6
|
-
"license": "MIT",
|
|
7
5
|
"keywords": [
|
|
8
6
|
"content-type",
|
|
9
7
|
"http",
|
|
10
8
|
"req",
|
|
11
9
|
"res",
|
|
12
|
-
"rfc7231"
|
|
10
|
+
"rfc7231",
|
|
11
|
+
"rfc9110"
|
|
13
12
|
],
|
|
14
13
|
"repository": "jshttp/content-type",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"eslint-config-standard": "15.0.1",
|
|
19
|
-
"eslint-plugin-import": "2.27.5",
|
|
20
|
-
"eslint-plugin-node": "11.1.0",
|
|
21
|
-
"eslint-plugin-promise": "6.1.1",
|
|
22
|
-
"eslint-plugin-standard": "4.1.0",
|
|
23
|
-
"mocha": "10.2.0",
|
|
24
|
-
"nyc": "15.1.0"
|
|
14
|
+
"funding": {
|
|
15
|
+
"type": "opencollective",
|
|
16
|
+
"url": "https://opencollective.com/express"
|
|
25
17
|
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
|
|
20
|
+
"type": "commonjs",
|
|
21
|
+
"exports": "./dist/index.js",
|
|
22
|
+
"main": "./dist/index.js",
|
|
23
|
+
"typings": "./dist/index.d.ts",
|
|
26
24
|
"files": [
|
|
27
|
-
"
|
|
28
|
-
"HISTORY.md",
|
|
29
|
-
"README.md",
|
|
30
|
-
"index.js"
|
|
25
|
+
"dist/"
|
|
31
26
|
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"bench": "vitest bench",
|
|
29
|
+
"build": "ts-scripts build",
|
|
30
|
+
"format": "ts-scripts format",
|
|
31
|
+
"prepare": "ts-scripts install && npm run build",
|
|
32
|
+
"specs": "ts-scripts specs",
|
|
33
|
+
"test": "ts-scripts test"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@borderless/ts-scripts": "^0.15.0",
|
|
37
|
+
"@vitest/coverage-v8": "^3.0.5",
|
|
38
|
+
"typescript": "^5.7.3",
|
|
39
|
+
"vitest": "^3.2.4"
|
|
40
|
+
},
|
|
32
41
|
"engines": {
|
|
33
|
-
"node": ">=
|
|
42
|
+
"node": ">=18"
|
|
34
43
|
},
|
|
35
|
-
"scripts": {
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
44
|
+
"ts-scripts": {
|
|
45
|
+
"dist": [
|
|
46
|
+
"dist"
|
|
47
|
+
],
|
|
48
|
+
"project": [
|
|
49
|
+
"tsconfig.build.json"
|
|
50
|
+
]
|
|
41
51
|
}
|
|
42
52
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
<a href="https://expressjs.com/">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://expressjs.com/images/logos/logo-express-white.svg">
|
|
4
|
+
<img alt="Express Logo" src="https://expressjs.com/images/logos/logo-express-black.svg" width="280">
|
|
5
|
+
</picture>
|
|
6
|
+
</a>
|
|
2
7
|
|
|
3
8
|
**Fast, unopinionated, minimalist web framework for [Node.js](https://nodejs.org).**
|
|
4
9
|
|
|
5
|
-
**This project has a [Code of Conduct].**
|
|
6
|
-
|
|
7
10
|
## Table of contents
|
|
8
11
|
|
|
9
|
-
- [Table of contents](#table-of-contents)
|
|
10
12
|
- [Installation](#installation)
|
|
11
13
|
- [Features](#features)
|
|
12
14
|
- [Docs \& Community](#docs--community)
|
|
@@ -57,7 +59,7 @@ If this is a brand new project, make sure to create a `package.json` first with
|
|
|
57
59
|
the [`npm init` command](https://docs.npmjs.com/creating-a-package-json-file).
|
|
58
60
|
|
|
59
61
|
Installation is done using the
|
|
60
|
-
[`npm install` command](https://docs.npmjs.com/
|
|
62
|
+
[`npm install` command](https://docs.npmjs.com/downloading-and-installing-packages-locally):
|
|
61
63
|
|
|
62
64
|
```bash
|
|
63
65
|
npm install express
|
|
@@ -80,7 +82,7 @@ for more information.
|
|
|
80
82
|
|
|
81
83
|
* [Website and Documentation](https://expressjs.com/) - [[website repo](https://github.com/expressjs/expressjs.com)]
|
|
82
84
|
* [GitHub Organization](https://github.com/expressjs) for Official Middleware & Modules
|
|
83
|
-
* [
|
|
85
|
+
* [GitHub Discussions](https://github.com/expressjs/discussions) for discussion on the development and usage of Express
|
|
84
86
|
|
|
85
87
|
**PROTIP** Be sure to read the [migration guide to v5](https://expressjs.com/en/guide/migrating-5)
|
|
86
88
|
|
|
@@ -152,9 +154,11 @@ tests, triaging incoming pull requests and issues, and more!
|
|
|
152
154
|
|
|
153
155
|
See the [Contributing Guide] for more technical details on contributing.
|
|
154
156
|
|
|
157
|
+
This project has a [Code of Conduct]. By participating, you are expected to uphold this code.
|
|
158
|
+
|
|
155
159
|
### Security Issues
|
|
156
160
|
|
|
157
|
-
If you discover a security vulnerability in Express, please see [Security Policies and Procedures](
|
|
161
|
+
If you discover a security vulnerability in Express, please see [Security Policies and Procedures](https://github.com/expressjs/express/security/policy).
|
|
158
162
|
|
|
159
163
|
### Running Tests
|
|
160
164
|
|
|
@@ -212,7 +216,9 @@ The original author of Express is [TJ Holowaychuk](https://github.com/tj)
|
|
|
212
216
|
* [IamLizu](https://github.com/IamLizu) - **S M Mahmudul Hasan** (he/him)
|
|
213
217
|
* [Phillip9587](https://github.com/Phillip9587) - **Phillip Barta**
|
|
214
218
|
* [efekrskl](https://github.com/efekrskl) - **Efe Karasakal**
|
|
215
|
-
|
|
219
|
+
* [rxmarbles](https://github.com/rxmarbles) - **Rick Markins** (he/him)
|
|
220
|
+
* [krzysdz](https://github.com/krzysdz)
|
|
221
|
+
* [GroophyLifefor](https://github.com/GroophyLifefor) - **Murat Kirazkaya**
|
|
216
222
|
|
|
217
223
|
<details>
|
|
218
224
|
<summary>Triagers emeriti members</summary>
|
|
@@ -247,7 +253,7 @@ The original author of Express is [TJ Holowaychuk](https://github.com/tj)
|
|
|
247
253
|
* [tunniclm](https://github.com/tunniclm) - **Mike Tunnicliffe**
|
|
248
254
|
* [enyoghasim](https://github.com/enyoghasim) - **David Enyoghasim**
|
|
249
255
|
* [0ss](https://github.com/0ss) - **Salah**
|
|
250
|
-
* [
|
|
256
|
+
* [ejcheng](https://github.com/ejcheng)- **Eric Cheng** (he/him)
|
|
251
257
|
* [dakshkhetan](https://github.com/dakshkhetan) - **Daksh Khetan** (he/him)
|
|
252
258
|
* [lucasraziel](https://github.com/lucasraziel) - **Lucas Soares Do Rego**
|
|
253
259
|
* [mertcanaltin](https://github.com/mertcanaltin) - **Mert Can Altin**
|
|
@@ -523,7 +523,7 @@ app.render = function render(name, options, callback) {
|
|
|
523
523
|
var cache = this.cache;
|
|
524
524
|
var done = callback;
|
|
525
525
|
var engines = this.engines;
|
|
526
|
-
var opts = options;
|
|
526
|
+
var opts = options || {};
|
|
527
527
|
var view;
|
|
528
528
|
|
|
529
529
|
// support callback function as second arg
|
|
@@ -614,7 +614,7 @@ app.listen = function listen() {
|
|
|
614
614
|
|
|
615
615
|
function logerror(err) {
|
|
616
616
|
/* istanbul ignore next */
|
|
617
|
-
if (this.get('env') !== 'test') console.error(err
|
|
617
|
+
if (this.get('env') !== 'test') console.error(err);
|
|
618
618
|
}
|
|
619
619
|
|
|
620
620
|
/**
|
|
@@ -83,16 +83,13 @@ req.header = function header(name) {
|
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
|
-
* To do: update docs.
|
|
87
|
-
*
|
|
88
86
|
* Check if the given `type(s)` is acceptable, returning
|
|
89
|
-
* the best match when true, otherwise `
|
|
87
|
+
* the best match when true, otherwise `false`, in which
|
|
90
88
|
* case you should respond with 406 "Not Acceptable".
|
|
91
89
|
*
|
|
92
90
|
* The `type` value may be a single MIME type string
|
|
93
91
|
* such as "application/json", an extension name
|
|
94
|
-
* such as "json",
|
|
95
|
-
* an argument list such as `"json", "html", "text/plain"`,
|
|
92
|
+
* such as "json", an argument list such as `"json", "html", "text/plain"`,
|
|
96
93
|
* or an array `["json", "html", "text/plain"]`. When a list
|
|
97
94
|
* or array is given, the _best_ match, if any is returned.
|
|
98
95
|
*
|
|
@@ -107,7 +104,7 @@ req.header = function header(name) {
|
|
|
107
104
|
* // => "html"
|
|
108
105
|
* req.accepts('text/html');
|
|
109
106
|
* // => "text/html"
|
|
110
|
-
* req.accepts('json, text');
|
|
107
|
+
* req.accepts('json', 'text');
|
|
111
108
|
* // => "json"
|
|
112
109
|
* req.accepts('application/json');
|
|
113
110
|
* // => "application/json"
|
|
@@ -115,12 +112,11 @@ req.header = function header(name) {
|
|
|
115
112
|
* // Accept: text/*, application/json
|
|
116
113
|
* req.accepts('image/png');
|
|
117
114
|
* req.accepts('png');
|
|
118
|
-
* // =>
|
|
115
|
+
* // => false
|
|
119
116
|
*
|
|
120
117
|
* // Accept: text/*;q=.5, application/json
|
|
121
118
|
* req.accepts(['html', 'json']);
|
|
122
119
|
* req.accepts('html', 'json');
|
|
123
|
-
* req.accepts('html, json');
|
|
124
120
|
* // => "json"
|
|
125
121
|
*
|
|
126
122
|
* @param {String|Array} type(s)
|
|
@@ -147,17 +143,34 @@ req.acceptsEncodings = function(){
|
|
|
147
143
|
};
|
|
148
144
|
|
|
149
145
|
/**
|
|
150
|
-
*
|
|
151
|
-
*
|
|
146
|
+
* Checks if the specified `charset`s are acceptable based on the request's `Accept-Charset` header.
|
|
147
|
+
* Returns the best matching charset or an array of acceptable charsets.
|
|
152
148
|
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
149
|
+
* The `charset` argument(s) can be:
|
|
150
|
+
* - A single charset string (e.g., "utf-8")
|
|
151
|
+
* - Multiple charset strings as arguments (e.g., `"utf-8", "iso-8859-1"`)
|
|
152
|
+
* - A comma-delimited list of charsets (e.g., `"utf-8, iso-8859-1"`)
|
|
153
|
+
*
|
|
154
|
+
* Examples:
|
|
155
|
+
*
|
|
156
|
+
* // Accept-Charset: utf-8, iso-8859-1
|
|
157
|
+
* req.acceptsCharsets('utf-8');
|
|
158
|
+
* // => "utf-8"
|
|
159
|
+
*
|
|
160
|
+
* req.acceptsCharsets('utf-8', 'iso-8859-1');
|
|
161
|
+
* // => "utf-8"
|
|
162
|
+
*
|
|
163
|
+
* req.acceptsCharsets('utf-8, utf-16');
|
|
164
|
+
* // => "utf-8"
|
|
165
|
+
*
|
|
166
|
+
* @param {...String} charsets - The charset(s) to check against the `Accept-Charset` header.
|
|
167
|
+
* @return {String|Array} - The best matching charset, or an array of acceptable charsets.
|
|
155
168
|
* @public
|
|
156
169
|
*/
|
|
157
170
|
|
|
158
|
-
req.acceptsCharsets = function(){
|
|
159
|
-
|
|
160
|
-
return accept.charsets
|
|
171
|
+
req.acceptsCharsets = function(...charsets) {
|
|
172
|
+
const accept = accepts(this);
|
|
173
|
+
return accept.charsets(...charsets);
|
|
161
174
|
};
|
|
162
175
|
|
|
163
176
|
/**
|
|
@@ -317,7 +330,7 @@ defineGetter(req, 'secure', function secure(){
|
|
|
317
330
|
/**
|
|
318
331
|
* Return the remote address from the trusted proxy.
|
|
319
332
|
*
|
|
320
|
-
*
|
|
333
|
+
* This is the remote address on the socket unless
|
|
321
334
|
* "trust proxy" is set.
|
|
322
335
|
*
|
|
323
336
|
* @return {String}
|
|
@@ -411,7 +424,7 @@ defineGetter(req, 'host', function host(){
|
|
|
411
424
|
} else if (val.indexOf(',') !== -1) {
|
|
412
425
|
// Note: X-Forwarded-Host is normally only ever a
|
|
413
426
|
// single value, but this is to be safe.
|
|
414
|
-
val = val.substring(0, val.indexOf(',')).
|
|
427
|
+
val = val.substring(0, val.indexOf(',')).trimEnd()
|
|
415
428
|
}
|
|
416
429
|
|
|
417
430
|
return val || undefined;
|
|
@@ -458,8 +471,8 @@ defineGetter(req, 'fresh', function(){
|
|
|
458
471
|
var res = this.res
|
|
459
472
|
var status = res.statusCode
|
|
460
473
|
|
|
461
|
-
// GET or
|
|
462
|
-
if ('GET' !== method && 'HEAD' !== method) return false;
|
|
474
|
+
// GET, HEAD, or QUERY for weak freshness validation only
|
|
475
|
+
if ('GET' !== method && 'HEAD' !== method && 'QUERY' !== method) return false;
|
|
463
476
|
|
|
464
477
|
// 2xx or 304 as per rfc2616 14.26
|
|
465
478
|
if ((status >= 200 && status < 300) || 304 === status) {
|
|
@@ -31,6 +31,7 @@ var cookie = require('cookie');
|
|
|
31
31
|
var send = require('send');
|
|
32
32
|
var extname = path.extname;
|
|
33
33
|
var resolve = path.resolve;
|
|
34
|
+
var basename = path.basename;
|
|
34
35
|
var vary = require('vary');
|
|
35
36
|
const { Buffer } = require('node:buffer');
|
|
36
37
|
|
|
@@ -126,7 +127,6 @@ res.send = function send(body) {
|
|
|
126
127
|
var chunk = body;
|
|
127
128
|
var encoding;
|
|
128
129
|
var req = this.req;
|
|
129
|
-
var type;
|
|
130
130
|
|
|
131
131
|
// settings
|
|
132
132
|
var app = this.app;
|
|
@@ -134,7 +134,12 @@ res.send = function send(body) {
|
|
|
134
134
|
switch (typeof chunk) {
|
|
135
135
|
// string defaulting to html
|
|
136
136
|
case 'string':
|
|
137
|
-
|
|
137
|
+
encoding = 'utf8';
|
|
138
|
+
const type = this.get('Content-Type');
|
|
139
|
+
|
|
140
|
+
if (typeof type === 'string') {
|
|
141
|
+
this.set('Content-Type', setCharset(type, 'utf-8'));
|
|
142
|
+
} else {
|
|
138
143
|
this.type('html');
|
|
139
144
|
}
|
|
140
145
|
break;
|
|
@@ -153,23 +158,11 @@ res.send = function send(body) {
|
|
|
153
158
|
break;
|
|
154
159
|
}
|
|
155
160
|
|
|
156
|
-
// write strings in utf-8
|
|
157
|
-
if (typeof chunk === 'string') {
|
|
158
|
-
encoding = 'utf8';
|
|
159
|
-
type = this.get('Content-Type');
|
|
160
|
-
|
|
161
|
-
// reflect this in content-type
|
|
162
|
-
if (typeof type === 'string') {
|
|
163
|
-
this.set('Content-Type', setCharset(type, 'utf-8'));
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
161
|
// determine if ETag should be generated
|
|
168
162
|
var etagFn = app.get('etag fn')
|
|
169
163
|
var generateETag = !this.get('ETag') && typeof etagFn === 'function'
|
|
170
164
|
|
|
171
|
-
|
|
172
|
-
var len
|
|
165
|
+
var len;
|
|
173
166
|
if (chunk !== undefined) {
|
|
174
167
|
if (Buffer.isBuffer(chunk)) {
|
|
175
168
|
// get length of Buffer
|
|
@@ -184,7 +177,11 @@ res.send = function send(body) {
|
|
|
184
177
|
len = chunk.length
|
|
185
178
|
}
|
|
186
179
|
|
|
187
|
-
|
|
180
|
+
// Because Content-Length and Transfer-Encoding can't be present in the response headers together,
|
|
181
|
+
// Content-Length should be added only if there is no Transfer-Encoding header
|
|
182
|
+
if (!this.get('Transfer-Encoding')) {
|
|
183
|
+
this.set('Content-Length', len);
|
|
184
|
+
}
|
|
188
185
|
}
|
|
189
186
|
|
|
190
187
|
// populate ETag
|
|
@@ -367,7 +364,7 @@ res.sendStatus = function sendStatus(statusCode) {
|
|
|
367
364
|
* if (yes) {
|
|
368
365
|
* res.sendFile('/uploads/' + uid + '/' + file);
|
|
369
366
|
* } else {
|
|
370
|
-
* res.send(403, 'Sorry! you
|
|
367
|
+
* res.send(403, 'Sorry! you can\'t see that.');
|
|
371
368
|
* }
|
|
372
369
|
* });
|
|
373
370
|
* });
|
|
@@ -452,7 +449,7 @@ res.download = function download (path, filename, options, callback) {
|
|
|
452
449
|
opts = null
|
|
453
450
|
}
|
|
454
451
|
|
|
455
|
-
// support optional filename, where options may be in
|
|
452
|
+
// support optional filename, where options may be in its place
|
|
456
453
|
if (typeof filename === 'object' &&
|
|
457
454
|
(typeof options === 'function' || options === undefined)) {
|
|
458
455
|
name = null
|
|
@@ -461,7 +458,7 @@ res.download = function download (path, filename, options, callback) {
|
|
|
461
458
|
|
|
462
459
|
// set Content-Disposition when file is sent
|
|
463
460
|
var headers = {
|
|
464
|
-
'Content-Disposition': contentDisposition(name || path)
|
|
461
|
+
'Content-Disposition': contentDisposition.create(basename(name || path))
|
|
465
462
|
};
|
|
466
463
|
|
|
467
464
|
// merge user-provided headers
|
|
@@ -491,7 +488,7 @@ res.download = function download (path, filename, options, callback) {
|
|
|
491
488
|
/**
|
|
492
489
|
* Set _Content-Type_ response header with `type` through `mime.contentType()`
|
|
493
490
|
* when it does not contain "/", or set the Content-Type to `type` otherwise.
|
|
494
|
-
* When no mapping is found
|
|
491
|
+
* When no mapping is found through `mime.contentType()`, the type is set to
|
|
495
492
|
* "application/octet-stream".
|
|
496
493
|
*
|
|
497
494
|
* Examples:
|
|
@@ -520,8 +517,9 @@ res.type = function contentType(type) {
|
|
|
520
517
|
* Respond to the Acceptable formats using an `obj`
|
|
521
518
|
* of mime-type callbacks.
|
|
522
519
|
*
|
|
523
|
-
* This method uses `req.
|
|
524
|
-
* acceptable types ordered by
|
|
520
|
+
* This method uses `req.accepts()`, which returns the
|
|
521
|
+
* best match from the acceptable types ordered by
|
|
522
|
+
* their quality values.
|
|
525
523
|
* When "Accept" is not present the _first_ callback
|
|
526
524
|
* is invoked, otherwise the first match is used. When
|
|
527
525
|
* no match is performed the server responds with
|
|
@@ -609,11 +607,12 @@ res.format = function(obj){
|
|
|
609
607
|
*/
|
|
610
608
|
|
|
611
609
|
res.attachment = function attachment(filename) {
|
|
612
|
-
|
|
613
|
-
|
|
610
|
+
const name = filename !== undefined ? basename(filename) : undefined;
|
|
611
|
+
if (name) {
|
|
612
|
+
this.type(extname(name));
|
|
614
613
|
}
|
|
615
614
|
|
|
616
|
-
this.set('Content-Disposition', contentDisposition(
|
|
615
|
+
this.set('Content-Disposition', contentDisposition.create(name));
|
|
617
616
|
|
|
618
617
|
return this;
|
|
619
618
|
};
|
|
@@ -784,12 +783,9 @@ res.cookie = function (name, value, options) {
|
|
|
784
783
|
/**
|
|
785
784
|
* Set the location header to `url`.
|
|
786
785
|
*
|
|
787
|
-
* The given `url` can also be "back", which redirects
|
|
788
|
-
* to the _Referrer_ or _Referer_ headers or "/".
|
|
789
|
-
*
|
|
790
786
|
* Examples:
|
|
791
787
|
*
|
|
792
|
-
* res.location('/foo/bar')
|
|
788
|
+
* res.location('/foo/bar');
|
|
793
789
|
* res.location('http://example.com');
|
|
794
790
|
* res.location('../login');
|
|
795
791
|
*
|
|
@@ -850,7 +846,8 @@ res.redirect = function redirect(url) {
|
|
|
850
846
|
|
|
851
847
|
html: function(){
|
|
852
848
|
var u = escapeHtml(address);
|
|
853
|
-
body = '
|
|
849
|
+
body = '<!DOCTYPE html><head><title>' + statuses.message[status] + '</title></head>'
|
|
850
|
+
+ '<body><p>' + statuses.message[status] + '. Redirecting to ' + u + '</p></body>'
|
|
854
851
|
},
|
|
855
852
|
|
|
856
853
|
default: function(){
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express",
|
|
3
3
|
"description": "Fast, unopinionated, minimalist web framework",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.3.0",
|
|
5
5
|
"author": "TJ Holowaychuk <tj@vision-media.ca>",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Aaron Heckmann <aaron.heckmann+github@gmail.com>",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"accepts": "^2.0.0",
|
|
36
|
-
"body-parser": "^2.
|
|
37
|
-
"content-disposition": "^
|
|
38
|
-
"content-type": "^
|
|
36
|
+
"body-parser": "^2.3.0",
|
|
37
|
+
"content-disposition": "^2.0.1",
|
|
38
|
+
"content-type": "^2.0.0",
|
|
39
39
|
"cookie": "^0.7.1",
|
|
40
40
|
"cookie-signature": "^1.2.1",
|
|
41
41
|
"debug": "^4.4.0",
|
|
@@ -51,14 +51,14 @@
|
|
|
51
51
|
"on-finished": "^2.4.1",
|
|
52
52
|
"once": "^1.4.0",
|
|
53
53
|
"parseurl": "^1.3.3",
|
|
54
|
-
"proxy-addr": "^2.0.
|
|
55
|
-
"qs": "^6.
|
|
54
|
+
"proxy-addr": "^2.0.8",
|
|
55
|
+
"qs": "^6.16.0",
|
|
56
56
|
"range-parser": "^1.2.1",
|
|
57
57
|
"router": "^2.2.0",
|
|
58
58
|
"send": "^1.1.0",
|
|
59
59
|
"serve-static": "^2.2.0",
|
|
60
60
|
"statuses": "^2.0.1",
|
|
61
|
-
"type-is": "^2.0
|
|
61
|
+
"type-is": "^2.1.0",
|
|
62
62
|
"vary": "^1.1.2"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
@@ -69,11 +69,11 @@
|
|
|
69
69
|
"ejs": "^3.1.10",
|
|
70
70
|
"eslint": "8.47.0",
|
|
71
71
|
"express-session": "^1.18.1",
|
|
72
|
-
"hbs": "4.
|
|
72
|
+
"hbs": "4.3.1",
|
|
73
73
|
"marked": "^15.0.3",
|
|
74
74
|
"method-override": "3.0.0",
|
|
75
|
-
"mocha": "^
|
|
76
|
-
"morgan": "1.
|
|
75
|
+
"mocha": "^11.7.5",
|
|
76
|
+
"morgan": "1.12.1",
|
|
77
77
|
"nyc": "^17.1.0",
|
|
78
78
|
"pbkdf2-password": "1.2.1",
|
|
79
79
|
"supertest": "^6.3.0",
|
|
@@ -24,7 +24,7 @@ Caller Application → qs.stringify(obj, options) → Stringifying Engine → Ou
|
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
**Trust Boundaries:**
|
|
27
|
-
- **Input string (parse):** May come from untrusted sources (e.g., user input, network requests)
|
|
27
|
+
- **Input string (parse):** May come from untrusted sources (e.g., user input, network requests). `qs` defines its own key grammar, where bracket groups denote nesting, so the parameter names it derives are deliberately not the flat names produced by `URLSearchParams`, `node:querystring`, or a WHATWG-conformant parser. The parsed object, not the raw string, is the only thing a caller should make trust decisions about; see "Interpretation conflict" below.
|
|
28
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
|
|
@@ -51,6 +51,7 @@ Caller Application → qs.stringify(obj, options) → Stringifying Engine → Ou
|
|
|
51
51
|
- **Information Disclosure:** Error messages may expose internal details or sensitive data.
|
|
52
52
|
- **Denial of Service:** Large or malformed input can exhaust memory or CPU.
|
|
53
53
|
- **Elevation of Privilege:** Prototype pollution can lead to unintended privilege escalation in the host application[3][4][8].
|
|
54
|
+
- **Interpretation conflict (out of scope):** An application that parses the same query string with two different parsers, and makes a trust decision on one result while consuming the other, can be attacked by any input the two parsers read differently. `qs`'s bracket grammar guarantees such inputs exist, so this is a property of the deployment, not a defect `qs` can remove. It is the calling application's responsibility to parse once and validate the parsed object.
|
|
54
55
|
|
|
55
56
|
### 6. Mitigation/Countermeasures
|
|
56
57
|
|
|
@@ -58,8 +59,9 @@ Caller Application → qs.stringify(obj, options) → Stringifying Engine → Ou
|
|
|
58
59
|
|---------------------------------------------------|---------------------|
|
|
59
60
|
| 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
61
|
| Information Disclosure (error messages) | Generic error messages without stack traces or internal paths. |
|
|
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
|
|
62
|
+
| 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 hard caps on the number of parameters and on each array's length, opt in to `throwOnLimitExceeded: true` (default `false`), which rejects a query string with more than `parameterLimit` parameters, or one that would produce any array longer than `arrayLimit`. `arrayLimit` applies to each array separately, including each parameter's comma-split value, so the total number of values can still reach `parameterLimit` times `arrayLimit`; always bound input size at the transport layer as well[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
63
|
| Elevation of Privilege (prototype pollution) | Keep `allowPrototypes: false`; validate options against allowlist; use `plainObjects` to avoid prototype pollution[4][8]. |
|
|
64
|
+
| Interpretation conflict (validate-then-use across two parsers) | None available inside `qs`, by construction: `qs` and a flat parser disagree about parameter names for well-formed input, so no hardening can make the two views equal. Parse untrusted input once, with `qs`, and apply deny lists, authorization, and signature checks to the parsed object rather than to raw key text. Text that `qs` cannot place in its grammar is currently dropped, so distinct raw names can share one parsed path ([#619](https://github.com/ljharb/qs/issues/619)). |
|
|
63
65
|
|
|
64
66
|
### 7. Risk Ranking
|
|
65
67
|
|