fix:image url validation and signout post (#24420)
* refac(routers): reject external URLs in profile/model image handlers * refac(ui): centralize image URL validation in safeImageUrl helper * refac(auths): make signout POST-only * refac: gate external profile image redirect behind ENABLE_PROFILE_IMAGE_URL_FORWARDING Restore the 302 redirect for external http(s) profile image URLs in the user and model profile-image endpoints, but gate it behind a new ENABLE_PROFILE_IMAGE_URL_FORWARDING env flag (default: True). Existing deployments that rely on external profile image forwarding continue to work unchanged. Operators who want to suppress the redirect (to prevent client-side IP/UA/Referer leaks) can set the flag to False.
This commit is contained in:
@@ -249,6 +249,19 @@ ENABLE_STAR_SESSIONS_MIDDLEWARE = os.environ.get('ENABLE_STAR_SESSIONS_MIDDLEWAR
|
||||
|
||||
ENABLE_EASTER_EGGS = os.environ.get('ENABLE_EASTER_EGGS', 'True').lower() == 'true'
|
||||
|
||||
####################################
|
||||
# ENABLE_PROFILE_IMAGE_URL_FORWARDING
|
||||
####################################
|
||||
|
||||
# When True (default), the user and model profile-image endpoints
|
||||
# honour external http(s) URLs stored in profile_image_url by issuing a
|
||||
# 302 redirect to the original origin. Set to False to suppress the
|
||||
# redirect (prevents client-side IP/UA/Referer leaks to attacker-
|
||||
# controlled origins) and fall through to the default image instead.
|
||||
ENABLE_PROFILE_IMAGE_URL_FORWARDING = os.environ.get(
|
||||
'ENABLE_PROFILE_IMAGE_URL_FORWARDING', 'True'
|
||||
).lower() == 'true'
|
||||
|
||||
####################################
|
||||
# WEBUI_BUILD_HASH
|
||||
####################################
|
||||
|
||||
Reference in New Issue
Block a user