Replies: 7 comments 1 reply
-
I'm happy to work on this bug, the question is, do we want to just remove the stack trace when in production mode, or do we want to filter out paths, etc? |
Beta Was this translation helpful? Give feedback.
-
This appears to be quite a big security issue if there is no way to suppress the stack trace in responses with uncaught errors relying on use of I need to solve this myself either through a change to the framework or by other means; perhaps adding a middleware in express to redact the stack traces. I had a quick look and I think |
Beta Was this translation helpful? Give feedback.
-
Hey! If you want to quick fix the above error, this is a snippet from the express instance I use to strip stack from the response and return 400 on incorrect app.all(
'*',
createRequestHandler({ build: require('../build'), mode: 'production' }),
(err, req, res, next) => {
if (
err.message === "Cannot read properties of undefined (reading 'params')"
) {
res.status(400).send({ error: 'bad request' });
} else {
res.status(500).send({ error: 'unexpected error occured' });
}
}
); |
Beta Was this translation helpful? Give feedback.
-
Probably not going to work so well if you want to maintain use of It's probably possible to remove stack from data and page requests (it's in appState) with a middleware and a bit of hackery. I've not looked into it yet but imagine there will be some trade offs in being able to use server components/streams. |
Beta Was this translation helpful? Give feedback.
-
Converting this to a Proposal discussion, as per our Development Process. |
Beta Was this translation helpful? Give feedback.
-
Recent versions of Remix now include a I noticed that
Other than that, it is the exact same function. So the solution looks to be to copy from |
Beta Was this translation helpful? Give feedback.
-
This should be resolved as of |
Beta Was this translation helpful? Give feedback.
-
What version of Remix are you using?
1.5.1
Steps to Reproduce
Pass an invalid parameter to the
/?_data=routes%2Fsomething_invalid
endpoint. Observe the results. Or pass an invalid POST body to delve deeper into the application stack.Expected Behavior
Need a way to disable the stack return data in production and have a more generic error returned to the client.
Actual Behavior
During testing by our security analyst, a stack trace was returned that identified the logging system in use and the open-source libraries of the application code running. This could be used by an attacker to exploit dependencies in the application the most serious of which may have zero day implications.
This line unconditionally returns the stack:
remix/packages/remix-server-runtime/errors.ts
Line 68 in 252ea6c
Beta Was this translation helpful? Give feedback.
All reactions