Fix security vulnerabilities
This commit is contained in:
@@ -13,6 +13,9 @@ export default async function grabPageErrorComponent({ error, routeParams, is404
|
||||
const presetComponent = is404
|
||||
? BUNX_ROOT_404_PRESET_COMPONENT
|
||||
: BUNX_ROOT_500_PRESET_COMPONENT;
|
||||
// 404 messages only contain the requested path. Other error messages can
|
||||
// leak internals, so they are only shown in development.
|
||||
const error_message = is404 || is_dev ? error?.message : "Internal Server Error";
|
||||
const default_server_res = {
|
||||
response_options: {
|
||||
status: is404 ? 404 : 500,
|
||||
@@ -24,7 +27,7 @@ export default async function grabPageErrorComponent({ error, routeParams, is404
|
||||
const default_module = await import(presetComponent);
|
||||
const Component = default_module.default;
|
||||
const default_jsx = () => {
|
||||
return _jsx(Component, { children: _jsx("span", { children: error.message }) });
|
||||
return _jsx(Component, { children: _jsx("span", { children: error_message }) });
|
||||
};
|
||||
return {
|
||||
component: default_jsx,
|
||||
@@ -65,7 +68,7 @@ export default async function grabPageErrorComponent({ error, routeParams, is404
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
flexDirection: "column",
|
||||
}, children: [_jsx("h1", { children: is404 ? "404 Not Found" : "500 Internal Server Error" }), _jsx("span", { children: error.message })] }));
|
||||
}, children: [_jsx("h1", { children: is404 ? "404 Not Found" : "500 Internal Server Error" }), _jsx("span", { children: error_message })] }));
|
||||
return {
|
||||
component: DefaultNotFound,
|
||||
routeParams,
|
||||
|
||||
Reference in New Issue
Block a user