Title: crypto.X509Certificate.toLegacyObject doesn't propagate internal OpenSSL errors · Issue #63265 · nodejs/node · GitHub
Open Graph Title: crypto.X509Certificate.toLegacyObject doesn't propagate internal OpenSSL errors · Issue #63265 · nodejs/node
X Title: crypto.X509Certificate.toLegacyObject doesn't propagate internal OpenSSL errors · Issue #63265 · nodejs/node
Description: Version v25.9.0 Platform Linux 749dbb0e74fd 6.8.0-106-generic #106-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 6 07:58:08 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux Subsystem crypto What steps will reproduce the bug? For context, consider this JavaS...
Open Graph Description: Version v25.9.0 Platform Linux 749dbb0e74fd 6.8.0-106-generic #106-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 6 07:58:08 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux Subsystem crypto What steps will reproduce t...
X Description: Version v25.9.0 Platform Linux 749dbb0e74fd 6.8.0-106-generic #106-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 6 07:58:08 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux Subsystem crypto What steps will reproduce t...
Opengraph URL: https://github.com/nodejs/node/issues/63265
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"crypto.X509Certificate.toLegacyObject doesn't propagate internal OpenSSL errors","articleBody":"### Version\n\nv25.9.0\n\n### Platform\n\n```text\nLinux 749dbb0e74fd 6.8.0-106-generic #106-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 6 07:58:08 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux\n```\n\n### Subsystem\n\ncrypto\n\n### What steps will reproduce the bug?\n\nFor context, consider this JavaScript code as an illustrative example:\n```js\nconst { X509Certificate } = require('crypto');\nconst fs = require('fs');\nconsole.log((new X509Certificate(fs.readFileSync('test/fixtures/x509-escaping/alt-28-cert.pem'))).toLegacyObject());\n```\n\nVarious values are fetched from a certificate to put into an object here:\n\nhttps://github.com/nodejs/node/blob/6009d937f515e7a6f2216b80993b4c464d1d3f42/src/crypto/crypto_x509.cc#L774-L794\n\nVarious of these functions can actually fail internally in OpenSSL, but this isn't propagated via an exception. So it is impossible to distinguish between a certificate that doesn't have a certain value or a failure.\nFor example, a failure somewhere in this code for example will cause the absence of the `subjectaltname` property of the returned object:\n\nhttps://github.com/nodejs/node/blob/6009d937f515e7a6f2216b80993b4c464d1d3f42/deps/ncrypto/ncrypto.cc#L1086-L1097\n\nMore specifically, our testing framework reported these concerns specifically for the following OpenSSL calls that can fail:\n```\n`OBJ_obj2nid` via `ncrypto::X509Name::Iterator::operator*[abi:cxx11]() const+0x5ad` with return value `0`\n`BN_bn2hex` via `ncrypto::BignumPointer::toHex() const+0x58` with return value `0`\n`ASN1_INTEGER_to_BN` via `ncrypto::X509View::getSerialNumber() const+0x180` with return value `0`\n`BIO_new` via `ncrypto::X509View::getInfoAccess() const+0x14f` with return value `0`\n`BIO_new` via `ncrypto::X509View::getValidFrom() const+0x14f` with return value `0`\n`BIO_new` via `ncrypto::X509View::getSubjectAltName() const+0x14f` with return value `0`\n`BIO_new` via `ncrypto::X509View::getValidTo() const+0x14f` with return value `0`\n`X509_get_ext_by_NID` via `ncrypto::X509View::getInfoAccess() const+0x1bd` with return value `0`\n`X509_get_ext_by_NID` via `ncrypto::X509View::getSubjectAltName() const+0x1bd` with return value `0`\n`i2d_X509_bio` via `ncrypto::X509View::toDER() const+0x1c4` with return value `0`\n`ASN1_TIME_print` via `ncrypto::X509View::getValidFrom() const+0x1cc` with return value `0`\n`ASN1_TIME_print` via `ncrypto::X509View::getValidTo() const+0x1cc` with return value `0`\n```\n\n### How often does it reproduce? Is there a required condition?\n\nWhen an allocation failure happens or unspecified other type of failure happens inside OpenSSL, it will reproduce.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nI would expect an exception at least in the case of an internal OpenSSL failure.\n\n### What do you see instead?\n\nThe property will not be added to the object, making it impossible to detect whether a property is absent from the certificate or if there was an internal error in OpenSSL.\n\n### Additional information\n\nFound by an experimental static-hybrid analyzer I'm working on.","author":{"url":"https://github.com/ndossche","@type":"Person","name":"ndossche"},"datePublished":"2026-05-12T14:48:51Z","url":"https://github.com/nodejs/node/issues/63265"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9cd98134-43d2-81c1-e2b0-a0b10bea3c63 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B410:25861A:1E1BA6:290908:6AFBFF26 |
| html-safe-nonce | 8f235f3f66f95dff2962a3cc6cebf8c487d9326db7e7858c90d48354de9746a2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNDEwOjI1ODYxQToxRTFCQTY6MjkwOTA4OjZBRkJGRjI2IiwidmlzaXRvcl9pZCI6Ijc3MDY1NzYyNDg5ODExNTk3MTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 97dfe92899538e938c82073e03b15b2c9483a72927f29f80f5acf40d843eafbd |
| hovercard-subject-tag | issue:4430132845 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/63265/issue_layout |
| twitter:image | https://opengraph.githubassets.com/257c996fbbdf156262b9458d0fdce989bc3a13d7982f3bfb6bd11caee798970c/nodejs/node/issues/63265 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/257c996fbbdf156262b9458d0fdce989bc3a13d7982f3bfb6bd11caee798970c/nodejs/node/issues/63265 |
| og:image:alt | Version v25.9.0 Platform Linux 749dbb0e74fd 6.8.0-106-generic #106-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 6 07:58:08 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux Subsystem crypto What steps will reproduce t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ndossche |
| hostname | github.com |
| expected-hostname | github.com |
| None | fa74413a1d84dac536fcca0740780bcbd3207bafec0e51873b73ff8e8cca032f |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b3b5633a74535d9c23385512d534c66c8fde1907 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width