Title: crypto.Hash.write swallows errors · Issue #63258 · nodejs/node · GitHub
Open Graph Title: crypto.Hash.write swallows errors · Issue #63258 · nodejs/node
X Title: crypto.Hash.write swallows errors · Issue #63258 · 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? I'm working on a software-fault-...
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/63258
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"crypto.Hash.write swallows 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\nI'm working on a software-fault-injection testing library that injected a fault into the crypto bindings. Specifically a fault here: https://github.com/nodejs/node/blob/a2aeb72bff19c89fe742f5a2db8cfc8d6407f830/deps/ncrypto/ncrypto.cc#L4326\nTo reproduce this issue, change that code to always return false for simplicity; indicating a failed crypto hash update action.\n\nThen execute the following JavaScript code:\n```js\nconst crypto = require('crypto');\n\nconst h = crypto.createHash('sha3-512');\nh.write('hello');\n//h.update('hello'); This line throws\nh.end();\n```\n\nIf we were to use the update call, then it throws an exception.\nHowever, the above code uses the write call. The write call returns true (which makes sense as the return value doesn't indicate success/failure). But I don't see an indication of an error: no exception, no error event emitted. It _seems_ that the error is silently swallowed.\n\nI did try using a callback for the write call:\n```js\nconst crypto = require('crypto');\n\nconst h = crypto.createHash('sha3-512');\nh.write('hello', console.log);\nh.end();\n```\n\nand this just logs `null`. Also no indication of an error.\n\n### How often does it reproduce? Is there a required condition?\n\nConsistently reproduces if false is returned from here:\n\nhttps://github.com/nodejs/node/blob/a2aeb72bff19c89fe742f5a2db8cfc8d6407f830/deps/ncrypto/ncrypto.cc#L4326\n\n### What is the expected behavior? Why is that the expected behavior?\n\nI had expected an exception, a false return value, or an error event emitted somewhere but none of these things seem to happen.\nI could be wrong though about my expectations and missing something.\n\n### What do you see instead?\n\nThe code runs to completion, and if checking the digest, it produces the same digest as if there was no data written to the Hash stream. This means that errors are silently swallowed and the wrong hash is produced.\n\n### Additional information\n\nThis issue was found using a hybrid static-dynamic analyzer I'm working on.","author":{"url":"https://github.com/ndossche","@type":"Person","name":"ndossche"},"datePublished":"2026-05-11T21:18:55.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/63258/node/issues/63258"}
| 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:ab3daadf-02cc-df8e-01fe-e7d9d7d466c5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D802:327B79:3103F4C:459A37E:6A4D0B94 |
| html-safe-nonce | ab80ca44120775114f405834a30213496c057887fac8077e30e912d2bcbfb58d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEODAyOjMyN0I3OTozMTAzRjRDOjQ1OUEzN0U6NkE0RDBCOTQiLCJ2aXNpdG9yX2lkIjoiNTM5NzU1MTI2NTk5MDExODI5MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 60314e9ed33c9bac87bcd401d793f66b71b37a2183d3f0f8aa9ef42e512655ae |
| hovercard-subject-tag | issue:4424375031 |
| 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/63258/issue_layout |
| twitter:image | https://opengraph.githubassets.com/abe607593961b01f0fa1c7b41e7b3f0b9b2c6677c04872f4cd608e9f71d702de/nodejs/node/issues/63258 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/abe607593961b01f0fa1c7b41e7b3f0b9b2c6677c04872f4cd608e9f71d702de/nodejs/node/issues/63258 |
| 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 | bcb4661e6fb4fe8b394c51ea02ccdb2236d40dc59afc75a3bbba50bf6517134c |
| 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 | fb70bd3c4b2bec429781b65419e912c66e2d5581 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width