fix: validate social login key JSON fields (#33622)

Any misconfiguration would break login page otherwise

Resolves #33579

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2025-08-14 12:56:12 +05:30 committed by GitHub
parent 4acd07eaa4
commit debd500cf3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -89,6 +89,17 @@ class SocialLoginKey(Document):
frappe.throw(
_("Please enter Client Secret before social login is enabled"), exc=ClientSecretNotSetError
)
if self.auth_url_data:
try:
json.loads(self.auth_url_data)
except json.JSONDecodeError:
frappe.throw(_("Auth URL data should be valid JSON"))
if self.api_endpoint_args:
try:
json.loads(self.api_endpoint_args)
except json.JSONDecodeError:
frappe.throw(_("API Endpoint Args should be valid JSON"))
def set_icon(self):
icon_map = {