Skip to content

fix(email-oauth): do not follow redirects when sending the client secret to the token URL - #525

Merged
prathameshkurunkar7 merged 2 commits into
frappe:developfrom
RitvikSardana:fix/email-oauth-no-redirects
Oct 22, 2026
Merged

prathameshkurunkar7 merged 2 commits into
frappe:developfrom
RitvikSardana:fix/email-oauth-no-redirects

Conversation

@RitvikSardana

@RitvikSardana RitvikSardana commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Issue:

exchange_token sends a POST request to the token URL of the Email OAuth Provider. The body of the request has the client secret. relay_token uses this request for a sign-in code and for a refresh token.

By default, requests follows a redirect. If the token URL answers with a 307 or a 308 redirect, requests sends the same POST request again to the new address. The body of that request has the client secret. Thus, a wrong token URL, or a token URL on a host that changes owner, can send the client secret to a different server.

Solution:

exchange_token now sends the request with allow_redirects=False. Central sends the client secret only to the token URL of the Email OAuth Provider. A sign-in and a token refresh work as before, because the token URL of Microsoft does not redirect.

Related to #506

@prathameshkurunkar7
prathameshkurunkar7 merged commit 17f1b00 into frappe:develop Oct 22, 2026
4 checks passed
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.

2 participants