mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-26 11:27:54 -05:00
[PR #1347] [MERGED] feat: allow authenticating with a trusted email header #7437
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/1347
Author: @cheahjs
Created: 3/28/2024
Status: ✅ Merged
Merged: 4/2/2024
Merged by: @tjbck
Base:
dev← Head:feat/trusted-email-header📝 Commits (7)
29f13f3feat: add WEBUI_AUTH_TRUSTED_EMAIL_HEADER for authenticating users by a trusted header50f6addfeat: auto signup/login with WEBUI_AUTH_TRUSTED_EMAIL_HEADER047c9fefix: styling12287f8chore: code formatting150152dfix: accidental indent during format changed logic0e3b7a1chore: python formatting562e40aMerge branch 'dev' into feat/trusted-email-header📊 Changes
9 files changed (+157 additions, -98 deletions)
View changed files
📝
Dockerfile(+1 -0)📝
backend/apps/web/main.py(+2 -1)📝
backend/apps/web/models/auths.py(+10 -0)📝
backend/apps/web/routers/auths.py(+19 -1)📝
backend/config.py(+3 -0)📝
backend/constants.py(+2 -0)📝
backend/main.py(+1 -0)📝
src/lib/components/common/Spinner.svelte(+19 -18)📝
src/routes/auth/+page.svelte(+100 -78)📄 Description
Pull Request Checklist
Description
Adds an environment variable
WEBUI_AUTH_TRUSTED_EMAIL_HEADERthat can be specified to be used as the source of a trusted email header that should be used to automatically register and sign in.Automatic sign in is achieved by adding the boolean
trusted_header_authto the result of calling/api/config. If this is set to true, the web app immediately triggers a sign in.On the backend, if the header is set, a few changes are made:
/signinwill always use the value of header specified byWEBUI_AUTH_TRUSTED_EMAIL_HEADERas the email address of the user, and we will ignore the password field/update/passwordwill return an error, since a password is useless when the header is set.It is a security hole to have
WEBUI_AUTH_TRUSTED_EMAIL_HEADERset and an authenticating reverse proxy that sets the header is not the only way to reach the backend, as a user would be able to spoof any email address in the header and gain access to that email's account.Styling of the automatic sign in page, and the error message when hitting

open-webuiwithout the necessary header.This is tangentially related to the request https://github.com/open-webui/open-webui/issues/483, but this delegates the OAuth bit to a reverse proxy and doesn't handle OAuth inside of open-webui.
Changelog Entry
Added
WEBUI_AUTH_TRUSTED_EMAIL_HEADERcan be used to authenticate users when used with an authenticating reverse proxy.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.