Mercurial > libervia-backend
diff libervia/backend/plugins/plugin_xep_0166/__init__.py @ 4114:79ec7d7beef3
plugin XEP-0166: reject session creation is session ID is empty
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 16 Aug 2023 18:28:32 +0200 |
parents | bc60875cb3b8 |
children | 23fa52acf72c |
line wrap: on
line diff
--- a/libervia/backend/plugins/plugin_xep_0166/__init__.py Wed Aug 09 00:48:11 2023 +0200 +++ b/libervia/backend/plugins/plugin_xep_0166/__init__.py Wed Aug 16 18:28:32 2023 +0200 @@ -184,6 +184,10 @@ @raise ValueError: If the provided role is neither initiator nor responder. """ # TODO: session cleaning after timeout ? + + if not sid: + raise exceptions.DataError("Empty session ID is not allowed") + if role not in [XEP_0166.ROLE_INITIATOR, XEP_0166.ROLE_RESPONDER]: raise ValueError(f"Invalid role {role}. Expected initiator or responder.")