Skip to content

fix(auth0-express): stop leaking internal error detail from handlers#26

Open
frederikprijck wants to merge 1 commit into
mainfrom
fix/sdk-4-sanitize-handler-errors
Open

fix(auth0-express): stop leaking internal error detail from handlers#26
frederikprijck wants to merge 1 commit into
mainfrom
fix/sdk-4-sanitize-handler-errors

Conversation

@frederikprijck

@frederikprijck frederikprijck commented Jul 9, 2026

Copy link
Copy Markdown
Member

Summary

The auth handlers echoed error.name/error.message (and error.cause.error_description) verbatim in HTTP responses, leaking internal/library error detail useful for probing the auth flow.

Changes

All four handlers (login, callback, logout, backchannel-logout) now route failures through Express's next(error) instead of writing error detail to the response. Express's error middleware owns the response; the SDK no longer authors the leak. Handler signatures gained a next param, threaded through the router.

Note: this changes the public error-response contract. Apps that want OAuth error codes should mount their own error handler. See the new Error Handling section in the README — internal detail is only fully suppressed when NODE_ENV=production and/or a custom error handler is mounted, per Express's default behavior.

Tests

Handler + index specs updated to the sanitized contract. The error-leak tests run under NODE_ENV=production (matching Express's real sanitization behavior) and were verified via a leak-revert to genuinely fail if a handler leaks. auth0-express suite: 185/185 pass.

Route handler failures through next(error) instead of echoing
error.name/message/error_description to the client, so Express error
middleware owns the response and internal detail is not disclosed.

SECURITY: SDK-4 — verbose error messages (CWE-209).
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