# HG changeset patch # User Goffi # Date 1667084795 -7200 # Node ID a15c171836bba944a2dbfec5d634b3c9a8491fc0 # Parent 4836b81c5f31588863deede0fb621cdf63de5d5b plugin pubsub signing: fix `gpg_provider` instanciation: the instance was set at the class level while it is client dependant, resulting in the instance being overwritten on each client connexion. rel 381 diff -r 4836b81c5f31 -r a15c171836bb sat/plugins/plugin_sec_pubsub_signing.py --- a/sat/plugins/plugin_sec_pubsub_signing.py Sun Oct 30 01:06:32 2022 +0200 +++ b/sat/plugins/plugin_sec_pubsub_signing.py Sun Oct 30 01:06:35 2022 +0200 @@ -37,7 +37,7 @@ from sat.tools import utils from sat.tools.common import data_format -from .plugin_xep_0373 import get_gpg_provider, VerificationFailed +from .plugin_xep_0373 import VerificationFailed log = getLogger(__name__) @@ -87,9 +87,6 @@ def getHandler(self, client): return PubsubSigning_Handler() - async def profileConnecting(self, client): - self.gpg_provider = get_gpg_provider(self.host, client) - def get_data_to_sign( self, item_elt: domish.Element, @@ -176,11 +173,11 @@ signature = base64.b64decode(signature_data["signature"]) verification_keys = { k for k in await self._ox.import_all_public_keys(client, signer) - if self.gpg_provider.can_sign(k) + if client.gpg_provider.can_sign(k) } signed_data = self.get_data_to_sign(item_elt, service, timestamp, signer.full()) try: - self.gpg_provider.verify_detached(signed_data, signature, verification_keys) + client.gpg_provider.verify_detached(signed_data, signature, verification_keys) except VerificationFailed: validated = False else: @@ -281,12 +278,12 @@ sign_elt = signature_elt.addElement((NS_PUBSUB_SIGNING_OPENPGP, "sign")) signing_keys = { k for k in self._ox.list_secret_keys(client) - if self.gpg_provider.can_sign(k.public_key) + if client.gpg_provider.can_sign(k.public_key) } # the base64 encoded signature itself sign_elt.addContent( base64.b64encode( - self.gpg_provider.sign_detached(to_sign, signing_keys) + client.gpg_provider.sign_detached(to_sign, signing_keys) ).decode() ) return signature_elt