processing / processing/p5.js-web-editor
Raw error objects leaked in 500 responses across several controllers
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.7k
- Forks
- 1.7k
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 8
Description
p5.js version
No response
What is your operating system?
None
Web browser and version
No response
Actual Behavior
Multiple catch blocks in server controllers send the raw err object
straight into res.json(). This means stack traces, mongoose internals,
and whatever else lives on the error can end up in the response body.
Affected spots:
server/controllers/user.controller/signup.tsL79, L161 →res.status(500).json({ error: err })server/controllers/user.controller/userPreferences.tsL36, L64 → sameserver/controllers/user.controller/authManagement.tsL204 → sameserver/controllers/user.controller/helpers.tsL70 →res.status(500).json({ error })(sharedsaveUserhelper, so this one fans out)server/controllers/project.controller.jsL349 →res.status(500).json(error)— the error is the response body, no wrapping at all
Why the global error handler doesn't help here:
The fallback at server.js L199 sends a safe generic string, but it
only fires for errors passed through next(). All the spots above call
res.json() directly and never hit next(),..so the middleware is
completely bypassed.
Expected Behavior
500s should return something like { error: "Internal Server Error" }
and the real error should just be console.error'd
Steps to reproduce
Trigger any DB error in the affected routes (e.g., kill mongo mid-request, send malformed data to /preferences, etc). Check the network tab, you'll see the full error object with stack trace in the response body instead of a sanitized message
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the listed catch blocks in server/controllers/user.controller/signup.ts, userPreferences.ts, authManagement.ts, helpers.ts, and server/controllers/project.controller.js, then compare them with the fallback in server.js. Trigger a database failure and confirm affected 500 responses contain only a generic error while the real error is logged rather than serialized.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- api, backend, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100