@remix-run/server-runtime
Advanced tools
| export declare function throwIfPotentialCSRFAttack(headers: Headers): void; |
| /** | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
| * Copyright (c) Remix Software Inc. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE.md file in the root directory of this source tree. | ||
| * | ||
| * @license MIT | ||
| */ | ||
| 'use strict'; | ||
| Object.defineProperty(exports, '__esModule', { value: true }); | ||
| function throwIfPotentialCSRFAttack(headers) { | ||
| let originHeader = headers.get("origin"); | ||
| let originDomain = typeof originHeader === "string" && originHeader !== "null" ? new URL(originHeader).host : originHeader; | ||
| let host = parseHostHeader(headers); | ||
| if (originDomain && (!host || originDomain !== host.value)) { | ||
| if (host) { | ||
| // This seems to be an CSRF attack. We should not proceed with the action. | ||
| throw new Error(`${host.type} header does not match \`origin\` header from a forwarded ` + `action request. Aborting the action.`); | ||
| } else { | ||
| // This is an attack. We should not proceed with the action. | ||
| throw new Error("`x-forwarded-host` or `host` headers are not provided. One of these " + "is needed to compare the `origin` header from a forwarded action " + "request. Aborting the action."); | ||
| } | ||
| } | ||
| } | ||
| function parseHostHeader(headers) { | ||
| var _forwardedHostHeader$; | ||
| let forwardedHostHeader = headers.get("x-forwarded-host"); | ||
| let forwardedHostValue = forwardedHostHeader === null || forwardedHostHeader === void 0 ? void 0 : (_forwardedHostHeader$ = forwardedHostHeader.split(",")[0]) === null || _forwardedHostHeader$ === void 0 ? void 0 : _forwardedHostHeader$.trim(); | ||
| let hostHeader = headers.get("host"); | ||
| return forwardedHostValue ? { | ||
| type: "x-forwarded-host", | ||
| value: forwardedHostValue | ||
| } : hostHeader ? { | ||
| type: "host", | ||
| value: hostHeader | ||
| } : undefined; | ||
| } | ||
| exports.throwIfPotentialCSRFAttack = throwIfPotentialCSRFAttack; |
| /** | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
| * Copyright (c) Remix Software Inc. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE.md file in the root directory of this source tree. | ||
| * | ||
| * @license MIT | ||
| */ | ||
| function throwIfPotentialCSRFAttack(headers) { | ||
| let originHeader = headers.get("origin"); | ||
| let originDomain = typeof originHeader === "string" && originHeader !== "null" ? new URL(originHeader).host : originHeader; | ||
| let host = parseHostHeader(headers); | ||
| if (originDomain && (!host || originDomain !== host.value)) { | ||
| if (host) { | ||
| // This seems to be an CSRF attack. We should not proceed with the action. | ||
| throw new Error(`${host.type} header does not match \`origin\` header from a forwarded ` + `action request. Aborting the action.`); | ||
| } else { | ||
| // This is an attack. We should not proceed with the action. | ||
| throw new Error("`x-forwarded-host` or `host` headers are not provided. One of these " + "is needed to compare the `origin` header from a forwarded action " + "request. Aborting the action."); | ||
| } | ||
| } | ||
| } | ||
| function parseHostHeader(headers) { | ||
| var _forwardedHostHeader$; | ||
| let forwardedHostHeader = headers.get("x-forwarded-host"); | ||
| let forwardedHostValue = forwardedHostHeader === null || forwardedHostHeader === void 0 ? void 0 : (_forwardedHostHeader$ = forwardedHostHeader.split(",")[0]) === null || _forwardedHostHeader$ === void 0 ? void 0 : _forwardedHostHeader$.trim(); | ||
| let hostHeader = headers.get("host"); | ||
| return forwardedHostValue ? { | ||
| type: "x-forwarded-host", | ||
| value: forwardedHostValue | ||
| } : hostHeader ? { | ||
| type: "host", | ||
| value: hostHeader | ||
| } : undefined; | ||
| } | ||
| export { throwIfPotentialCSRFAttack }; |
+1
-1
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
+1
-1
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
+1
-1
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
+1
-1
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
+1
-1
@@ -44,3 +44,3 @@ import type { StaticHandlerContext } from "@remix-run/router"; | ||
| */ | ||
| export declare function sanitizeError<T = unknown>(error: T, serverMode: ServerMode): T | Error; | ||
| export declare function sanitizeError<T = unknown>(error: T, serverMode: ServerMode): Error | T; | ||
| export declare function sanitizeErrors(errors: NonNullable<StaticHandlerContext["errors"]>, serverMode: ServerMode): {}; | ||
@@ -47,0 +47,0 @@ export type SerializedError = { |
+1
-1
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
+1
-1
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
+1
-1
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
+1
-1
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -24,2 +24,3 @@ * Copyright (c) Remix Software Inc. | ||
| import { resourceRouteJsonWarning } from './deprecations.js'; | ||
| import { throwIfPotentialCSRFAttack } from './actions.js'; | ||
@@ -310,2 +311,5 @@ // Do not include a response body if the status code is one of these, | ||
| try { | ||
| if (request.method === "POST") { | ||
| throwIfPotentialCSRFAttack(request.headers); | ||
| } | ||
| context = await staticHandler.query(request, { | ||
@@ -312,0 +316,0 @@ requestContext: loadContext |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -17,2 +17,3 @@ * Copyright (c) Remix Software Inc. | ||
| import { isResponse, isRedirectStatusCode } from './responses.js'; | ||
| import { throwIfPotentialCSRFAttack } from './actions.js'; | ||
@@ -49,2 +50,3 @@ const SingleFetchRedirectSymbol = Symbol("SingleFetchRedirect"); | ||
| try { | ||
| throwIfPotentialCSRFAttack(request.headers); | ||
| let handlerRequest = new Request(handlerUrl, { | ||
@@ -51,0 +53,0 @@ method: request.method, |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
+1
-1
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
+1
-1
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
+1
-1
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
+1
-1
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
+1
-1
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
+1
-1
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
+5
-1
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -28,2 +28,3 @@ * Copyright (c) Remix Software Inc. | ||
| var deprecations = require('./deprecations.js'); | ||
| var actions = require('./actions.js'); | ||
@@ -314,2 +315,5 @@ // Do not include a response body if the status code is one of these, | ||
| try { | ||
| if (request.method === "POST") { | ||
| actions.throwIfPotentialCSRFAttack(request.headers); | ||
| } | ||
| context = await staticHandler.query(request, { | ||
@@ -316,0 +320,0 @@ requestContext: loadContext |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
+1
-1
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -21,2 +21,3 @@ * Copyright (c) Remix Software Inc. | ||
| var responses = require('./responses.js'); | ||
| var actions = require('./actions.js'); | ||
@@ -53,2 +54,3 @@ const SingleFetchRedirectSymbol = Symbol("SingleFetchRedirect"); | ||
| try { | ||
| actions.throwIfPotentialCSRFAttack(request.headers); | ||
| let handlerRequest = new Request(handlerUrl, { | ||
@@ -55,0 +57,0 @@ method: request.method, |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
+1
-1
| /** | ||
| * @remix-run/server-runtime v2.17.2 | ||
| * @remix-run/server-runtime v2.17.3 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
+1
-1
| { | ||
| "name": "@remix-run/server-runtime", | ||
| "version": "2.17.2", | ||
| "version": "2.17.3", | ||
| "description": "Server runtime for Remix", | ||
@@ -5,0 +5,0 @@ "bugs": { |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
281713
1.47%89
3.49%5435
1.7%