fix: add SSRF protection to OAuth profile picture URL fetching (#23356)
This commit is contained in:
@@ -81,6 +81,7 @@ from open_webui.utils.misc import parse_duration
|
|||||||
from open_webui.utils.auth import get_password_hash, create_token
|
from open_webui.utils.auth import get_password_hash, create_token
|
||||||
from open_webui.utils.webhook import post_webhook
|
from open_webui.utils.webhook import post_webhook
|
||||||
from open_webui.utils.groups import apply_default_group_assignment
|
from open_webui.utils.groups import apply_default_group_assignment
|
||||||
|
from open_webui.retrieval.web.utils import validate_url
|
||||||
|
|
||||||
from mcp.shared.auth import (
|
from mcp.shared.auth import (
|
||||||
OAuthClientMetadata as MCPOAuthClientMetadata,
|
OAuthClientMetadata as MCPOAuthClientMetadata,
|
||||||
@@ -1330,6 +1331,8 @@ class OAuthManager:
|
|||||||
return '/user.png'
|
return '/user.png'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
validate_url(picture_url)
|
||||||
|
|
||||||
get_kwargs = {}
|
get_kwargs = {}
|
||||||
if access_token:
|
if access_token:
|
||||||
get_kwargs['headers'] = {
|
get_kwargs['headers'] = {
|
||||||
|
|||||||
Reference in New Issue
Block a user