Closed pavriet-boxtal closed 9 months ago
Hey, i also hit this Issue. I fixed it by enabling encryption on the Description of the Object in the Passbolt GUI. This makes the decrypt function return a json object instead of str since there is a second encrypted field. Seems like the decrypt function only returns json if there is more than one field returned by py-passbolt.
Thank you both for tackling this issue and @paulfi94 for the explanation. I will try to properly mitigate this in the ansible plugin.
I just published 0.0.12 version with a fix for this issue: https://galaxy.ansible.com/ui/repo/published/anatomicjc/passbolt/ thanks to @RobinR1 pull request.
Hello,
I am trying to use this collection to fetch values from my passbolt. Any lookup gives:
I tracked the error to this specific call to json: https://github.com/passbolt/lab-passbolt-ansible-collection/blob/8f8726e9b4e42cf6cee4e7513db6878f07a60d90/plugins/lookup/passbolt.py#L303
Adding debug prints, I get
self.dict_config.get("gpg_library", "PGPy") == "gnupg"
->False
self.p.decrypt(self.p.get_resource_secret(resource.get("id")))
->MyPassword
type(self.p.decrypt(self.p.get_resource_secret(resource.get("id"))))
-><class 'str'>
And so
json.loads
gets a malformed json (or no json at all ...), and raises ajson.decoder.JSONDecodeError
.The culprit seems to be
passbolt.PassboltAPI.decrypt
not returning a json string.According to
ansible-galaxy collection list
, I haveanatomicjc.passbolt v0.0.11
installed According topip list
, I havepy-passbolt v0.0.15
installed