Files
zitadel/apps
a4266fa7fc Merge commit from fork
* fix(login): strip returnCode from browser supplied session challenges

The updateOrCreateSession server action forwarded the browser's challenges
object to the session API verbatim and returned the resulting challenges in its
response. A party who knew only a victim's login name could create an
identify-only session, request OTP-Email and OTP-SMS challenges with the
returnCode delivery type, and read both plaintext codes straight out of the
server action response.

sanitizeChallenges forces returnCode off before anything is forwarded. It is
applied in createSessionAndUpdateCookie and setSessionAndUpdateCookie rather
than in the action itself, so every caller including sendPasskey is covered by
one gate. An OTP-Email returnCode request is rewritten to sendCode rather than
dropped, so the legitimate flow still completes and the code is delivered to the
user; WebAuthN challenges carry no code and pass through untouched.

The action response is also narrowed to the WebAuthN challenge. That is
redundant while the sanitizer holds, but it keeps "no OTP code crosses this
boundary" a local, readable property.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(login): assert session challenges are sanitized before reaching the API

challenges.test.ts covers what sanitizeChallenges does, but nothing asserted
that cookie.ts actually calls it. A refactor could drop either call site and the
whole suite would still pass, silently reopening the hole.

Covers both entry points to the session API by asserting on the challenges the
mocked client receives, so the test fails if the sanitizer is ever bypassed.

Co-Authored-By: Claude Opus 5 <[email protected]>

---------

Co-authored-by: Claude Opus 5 <[email protected]>
2026-08-14 06:12:33 +02:00
..
2026-08-14 06:12:33 +02:00