changeset 3963:d105ead599b6

plugin pubsub signature: fix attachment setting + default signer: - attachment setting was crashing when `item_elt` was not specified due to argument typo - if `signer` is set to None in attachment data, client's bare jid will be used to sign the item rel 381
author Goffi <goffi@goffi.org>
date Sun, 30 Oct 2022 01:06:58 +0200
parents 2d9d0b77e82b
children 0f858aa0b92c
files sat/plugins/plugin_sec_pubsub_signing.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/sat/plugins/plugin_sec_pubsub_signing.py	Sun Oct 30 01:06:55 2022 +0200
+++ b/sat/plugins/plugin_sec_pubsub_signing.py	Sun Oct 30 01:06:58 2022 +0200
@@ -255,7 +255,7 @@
                 node = attachments_data["node"]
                 item_id = attachments_data["id"]
                 items, __ = await self._p.getItems(
-                    client, service, node, items_ids=[item_id]
+                    client, service, node, item_ids=[item_id]
                 )
                 if not items != 1:
                     raise exceptions.NotFound(
@@ -263,7 +263,7 @@
                     )
                 item_elt = items[0]
 
-            signer = signature_data["signer"]
+            signer = signature_data.get("signer") or client.jid.userhost()
             timestamp = time.time()
             timestamp_xmpp = utils.xmpp_date(timestamp)
             to_sign = self.get_data_to_sign(item_elt, service, timestamp, signer)