@c9up/ream 0.2.28 → 0.2.30
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/README.md +5 -6
- package/dist/Codemods.d.ts +24 -0
- package/dist/Codemods.d.ts.map +1 -1
- package/dist/Codemods.js +211 -1
- package/dist/Codemods.js.map +1 -1
- package/dist/HttpKernel.d.ts.map +1 -1
- package/dist/HttpKernel.js +17 -5
- package/dist/HttpKernel.js.map +1 -1
- package/dist/Ignitor.d.ts +15 -2
- package/dist/Ignitor.d.ts.map +1 -1
- package/dist/Ignitor.js +33 -23
- package/dist/Ignitor.js.map +1 -1
- package/dist/bodyparser/BodyParserMiddleware.d.ts +4 -4
- package/dist/bodyparser/BodyParserMiddleware.d.ts.map +1 -1
- package/dist/bodyparser/BodyParserMiddleware.js +41 -11
- package/dist/bodyparser/BodyParserMiddleware.js.map +1 -1
- package/dist/bodyparser/MultipartFile.d.ts +21 -15
- package/dist/bodyparser/MultipartFile.d.ts.map +1 -1
- package/dist/bodyparser/MultipartFile.js +40 -58
- package/dist/bodyparser/MultipartFile.js.map +1 -1
- package/dist/bodyparser/parseSize.d.ts +7 -4
- package/dist/bodyparser/parseSize.d.ts.map +1 -1
- package/dist/bodyparser/parseSize.js +12 -17
- package/dist/bodyparser/parseSize.js.map +1 -1
- package/dist/bodyparser/qsParse.d.ts +20 -1
- package/dist/bodyparser/qsParse.d.ts.map +1 -1
- package/dist/bodyparser/qsParse.js +78 -25
- package/dist/bodyparser/qsParse.js.map +1 -1
- package/dist/codemods/source.d.ts +57 -0
- package/dist/codemods/source.d.ts.map +1 -0
- package/dist/codemods/source.js +282 -0
- package/dist/codemods/source.js.map +1 -0
- package/dist/console/prompts.d.ts.map +1 -1
- package/dist/console/prompts.js +3 -1
- package/dist/console/prompts.js.map +1 -1
- package/dist/container/Container.d.ts.map +1 -1
- package/dist/container/Container.js +61 -71
- package/dist/container/Container.js.map +1 -1
- package/dist/events/Emitter.d.ts +12 -0
- package/dist/events/Emitter.d.ts.map +1 -1
- package/dist/events/Emitter.js +36 -9
- package/dist/events/Emitter.js.map +1 -1
- package/dist/events/helix/helpers.d.ts.map +1 -1
- package/dist/events/helix/helpers.js +19 -9
- package/dist/events/helix/helpers.js.map +1 -1
- package/dist/graphql/GraphQLEngine.d.ts +8 -0
- package/dist/graphql/GraphQLEngine.d.ts.map +1 -1
- package/dist/graphql/GraphQLEngine.js +79 -12
- package/dist/graphql/GraphQLEngine.js.map +1 -1
- package/dist/helpers/MessageBuilder.d.ts +4 -2
- package/dist/helpers/MessageBuilder.d.ts.map +1 -1
- package/dist/helpers/MessageBuilder.js +4 -2
- package/dist/helpers/MessageBuilder.js.map +1 -1
- package/dist/helpers/errors.d.ts +11 -0
- package/dist/helpers/errors.d.ts.map +1 -0
- package/dist/helpers/errors.js +17 -0
- package/dist/helpers/errors.js.map +1 -0
- package/dist/helpers/napi-loader.d.ts.map +1 -1
- package/dist/helpers/napi-loader.js +3 -2
- package/dist/helpers/napi-loader.js.map +1 -1
- package/dist/http/Exception.d.ts +14 -1
- package/dist/http/Exception.d.ts.map +1 -1
- package/dist/http/Exception.js +10 -2
- package/dist/http/Exception.js.map +1 -1
- package/dist/http/HttpContext.d.ts +31 -2
- package/dist/http/HttpContext.d.ts.map +1 -1
- package/dist/http/HttpContext.js +12 -5
- package/dist/http/HttpContext.js.map +1 -1
- package/dist/http/RedirectBuilder.d.ts +9 -3
- package/dist/http/RedirectBuilder.d.ts.map +1 -1
- package/dist/http/RedirectBuilder.js +43 -37
- package/dist/http/RedirectBuilder.js.map +1 -1
- package/dist/http/Request.d.ts +42 -17
- package/dist/http/Request.d.ts.map +1 -1
- package/dist/http/Request.js +80 -58
- package/dist/http/Request.js.map +1 -1
- package/dist/http/Response.d.ts +7 -4
- package/dist/http/Response.d.ts.map +1 -1
- package/dist/http/Response.js +14 -6
- package/dist/http/Response.js.map +1 -1
- package/dist/http/SseStream.js +6 -7
- package/dist/http/SseStream.js.map +1 -1
- package/dist/http/permissions.d.ts +25 -0
- package/dist/http/permissions.d.ts.map +1 -0
- package/dist/http/permissions.js +38 -0
- package/dist/http/permissions.js.map +1 -0
- package/dist/http-client/HttpClient.d.ts +111 -0
- package/dist/http-client/HttpClient.d.ts.map +1 -0
- package/dist/http-client/HttpClient.js +386 -0
- package/dist/http-client/HttpClient.js.map +1 -0
- package/dist/http-client/addresses.d.ts +14 -0
- package/dist/http-client/addresses.d.ts.map +1 -0
- package/dist/http-client/addresses.js +57 -0
- package/dist/http-client/addresses.js.map +1 -0
- package/dist/http-client/fake.d.ts +50 -0
- package/dist/http-client/fake.d.ts.map +1 -0
- package/dist/http-client/fake.js +95 -0
- package/dist/http-client/fake.js.map +1 -0
- package/dist/http-client/index.d.ts +7 -0
- package/dist/http-client/index.d.ts.map +1 -0
- package/dist/http-client/index.js +7 -0
- package/dist/http-client/index.js.map +1 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/middleware/Pipeline.d.ts.map +1 -1
- package/dist/middleware/Pipeline.js +6 -3
- package/dist/middleware/Pipeline.js.map +1 -1
- package/dist/native/generated.d.ts +93 -36
- package/dist/native/generated.d.ts.map +1 -1
- package/dist/profiler/Profiler.d.ts.map +1 -1
- package/dist/profiler/Profiler.js +4 -1
- package/dist/profiler/Profiler.js.map +1 -1
- package/dist/profiler/client.generated.d.ts +5 -0
- package/dist/profiler/client.generated.d.ts.map +1 -0
- package/dist/profiler/client.generated.js +6 -0
- package/dist/profiler/client.generated.js.map +1 -0
- package/dist/profiler/collectors.d.ts +92 -13
- package/dist/profiler/collectors.d.ts.map +1 -1
- package/dist/profiler/collectors.js +106 -19
- package/dist/profiler/collectors.js.map +1 -1
- package/dist/profiler/endpoint.d.ts +2 -1
- package/dist/profiler/endpoint.d.ts.map +1 -1
- package/dist/profiler/endpoint.js +25 -1
- package/dist/profiler/endpoint.js.map +1 -1
- package/dist/profiler/index.d.ts +8 -4
- package/dist/profiler/index.d.ts.map +1 -1
- package/dist/profiler/index.js +11 -4
- package/dist/profiler/index.js.map +1 -1
- package/dist/profiler/middleware.d.ts.map +1 -1
- package/dist/profiler/middleware.js +76 -10
- package/dist/profiler/middleware.js.map +1 -1
- package/dist/profiler/preview.d.ts +17 -0
- package/dist/profiler/preview.d.ts.map +1 -0
- package/dist/profiler/preview.js +100 -0
- package/dist/profiler/preview.js.map +1 -0
- package/dist/profiler/toolbar.d.ts +15 -23
- package/dist/profiler/toolbar.d.ts.map +1 -1
- package/dist/profiler/toolbar.js +25 -91
- package/dist/profiler/toolbar.js.map +1 -1
- package/dist/profiler/types.d.ts +6 -1
- package/dist/profiler/types.d.ts.map +1 -1
- package/dist/router/Router.d.ts +6 -0
- package/dist/router/Router.d.ts.map +1 -1
- package/dist/router/Router.js +115 -12
- package/dist/router/Router.js.map +1 -1
- package/dist/rpc/RpcProvider.d.ts +6 -0
- package/dist/rpc/RpcProvider.d.ts.map +1 -1
- package/dist/rpc/RpcProvider.js +4 -1
- package/dist/rpc/RpcProvider.js.map +1 -1
- package/dist/rpc/RpcRouter.d.ts +27 -14
- package/dist/rpc/RpcRouter.d.ts.map +1 -1
- package/dist/rpc/RpcRouter.js +97 -40
- package/dist/rpc/RpcRouter.js.map +1 -1
- package/dist/scheduler/Scheduler.js +1 -1
- package/dist/scheduler/Scheduler.js.map +1 -1
- package/dist/scheduler/locks/RedisLockBackend.d.ts.map +1 -1
- package/dist/scheduler/locks/RedisLockBackend.js +13 -2
- package/dist/scheduler/locks/RedisLockBackend.js.map +1 -1
- package/dist/security/CookieSigner.d.ts.map +1 -1
- package/dist/security/CookieSigner.js +32 -8
- package/dist/security/CookieSigner.js.map +1 -1
- package/dist/security/SignedUrl.d.ts.map +1 -1
- package/dist/security/SignedUrl.js +16 -19
- package/dist/security/SignedUrl.js.map +1 -1
- package/dist/server/Server.d.ts +44 -12
- package/dist/server/Server.d.ts.map +1 -1
- package/dist/server/Server.js +31 -10
- package/dist/server/Server.js.map +1 -1
- package/dist/server/nativeGrpc.d.ts +27 -0
- package/dist/server/nativeGrpc.d.ts.map +1 -0
- package/dist/server/nativeGrpc.js +47 -0
- package/dist/server/nativeGrpc.js.map +1 -0
- package/dist/server/nativeLimits.d.ts +57 -0
- package/dist/server/nativeLimits.d.ts.map +1 -0
- package/dist/server/nativeLimits.js +75 -0
- package/dist/server/nativeLimits.js.map +1 -0
- package/dist/session/Session.d.ts +12 -0
- package/dist/session/Session.d.ts.map +1 -1
- package/dist/session/Session.js +13 -4
- package/dist/session/Session.js.map +1 -1
- package/dist/session/SessionMiddleware.d.ts.map +1 -1
- package/dist/session/SessionMiddleware.js +28 -9
- package/dist/session/SessionMiddleware.js.map +1 -1
- package/dist/session/config.d.ts +5 -0
- package/dist/session/config.d.ts.map +1 -1
- package/dist/session/config.js +8 -0
- package/dist/session/config.js.map +1 -1
- package/dist/session/drivers/MemoryDriver.d.ts.map +1 -1
- package/dist/session/drivers/MemoryDriver.js +26 -7
- package/dist/session/drivers/MemoryDriver.js.map +1 -1
- package/dist/session/errors.d.ts +17 -0
- package/dist/session/errors.d.ts.map +1 -1
- package/dist/session/errors.js +21 -0
- package/dist/session/errors.js.map +1 -1
- package/dist/session/templateTags.d.ts +14 -0
- package/dist/session/templateTags.d.ts.map +1 -1
- package/dist/session/templateTags.js +45 -17
- package/dist/session/templateTags.js.map +1 -1
- package/dist/storage/StaticMiddleware.d.ts.map +1 -1
- package/dist/storage/StaticMiddleware.js +49 -27
- package/dist/storage/StaticMiddleware.js.map +1 -1
- package/dist/testing/ApiResponse.d.ts.map +1 -1
- package/dist/testing/ApiResponse.js +7 -1
- package/dist/testing/ApiResponse.js.map +1 -1
- package/dist/testing/TestClient.d.ts.map +1 -1
- package/dist/testing/TestClient.js +16 -4
- package/dist/testing/TestClient.js.map +1 -1
- package/dist/utils/Macroable.d.ts +1 -1
- package/dist/utils/Macroable.js +2 -2
- package/dist/utils/Macroable.js.map +1 -1
- package/events.darwin-arm64.node +0 -0
- package/events.darwin-x64.node +0 -0
- package/events.linux-arm64-gnu.node +0 -0
- package/events.linux-x64-gnu.node +0 -0
- package/events.win32-x64-msvc.node +0 -0
- package/index.darwin-arm64.node +0 -0
- package/index.darwin-x64.node +0 -0
- package/index.linux-arm64-gnu.node +0 -0
- package/index.linux-x64-gnu.node +0 -0
- package/index.win32-x64-msvc.node +0 -0
- package/package.json +11 -3
- package/scheduler.darwin-arm64.node +0 -0
- package/scheduler.darwin-x64.node +0 -0
- package/scheduler.linux-arm64-gnu.node +0 -0
- package/scheduler.linux-x64-gnu.node +0 -0
- package/scheduler.win32-x64-msvc.node +0 -0
- package/src/Codemods.ts +314 -3
- package/src/HttpKernel.ts +18 -7
- package/src/Ignitor.ts +58 -26
- package/src/bodyparser/BodyParserMiddleware.ts +45 -16
- package/src/bodyparser/MultipartFile.ts +46 -67
- package/src/bodyparser/parseSize.ts +17 -17
- package/src/bodyparser/qsParse.ts +96 -26
- package/src/codemods/source.ts +303 -0
- package/src/console/prompts.ts +3 -1
- package/src/container/Container.ts +97 -81
- package/src/events/Emitter.ts +37 -10
- package/src/events/helix/helpers.ts +24 -19
- package/src/graphql/GraphQLEngine.ts +91 -14
- package/src/helpers/MessageBuilder.ts +4 -2
- package/src/helpers/errors.ts +16 -0
- package/src/helpers/napi-loader.ts +3 -2
- package/src/http/Exception.ts +17 -2
- package/src/http/HttpContext.ts +34 -5
- package/src/http/RedirectBuilder.ts +51 -37
- package/src/http/Request.ts +102 -58
- package/src/http/Response.ts +15 -7
- package/src/http/SseStream.ts +6 -7
- package/src/http/permissions.ts +47 -0
- package/src/http-client/HttpClient.ts +505 -0
- package/src/http-client/addresses.ts +58 -0
- package/src/http-client/fake.ts +141 -0
- package/src/http-client/index.ts +21 -0
- package/src/index.ts +6 -1
- package/src/middleware/Pipeline.ts +7 -3
- package/src/native/generated.ts +106 -48
- package/src/profiler/Profiler.ts +4 -1
- package/src/profiler/client/toolbar.css +595 -0
- package/src/profiler/client/toolbar.js +1299 -0
- package/src/profiler/client.generated.ts +7 -0
- package/src/profiler/collectors.ts +156 -19
- package/src/profiler/endpoint.ts +27 -1
- package/src/profiler/index.ts +17 -3
- package/src/profiler/middleware.ts +74 -9
- package/src/profiler/preview.ts +104 -0
- package/src/profiler/toolbar.ts +28 -91
- package/src/profiler/types.ts +6 -1
- package/src/router/Router.ts +136 -13
- package/src/rpc/RpcProvider.ts +10 -1
- package/src/rpc/RpcRouter.ts +129 -45
- package/src/scheduler/Scheduler.ts +1 -1
- package/src/scheduler/locks/RedisLockBackend.ts +12 -4
- package/src/security/CookieSigner.ts +30 -8
- package/src/security/SignedUrl.ts +18 -17
- package/src/server/Server.ts +60 -12
- package/src/server/nativeGrpc.ts +59 -0
- package/src/server/nativeLimits.ts +111 -0
- package/src/session/Session.ts +29 -4
- package/src/session/SessionMiddleware.ts +30 -10
- package/src/session/config.ts +7 -0
- package/src/session/drivers/MemoryDriver.ts +26 -7
- package/src/session/errors.ts +31 -0
- package/src/session/templateTags.ts +57 -0
- package/src/storage/StaticMiddleware.ts +46 -27
- package/src/testing/ApiResponse.ts +7 -1
- package/src/testing/TestClient.ts +14 -5
- package/src/utils/Macroable.ts +2 -2
- package/scripts/build-napi-types.mjs +0 -69
- package/scripts/copy-napi.mjs +0 -121
- package/scripts/generate-mime.mjs +0 -119
- package/scripts/generate-napi-types.mjs +0 -187
|
@@ -8,31 +8,39 @@
|
|
|
8
8
|
* response.redirect().withQs({ page: '2' }).toPath('/results')
|
|
9
9
|
* response.redirect().toRoute('posts.show', { id: '42' })
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* AdonisJS `isValidRedirectUrl`: a relative path, or an absolute URL whose host
|
|
13
|
+
* is the request authority or an allowed host.
|
|
14
|
+
*/
|
|
15
|
+
function isTrustedRedirect(url, authority, allowedHosts) {
|
|
12
16
|
// A relative path is trusted only when it starts with a single "/" and has no
|
|
13
17
|
// backslash: browsers normalise "\" to "/", so "/\evil.com" would become the
|
|
14
18
|
// protocol-relative "//evil.com" that a lone `!startsWith("//")` check misses.
|
|
15
|
-
if (
|
|
19
|
+
if (url.startsWith('/') && !url.startsWith('//') && !url.includes('\\'))
|
|
16
20
|
return true;
|
|
17
|
-
let
|
|
21
|
+
let parsed;
|
|
18
22
|
try {
|
|
19
|
-
|
|
23
|
+
parsed = new URL(url);
|
|
20
24
|
}
|
|
21
25
|
catch {
|
|
22
26
|
return false;
|
|
23
27
|
}
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
if (
|
|
27
|
-
return true;
|
|
28
|
-
if (!requestUrl)
|
|
29
|
-
return false;
|
|
30
|
-
try {
|
|
31
|
-
return ref.origin === new URL(requestUrl).origin;
|
|
32
|
-
}
|
|
33
|
-
catch {
|
|
28
|
+
// Only a web URL is a redirect target: `javascript://app.test/%0aalert(1)`
|
|
29
|
+
// has the right host and is a script, not a page.
|
|
30
|
+
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:')
|
|
34
31
|
return false;
|
|
35
|
-
|
|
32
|
+
if (allowedHosts.includes(parsed.host))
|
|
33
|
+
return true;
|
|
34
|
+
// Upstream accepts any absolute URL when it knows no host to compare with;
|
|
35
|
+
// refusing it is the safer reading of an attacker-controlled header.
|
|
36
|
+
return authority !== undefined && parsed.host === authority;
|
|
37
|
+
}
|
|
38
|
+
/** The query string of a path or URL, without the "?". */
|
|
39
|
+
function searchOf(url) {
|
|
40
|
+
if (url === undefined)
|
|
41
|
+
return '';
|
|
42
|
+
const index = url.indexOf('?');
|
|
43
|
+
return index === -1 ? '' : url.slice(index + 1);
|
|
36
44
|
}
|
|
37
45
|
export class RedirectBuilder {
|
|
38
46
|
/**
|
|
@@ -48,6 +56,7 @@ export class RedirectBuilder {
|
|
|
48
56
|
#forwardQs = false;
|
|
49
57
|
#requestUrl;
|
|
50
58
|
#requestReferer;
|
|
59
|
+
#requestAuthority;
|
|
51
60
|
#routeUrlResolver;
|
|
52
61
|
#session;
|
|
53
62
|
#isAjax = false;
|
|
@@ -56,6 +65,7 @@ export class RedirectBuilder {
|
|
|
56
65
|
this.#response = response;
|
|
57
66
|
this.#requestUrl = options?.requestUrl;
|
|
58
67
|
this.#requestReferer = options?.requestReferer;
|
|
68
|
+
this.#requestAuthority = options?.requestAuthority;
|
|
59
69
|
this.#routeUrlResolver = options?.routeUrlResolver;
|
|
60
70
|
this.#session = options?.session;
|
|
61
71
|
this.#isAjax = options?.isAjax ?? false;
|
|
@@ -104,14 +114,9 @@ export class RedirectBuilder {
|
|
|
104
114
|
#safeIntended(intended, fallback) {
|
|
105
115
|
if (!intended)
|
|
106
116
|
return fallback;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// A protocol-relative `//evil.com` is absolute to a browser even though it
|
|
111
|
-
// looks relative — reject it whether or not a request URL is known.
|
|
112
|
-
if (intended.startsWith('//'))
|
|
113
|
-
return fallback;
|
|
114
|
-
return intended;
|
|
117
|
+
return isTrustedRedirect(intended, this.#requestAuthority, this.allowedHosts)
|
|
118
|
+
? intended
|
|
119
|
+
: fallback;
|
|
115
120
|
}
|
|
116
121
|
/** Set redirect status code. */
|
|
117
122
|
status(code) {
|
|
@@ -142,7 +147,11 @@ export class RedirectBuilder {
|
|
|
142
147
|
}
|
|
143
148
|
/** Redirect to an absolute or relative path. */
|
|
144
149
|
toPath(path) {
|
|
145
|
-
|
|
150
|
+
this.#send(path, searchOf(this.#requestUrl));
|
|
151
|
+
}
|
|
152
|
+
/** Redirect with `withQs()` forwarding `forwardedSearch` (a query string without "?"). */
|
|
153
|
+
#send(path, forwardedSearch) {
|
|
154
|
+
const url = this.#appendQs(path, forwardedSearch);
|
|
146
155
|
this.#response.status(this.#status);
|
|
147
156
|
this.#response.header('location', url);
|
|
148
157
|
this.#response.setBody('');
|
|
@@ -156,12 +165,13 @@ export class RedirectBuilder {
|
|
|
156
165
|
this.toPath(path);
|
|
157
166
|
}
|
|
158
167
|
/**
|
|
159
|
-
* Redirect back to the previous page (
|
|
160
|
-
*
|
|
161
|
-
*
|
|
168
|
+
* Redirect back to the previous page (AdonisJS `back`): the path of
|
|
169
|
+
* {@link getPreviousUrl}, so the redirect never leaves the site; `withQs()`
|
|
170
|
+
* forwards the previous page's query string, not the current request's.
|
|
162
171
|
*/
|
|
163
172
|
back(fallback = '/') {
|
|
164
|
-
|
|
173
|
+
const previous = new URL(this.getPreviousUrl(fallback), 'http://localhost');
|
|
174
|
+
this.#send(previous.pathname, previous.search.slice(1));
|
|
165
175
|
}
|
|
166
176
|
/**
|
|
167
177
|
* Where "back" goes (AdonisJS `getPreviousUrl`).
|
|
@@ -173,7 +183,7 @@ export class RedirectBuilder {
|
|
|
173
183
|
*/
|
|
174
184
|
getPreviousUrl(fallback = '/') {
|
|
175
185
|
const referer = this.#requestReferer;
|
|
176
|
-
if (referer &&
|
|
186
|
+
if (referer && isTrustedRedirect(referer, this.#requestAuthority, this.allowedHosts)) {
|
|
177
187
|
return referer;
|
|
178
188
|
}
|
|
179
189
|
return fallback;
|
|
@@ -183,15 +193,11 @@ export class RedirectBuilder {
|
|
|
183
193
|
* uses, so `withQs()` plus `withQs('page', 2)` overrides an inbound `page`
|
|
184
194
|
* rather than being overridden by it.
|
|
185
195
|
*/
|
|
186
|
-
#appendQs(path) {
|
|
196
|
+
#appendQs(path, forwardedSearch) {
|
|
187
197
|
const params = new URLSearchParams();
|
|
188
|
-
if (this.#forwardQs
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
for (const [key, value] of new URLSearchParams(this.#requestUrl.slice(qsIdx + 1))) {
|
|
192
|
-
params.append(key, value);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
198
|
+
if (this.#forwardQs) {
|
|
199
|
+
for (const [key, value] of new URLSearchParams(forwardedSearch))
|
|
200
|
+
params.append(key, value);
|
|
195
201
|
}
|
|
196
202
|
for (const [key, value] of Object.entries(this.#qs)) {
|
|
197
203
|
if (value === undefined || value === null)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RedirectBuilder.js","sourceRoot":"","sources":["../../src/http/RedirectBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,SAAS,
|
|
1
|
+
{"version":3,"file":"RedirectBuilder.js","sourceRoot":"","sources":["../../src/http/RedirectBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH;;;GAGG;AACH,SAAS,iBAAiB,CACxB,GAAW,EACX,SAA6B,EAC7B,YAA+B;IAE/B,8EAA8E;IAC9E,6EAA6E;IAC7E,+EAA+E;IAC/E,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IACpF,IAAI,MAAW,CAAA;IACf,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAA;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;IACD,2EAA2E;IAC3E,kDAAkD;IAClD,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC7E,IAAI,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IACnD,2EAA2E;IAC3E,qEAAqE;IACrE,OAAO,SAAS,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,CAAA;AAC7D,CAAC;AAED,0DAA0D;AAC1D,SAAS,QAAQ,CAAC,GAAuB;IACvC,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,EAAE,CAAA;IAChC,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAC9B,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EA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AAA;QAChC,CAAC;QACD,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAA;QAC5B,IAAI,CAAC,EAAE;YAAE,OAAO,IAAI,CAAA;QACpB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,EAAE,EAAE,CAAA;IAC/D,CAAC;CACF"}
|
package/dist/http/Request.d.ts
CHANGED
|
@@ -27,6 +27,26 @@ export interface RawRequest {
|
|
|
27
27
|
* `ip()` accessor falls back to legacy header parsing.
|
|
28
28
|
*/
|
|
29
29
|
ip?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The trusted address chain, closest hop first — the socket peer, then each
|
|
32
|
+
* `X-Forwarded-For` entry the Rust layer walked right to left while the hop
|
|
33
|
+
* before it was a trusted proxy. Its last entry is {@link ip}. Absent in
|
|
34
|
+
* hand-built fixtures, where the chain is the peer alone.
|
|
35
|
+
*/
|
|
36
|
+
ips?: string[];
|
|
37
|
+
/**
|
|
38
|
+
* Whether the socket peer is one of the trusted proxies configured with
|
|
39
|
+
* `server.trustedProxies()`, as the Rust layer decided against the same
|
|
40
|
+
* list that resolves {@link ip}. Absent in hand-built fixtures: untrusted.
|
|
41
|
+
*/
|
|
42
|
+
peerTrusted?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The body was over its content type's limit (`config/bodyparser.ts`): the
|
|
45
|
+
* Rust layer did not keep it, and `body` is empty. Reading the body then
|
|
46
|
+
* throws `E_REQUEST_ENTITY_TOO_LARGE` instead of handing back nothing as if
|
|
47
|
+
* nothing had been sent.
|
|
48
|
+
*/
|
|
49
|
+
bodyTooLarge?: boolean;
|
|
30
50
|
/**
|
|
31
51
|
* Connection scheme as seen by the server (`http`/`https`), when the Rust
|
|
32
52
|
* layer ships it. Defaults to `http` in `protocol()` when absent; the
|
|
@@ -167,13 +187,6 @@ export declare class Request extends Macroable {
|
|
|
167
187
|
* desired resolved value.
|
|
168
188
|
*/
|
|
169
189
|
ip(): string;
|
|
170
|
-
/**
|
|
171
|
-
* Enable/disable trusting proxy headers (`X-Forwarded-Proto`/`-Host`/`-For`)
|
|
172
|
-
* for `protocol()`/`host()`/`ips()`. OFF by default — turning it on when the
|
|
173
|
-
* app is NOT behind a trusted proxy lets clients spoof their scheme/host/IP,
|
|
174
|
-
* so it's an explicit opt-in (same stance as {@link setMethodSpoofing}).
|
|
175
|
-
*/
|
|
176
|
-
setTrustProxy(enabled: boolean): void;
|
|
177
190
|
/**
|
|
178
191
|
* The HTTP/2 `:authority` pseudo-header, falling back to `Host` (AdonisJS
|
|
179
192
|
* `authority`).
|
|
@@ -187,22 +200,27 @@ export declare class Request extends Macroable {
|
|
|
187
200
|
authority(): string | null;
|
|
188
201
|
/**
|
|
189
202
|
* The request host including port (AdonisJS `host`). Honours
|
|
190
|
-
* `X-Forwarded-Host` ONLY when
|
|
191
|
-
* header. Returns null when
|
|
203
|
+
* `X-Forwarded-Host` ONLY when the request came through a trusted proxy (see
|
|
204
|
+
* `server.trustedProxies()`); otherwise the `Host` header. Returns null when
|
|
205
|
+
* neither is present.
|
|
192
206
|
*/
|
|
193
207
|
host(): string | null;
|
|
194
208
|
/**
|
|
195
|
-
* The request protocol — `http` or `https` (AdonisJS `protocol`).
|
|
196
|
-
* `
|
|
197
|
-
*
|
|
209
|
+
* The request protocol — `http` or `https` (AdonisJS `protocol`). A TLS
|
|
210
|
+
* connection is `https` whatever the headers say. Otherwise
|
|
211
|
+
* `X-Forwarded-Proto` is honoured only when the request came through a
|
|
212
|
+
* trusted proxy (see `server.trustedProxies()`), and the connection scheme
|
|
213
|
+
* the Rust layer reported (defaulting to `http`) is used when it is not.
|
|
198
214
|
*/
|
|
199
215
|
protocol(): string;
|
|
200
216
|
/** True when the request protocol is `https` (AdonisJS `secure`). */
|
|
201
217
|
secure(): boolean;
|
|
202
218
|
/**
|
|
203
|
-
* The
|
|
204
|
-
* `X-Forwarded-For`
|
|
205
|
-
*
|
|
219
|
+
* The trusted address chain, closest hop first (AdonisJS `ips`): the socket
|
|
220
|
+
* peer, then each `X-Forwarded-For` hop a trusted proxy vouched for. The
|
|
221
|
+
* last entry is {@link ip}. Hops added by an untrusted peer are not in it —
|
|
222
|
+
* the Rust layer stops at the first address it does not trust, so the chain
|
|
223
|
+
* goes past the peer only when {@link peerTrusted} holds.
|
|
206
224
|
*/
|
|
207
225
|
ips(): string[];
|
|
208
226
|
/** The request hostname without port (AdonisJS `hostname`), or null. */
|
|
@@ -282,9 +300,16 @@ export declare class Request extends Macroable {
|
|
|
282
300
|
* `purpose`. Returns false without an APP_KEY-backed signer.
|
|
283
301
|
*/
|
|
284
302
|
hasValidSignature(purpose?: string): boolean;
|
|
285
|
-
/**
|
|
303
|
+
/**
|
|
304
|
+
* Get the raw body as a string (decoded from base64 if binary). Throws
|
|
305
|
+
* `E_REQUEST_ENTITY_TOO_LARGE` (413) when the body was over its limit: what
|
|
306
|
+
* the server kept of it is nothing, and nothing is not the body.
|
|
307
|
+
*/
|
|
286
308
|
raw(): string;
|
|
287
|
-
/**
|
|
309
|
+
/**
|
|
310
|
+
* Get the raw body as a Buffer (preserves binary integrity for file uploads).
|
|
311
|
+
* Throws `E_REQUEST_ENTITY_TOO_LARGE` (413) when the body was over its limit.
|
|
312
|
+
*/
|
|
288
313
|
rawBuffer(): Buffer;
|
|
289
314
|
/** Get a single request header (case-insensitive), or `defaultValue` when absent. */
|
|
290
315
|
header(key: string): string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Request.d.ts","sourceRoot":"","sources":["../../src/http/Request.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,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EAAE,aAAa,GAAG,IAAI;IAOhE,+CAA+C;IAC/C,KAAK,CACH,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,OAAO,gCAAgC,EAAE,qBAAqB,GACvE,OAAO,gCAAgC,EAAE,aAAa,EAAE;IAQ3D,8BAA8B;IAC9B,QAAQ,IAAI,GAAG,CAAC,MAAM,EAAE,OAAO,gCAAgC,EAAE,aAAa,EAAE,CAAC;IAIjF;;;;;;OAMG;IACH,SAAS,IAAI,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,GAAG,SAAS;IAI7D,6DAA6D;IAC7D,QAAQ,CAAC,KAAK,EAAE,OAAO,gCAAgC,EAAE,aAAa,EAAE,GAAG,IAAI;IAW/E,uEAAuE;IACvE,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI;IAKxC;;;;;;;OAOG;IACH,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI;IAKrC;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI;IAMnC;;;;OAIG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIpC;;;OAGG;IACH,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAIjC;;;;;;OAMG;IACH,SAAS,IAAI,OAAO;CAyCrB"}
|
package/dist/http/Request.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { parseQueryString } from '../bodyparser/qsParse.js';
|
|
10
10
|
import { Macroable } from '../utils/Macroable.js';
|
|
11
11
|
import { getPath, omitPaths, pickPaths } from '../utils/objectPath.js';
|
|
12
|
+
import { Exception } from './Exception.js';
|
|
12
13
|
import { RequestValidator } from './RequestValidator.js';
|
|
13
14
|
import { unpackCookieValue } from './Response.js';
|
|
14
15
|
export class Request extends Macroable {
|
|
@@ -17,7 +18,6 @@ export class Request extends Macroable {
|
|
|
17
18
|
#cookieSigner;
|
|
18
19
|
#signedUrl;
|
|
19
20
|
#allowMethodSpoofing = false;
|
|
20
|
-
#trustProxy = false;
|
|
21
21
|
#routeInfo;
|
|
22
22
|
#response;
|
|
23
23
|
#parsedBody;
|
|
@@ -173,13 +173,17 @@ export class Request extends Macroable {
|
|
|
173
173
|
return this.#raw.remoteAddr ?? '127.0.0.1';
|
|
174
174
|
}
|
|
175
175
|
/**
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
176
|
+
* Whether the socket peer is one of the trusted proxies configured with
|
|
177
|
+
* `server.trustedProxies()` — the condition under which `X-Forwarded-Proto`
|
|
178
|
+
* and `X-Forwarded-Host` are believed by {@link protocol} and {@link host}.
|
|
179
|
+
*
|
|
180
|
+
* The decision is the Rust layer's (`peerTrusted`), made once per request
|
|
181
|
+
* against the same list that resolves {@link ip}, so a trusted proxy that
|
|
182
|
+
* forwards the scheme or host without an `X-Forwarded-For` is believed too.
|
|
183
|
+
* A request without the flag — a hand-built fixture — is untrusted.
|
|
180
184
|
*/
|
|
181
|
-
|
|
182
|
-
this.#
|
|
185
|
+
#peerIsTrustedProxy() {
|
|
186
|
+
return this.#raw.peerTrusted === true;
|
|
183
187
|
}
|
|
184
188
|
/**
|
|
185
189
|
* The HTTP/2 `:authority` pseudo-header, falling back to `Host` (AdonisJS
|
|
@@ -199,11 +203,12 @@ export class Request extends Macroable {
|
|
|
199
203
|
}
|
|
200
204
|
/**
|
|
201
205
|
* The request host including port (AdonisJS `host`). Honours
|
|
202
|
-
* `X-Forwarded-Host` ONLY when
|
|
203
|
-
* header. Returns null when
|
|
206
|
+
* `X-Forwarded-Host` ONLY when the request came through a trusted proxy (see
|
|
207
|
+
* `server.trustedProxies()`); otherwise the `Host` header. Returns null when
|
|
208
|
+
* neither is present.
|
|
204
209
|
*/
|
|
205
210
|
host() {
|
|
206
|
-
if (this.#
|
|
211
|
+
if (this.#peerIsTrustedProxy()) {
|
|
207
212
|
const forwarded = this.#raw.headers['x-forwarded-host'];
|
|
208
213
|
// The first hop in the list, named rather than indexed: `split` always
|
|
209
214
|
// yields one element, and saying so beats being told it might not.
|
|
@@ -214,12 +219,16 @@ export class Request extends Macroable {
|
|
|
214
219
|
return this.#raw.headers.host ?? null;
|
|
215
220
|
}
|
|
216
221
|
/**
|
|
217
|
-
* The request protocol — `http` or `https` (AdonisJS `protocol`).
|
|
218
|
-
* `
|
|
219
|
-
*
|
|
222
|
+
* The request protocol — `http` or `https` (AdonisJS `protocol`). A TLS
|
|
223
|
+
* connection is `https` whatever the headers say. Otherwise
|
|
224
|
+
* `X-Forwarded-Proto` is honoured only when the request came through a
|
|
225
|
+
* trusted proxy (see `server.trustedProxies()`), and the connection scheme
|
|
226
|
+
* the Rust layer reported (defaulting to `http`) is used when it is not.
|
|
220
227
|
*/
|
|
221
228
|
protocol() {
|
|
222
|
-
if (this.#
|
|
229
|
+
if (this.#raw.scheme === 'https')
|
|
230
|
+
return 'https';
|
|
231
|
+
if (this.#peerIsTrustedProxy()) {
|
|
223
232
|
const forwarded = this.#raw.headers['x-forwarded-proto'];
|
|
224
233
|
const [first] = forwarded?.split(',') ?? [];
|
|
225
234
|
if (first !== undefined)
|
|
@@ -232,20 +241,16 @@ export class Request extends Macroable {
|
|
|
232
241
|
return this.protocol() === 'https';
|
|
233
242
|
}
|
|
234
243
|
/**
|
|
235
|
-
* The
|
|
236
|
-
* `X-Forwarded-For`
|
|
237
|
-
*
|
|
244
|
+
* The trusted address chain, closest hop first (AdonisJS `ips`): the socket
|
|
245
|
+
* peer, then each `X-Forwarded-For` hop a trusted proxy vouched for. The
|
|
246
|
+
* last entry is {@link ip}. Hops added by an untrusted peer are not in it —
|
|
247
|
+
* the Rust layer stops at the first address it does not trust, so the chain
|
|
248
|
+
* goes past the peer only when {@link peerTrusted} holds.
|
|
238
249
|
*/
|
|
239
250
|
ips() {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
return forwarded
|
|
244
|
-
.split(',')
|
|
245
|
-
.map((value) => value.trim())
|
|
246
|
-
.filter((value) => value.length > 0);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
251
|
+
const chain = this.#raw.ips;
|
|
252
|
+
if (chain && chain.length > 0 && this.#peerIsTrustedProxy())
|
|
253
|
+
return [...chain];
|
|
249
254
|
return [this.ip()];
|
|
250
255
|
}
|
|
251
256
|
/** The request hostname without port (AdonisJS `hostname`), or null. */
|
|
@@ -334,7 +339,9 @@ export class Request extends Macroable {
|
|
|
334
339
|
}
|
|
335
340
|
encryptedCookie(name, defaultValue) {
|
|
336
341
|
const raw = this.plainCookie(name, undefined, { encoded: false });
|
|
337
|
-
|
|
342
|
+
// Decrypted for the purpose it was written under — its own name — so a
|
|
343
|
+
// value issued as another encrypted cookie is refused here.
|
|
344
|
+
const value = raw === null || !this.#cookieSigner ? null : this.#cookieSigner.decrypt(raw, name);
|
|
338
345
|
return value ?? defaultValue ?? null;
|
|
339
346
|
}
|
|
340
347
|
/** @internal Inject the APP_KEY-backed signed-URL helper — wired by HttpContext. */
|
|
@@ -354,17 +361,26 @@ export class Request extends Macroable {
|
|
|
354
361
|
// the expiry and the signature itself live in the query.
|
|
355
362
|
return this.#signedUrl.verify(this.url(true), purpose);
|
|
356
363
|
}
|
|
357
|
-
/**
|
|
364
|
+
/**
|
|
365
|
+
* Get the raw body as a string (decoded from base64 if binary). Throws
|
|
366
|
+
* `E_REQUEST_ENTITY_TOO_LARGE` (413) when the body was over its limit: what
|
|
367
|
+
* the server kept of it is nothing, and nothing is not the body.
|
|
368
|
+
*/
|
|
358
369
|
raw() {
|
|
359
370
|
if (this.#rawBodyOverride !== undefined)
|
|
360
371
|
return this.#rawBodyOverride;
|
|
372
|
+
this.#assertBodyKept();
|
|
361
373
|
if (this.#raw.bodyEncoding === 'base64') {
|
|
362
374
|
return Buffer.from(this.#raw.body, 'base64').toString('utf8');
|
|
363
375
|
}
|
|
364
376
|
return this.#raw.body;
|
|
365
377
|
}
|
|
366
|
-
/**
|
|
378
|
+
/**
|
|
379
|
+
* Get the raw body as a Buffer (preserves binary integrity for file uploads).
|
|
380
|
+
* Throws `E_REQUEST_ENTITY_TOO_LARGE` (413) when the body was over its limit.
|
|
381
|
+
*/
|
|
367
382
|
rawBuffer() {
|
|
383
|
+
this.#assertBodyKept();
|
|
368
384
|
if (this.#raw.bodyEncoding === 'base64') {
|
|
369
385
|
return Buffer.from(this.#raw.body, 'base64');
|
|
370
386
|
}
|
|
@@ -556,7 +572,8 @@ export class Request extends Macroable {
|
|
|
556
572
|
id: this.id(),
|
|
557
573
|
url: this.url(true),
|
|
558
574
|
query: this.parsedUrl().search?.slice(1) ?? '',
|
|
559
|
-
|
|
575
|
+
// A dump must not throw: an over-limit body is reported as absent.
|
|
576
|
+
body: this.#bodyWasDropped() ? undefined : this.body(),
|
|
560
577
|
params: this.params(),
|
|
561
578
|
headers: this.headers(),
|
|
562
579
|
method: this.method(),
|
|
@@ -564,7 +581,9 @@ export class Request extends Macroable {
|
|
|
564
581
|
cookies: this.cookies(),
|
|
565
582
|
hostname: this.hostname(),
|
|
566
583
|
ip: this.ip(),
|
|
567
|
-
|
|
584
|
+
// What the route's domain captured (`ctx.subdomains`), as upstream
|
|
585
|
+
// serialises it — not the host's labels, which `subdomains()` returns.
|
|
586
|
+
subdomains: (this.ctx === undefined ? undefined : Reflect.get(this.ctx, 'subdomains')) ?? {},
|
|
568
587
|
};
|
|
569
588
|
}
|
|
570
589
|
/** Same as {@link serialize} — what `JSON.stringify(request)` uses. */
|
|
@@ -871,38 +890,41 @@ export class Request extends Macroable {
|
|
|
871
890
|
validated() {
|
|
872
891
|
return this.#validated;
|
|
873
892
|
}
|
|
893
|
+
/** The body was over its limit and nothing has replaced it since. */
|
|
894
|
+
#bodyWasDropped() {
|
|
895
|
+
return (this.#raw.bodyTooLarge === true &&
|
|
896
|
+
this.#parsedBody === undefined &&
|
|
897
|
+
this.#rawBodyOverride === undefined);
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
900
|
+
* Refuse to read a body the server did not keep. The same 413 the body
|
|
901
|
+
* parser raises, so a route without it still answers the client properly
|
|
902
|
+
* the moment it reaches for the body — and a route that never does is not
|
|
903
|
+
* charged for it.
|
|
904
|
+
*/
|
|
905
|
+
#assertBodyKept() {
|
|
906
|
+
if (this.#raw.bodyTooLarge === true) {
|
|
907
|
+
throw new Exception('request entity too large', {
|
|
908
|
+
status: 413,
|
|
909
|
+
code: 'E_REQUEST_ENTITY_TOO_LARGE',
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* The body is whatever the body parser decided it is, and `{}` when no
|
|
915
|
+
* parser claimed it. Nothing is parsed here: a JSON body is only JSON when
|
|
916
|
+
* its Content-Type says so. Reading any body as JSON let a foreign page
|
|
917
|
+
* drive a JSON route with a CORS simple request (no Content-Type, or
|
|
918
|
+
* `text/plain`), which a browser sends cross-site with the user's cookies
|
|
919
|
+
* and without a preflight.
|
|
920
|
+
*/
|
|
874
921
|
#ensureParsedBody() {
|
|
875
922
|
if (this.#parsedBody !== undefined)
|
|
876
923
|
return;
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
this.#parsedBody = {};
|
|
880
|
-
return;
|
|
881
|
-
}
|
|
882
|
-
try {
|
|
883
|
-
const parsed = JSON.parse(raw);
|
|
884
|
-
this.#parsedBody = isPlainObject(parsed) ? parsed : { _body: parsed };
|
|
885
|
-
}
|
|
886
|
-
catch {
|
|
887
|
-
this.#parsedBody = {};
|
|
888
|
-
}
|
|
924
|
+
this.#assertBodyKept();
|
|
925
|
+
this.#parsedBody = {};
|
|
889
926
|
}
|
|
890
927
|
}
|
|
891
|
-
/** Parse a query string (key=value&key2=value2) into an object. */
|
|
892
|
-
/**
|
|
893
|
-
* Test whether an IPv4 address is within a CIDR range. Bare IP entries
|
|
894
|
-
* (`10.0.0.42`) are accepted as `/32`. IPv6 falls back to string equality
|
|
895
|
-
* — a full v6 implementation isn't required by the current security tests.
|
|
896
|
-
*/
|
|
897
|
-
/**
|
|
898
|
-
* Type guard for plain JSON-decoded objects. Excludes `null` (which is
|
|
899
|
-
* `typeof === 'object'`) and arrays so consumers can index by string key
|
|
900
|
-
* without a separate runtime check.
|
|
901
|
-
*/
|
|
902
|
-
function isPlainObject(value) {
|
|
903
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
904
|
-
}
|
|
905
|
-
/** True for an IPv4 dotted-quad or a (bracketed) IPv6 literal — hosts with no subdomains. */
|
|
906
928
|
/**
|
|
907
929
|
* Headers whose VALUE is a credential. Listing them is useful; printing them
|
|
908
930
|
* hands whoever reads the log a working key.
|