Skip to content

fix(auth0-express): tolerate a missing body parser in backchannel logout - #27

Closed
frederikprijck wants to merge 1 commit into
fix/sdk-4-sanitize-handler-errorsfrom
fix/sdk-9-fail-safe-nits
Closed

fix(auth0-express): tolerate a missing body parser in backchannel logout#27
frederikprijck wants to merge 1 commit into
fix/sdk-4-sanitize-handler-errorsfrom
fix/sdk-9-fail-safe-nits

Conversation

@frederikprijck

@frederikprijck frederikprijck commented Jul 9, 2026

Copy link
Copy Markdown
Member

Summary

The backchannel-logout handler read req.body.logout_token directly. If the handler is reached without a body parser mounted, req.body is undefined and that access throws a TypeError, surfacing as a 500 instead of the intended 400 missing-logout_token response.

This reads req.body?.logout_token so the missing-body case falls through to the existing 400 path.

Changes

  • backchannel-logout-handler.ts: req.body.logout_tokenreq.body?.logout_token
  • backchannel-logout-handler.spec.ts: regression test asserting a 400 (not 500) when no body parser is mounted. Verified to fail without the fix.

Context

This PR was originally the combined SDK-9 fail-safe PR. It has been split: the require-auth half (independent of the SDK-4 work) now lives in #44 against main. This PR is now scoped to the backchannel-logout fail-safe fix only and stays based on fix/sdk-4-sanitize-handler-errors (#26), since it touches the same handler.

Read req.body?.logout_token so a request that reaches the handler without a
body parser mounted (req.body undefined) hits the intended 400
missing-logout_token path instead of throwing a TypeError, which would
otherwise surface as a 500.

SECURITY: SDK-9 — fail-safe hardening (CWE-248).
@frederikprijck
frederikprijck force-pushed the fix/sdk-9-fail-safe-nits branch from ec7923e to a55928f Compare August 25, 2026 12:39
@frederikprijck frederikprijck changed the title fix: fail-safe robustness nits in logout handler and require-auth fix(auth0-express): tolerate a missing body parser in backchannel logout Aug 25, 2026
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