Repository navigation
Closed
Labels
Description
What happened?
salt.utils.x509.load_pubkey does not account for the (thus unused) get_encoding parameter. Unsure why pylint didn't complain, but the parameter is never used internally. It should still be fixed.
See code:
Lines 818 to 853 in f52cede
| def load_pubkey(pk, get_encoding=False): | |
| """ | |
| Return a public key instance from | |
| * a class instance | |
| * a file path on the local system | |
| * a string (PEM) | |
| * bytes (hex, base64, raw) | |
| Valid encodings are PEM and DER. | |
| """ | |
| if hasattr(pk, "public_bytes"): | |
| if isinstance( | |
| pk, | |
| ( | |
| rsa.RSAPublicKey, | |
| ec.EllipticCurvePublicKey, | |
| ed25519.Ed25519PublicKey, | |
| ed448.Ed448PublicKey, | |
| ), | |
| ): | |
| return pk | |
| raise SaltInvocationError( | |
| f"Passed object is not a public key, but {pk.__class__.__name__}" | |
| ) | |
| pk = load_file_or_bytes(pk) | |
| if PEM_BEGIN in pk: | |
| try: | |
| return serialization.load_pem_public_key(pk) | |
| except ValueError as err: | |
| raise PubDeserializationError( | |
| "Could not load PEM-encoded public key." | |
| ) from err | |
| try: | |
| return serialization.load_der_public_key(pk) | |
| except ValueError as err: | |
| raise PubDeserializationError("Could not load DER-encoded public key.") from err |
Type of salt install
Official deb
Major version
3006.x, 3007.x, 3008.x
What supported OS are you seeing the problem on? Can select multiple. (If bug appears on an unsupported OS, please open a GitHub Discussion instead)
ubuntu-24.04
salt --versions-report output
Latest HEAD of 3006.x
Activity
fix: make `get_encoding` parameter in `load_pubkey` actually work ins…
dwoz commentedon Oct 16, 2026
This was fixed in v3006.28 and v3007.15. If you can still reproduce it on either release, please comment and we'll reopen.