cert_parser.py accesses private _name attribute on OID object; fragile against cryptography library upgrades #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
_from_x509()readscert.signature_algorithm_oid._name— a private, undocumented attribute of thecryptographylibrary's OID class — to extract the signature algorithm name. There is ahasattrguard, but if the attribute disappears or is renamed in a future release the code silently falls back to the dotted OID string (e.g."1.2.840.10045.4.3.2") rather than a human-readable name, with no warning.Location
src/certbot_manager/core/cert_parser.py, lines 37–40Risk
The
cryptographylibrary treats_nameas an internal implementation detail; it has already been refactored between major versions. When it disappears the code silently falls back to dotted OID strings in the cert detail UI, which is confusing but not dangerous. If the attribute is replaced by something with incompatible semantics, the displayed algorithm name could be wrong without any error being raised.Suggested fix direction
Use the public API:
cert.signature_hash_algorithm(available sincecryptography0.x) gives the digest name, and the key algorithm is already captured inkey_type. Alternatively, maintain a small static dict mapping well-known OID dotted strings to friendly names as a fallback.Severity
minor
Found by
Automated audit by Claude Code