diff --git a/changelog.d/16153.bugfix b/changelog.d/16153.bugfix new file mode 100644 index 000000000000..2fcc74736a93 --- /dev/null +++ b/changelog.d/16153.bugfix @@ -0,0 +1,3 @@ +Checking authdict dictionary before accessing session from it. + +Contributed by @prajjawal05 diff --git a/synapse/handlers/auth.py b/synapse/handlers/auth.py index 59ecafa6a094..e2fc9299710b 100644 --- a/synapse/handlers/auth.py +++ b/synapse/handlers/auth.py @@ -483,7 +483,7 @@ async def check_ui_auth( sid: Optional[str] = None authdict = clientdict.pop("auth", {}) - if "session" in authdict: + if authdict and "session" in authdict: sid = authdict["session"] # Convert the URI and method to strings.