changeset 490:cab491b1b563

backend: check items elements on publish.
author Goffi <goffi@goffi.org>
date Thu, 21 Nov 2024 11:02:09 +0100
parents fa0d2a4783fa
children 4e8e8788bc86
files sat_pubsub/backend.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
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: