diff sat_pubsub/backend.py @ 490:cab491b1b563

backend: check items elements on publish.
author Goffi <goffi@goffi.org>
date Thu, 21 Nov 2024 11:02:09 +0100
parents 70eddf92bf51
children
line wrap: on
line diff
--- a/sat_pubsub/backend.py	Fri Jan 12 23:46:24 2024 +0100
+++ b/sat_pubsub/backend.py	Thu Nov 21 11:02:09 2024 +0100
@@ -467,6 +467,8 @@
         check_overwrite = False
         ret_payload = None  # payload returned, None or domish.Element
         for item in items:
+            if item.name != "item" or item.uri != pubsub.NS_PUBSUB:
+                raise error.NotAllowedError(f"Invalid item: {item.toXml()}")
             # we enforce publisher (cf XEP-0060 ยง7.1.2.3)
             item['publisher'] = requestor.full()
             if persistItems or deliverPayloads: