Skip to content

fix: keep key, params and status of app errors in error responses - #225

Merged
SteRiccio merged 12 commits into
masterfrom
fix/hide-internal-error-details
Nov 18, 2026
Merged

SteRiccio merged 12 commits into
masterfrom
fix/hide-internal-error-details

Conversation

@SteRiccio

@SteRiccio SteRiccio commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Problem

Responses.sendError (used by the error middleware, so by every route that calls next(error)) kept key, params and statusCode only for our own ServerError. Other app errors that carry a key, such as arena's SystemError, were flattened to a generic error, so the client lost the specific message.

Fix

  • Errors that carry a key (our ServerError, and also arena's SystemError) are sent with their key, params and statusCode (500 if missing).
  • Any other error is still sent as appErrors.generic with Could not serve: <error>, so users can see the details client side and share them when reporting a problem.
  • The local login strategy now also logs the error on the server before sending it to the client.

Tests

Unit tests for Responses.sendError: unexpected errors are sent as generic errors with their details; app errors keep key, params and status; unauthorized errors map to 403.

SteRiccio and others added 2 commits October 29, 2026 21:34
Unexpected errors (e.g. Postgres errors) were returned as 'Could not serve:
<error>', exposing table, column and constraint names. Errors with a key
(ServerError, arena SystemError) are still sent with their key and params.
@SteRiccio SteRiccio self-assigned this Oct 29, 2026
@SteRiccio
SteRiccio marked this pull request as draft October 29, 2026 21:24
@SteRiccio

Copy link
Copy Markdown
Member Author

Postponed: error details in the client are useful for now, to find the related log entry quickly when a user reports an error.

@SteRiccio
SteRiccio marked this pull request as ready for review November 15, 2026 20:10
@SteRiccio SteRiccio changed the title fix: do not send internal error details to clients fix: keep key, params and status of app errors in error responses Nov 18, 2026
@sonarqubecloud

Copy link
Copy Markdown

@SteRiccio
SteRiccio merged commit ab4884c into master Nov 18, 2026
8 checks passed
@SteRiccio
SteRiccio deleted the fix/hide-internal-error-details branch November 18, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant