fix: use createHash fallback for WebSocket accept digest#5334
Closed
cyphercodes wants to merge 1 commit into
Closed
fix: use createHash fallback for WebSocket accept digest#5334cyphercodes wants to merge 1 commit into
cyphercodes wants to merge 1 commit into
Conversation
Signed-off-by: cyphercodes <cyphercodes@users.noreply.github.com>
| const digest = crypto.hash('sha1', keyValue + uid, 'base64') | ||
| const digest = typeof crypto.hash === 'function' | ||
| ? crypto.hash('sha1', keyValue + uid, 'base64') | ||
| : crypto.createHash('sha1').update(keyValue + uid).digest('base64') |
| function createSha1Base64Hash (value) { | ||
| return typeof crypto.hash === 'function' | ||
| ? crypto.hash('sha1', value, 'base64') | ||
| : crypto.createHash('sha1').update(value).digest('base64') |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5334 +/- ##
=======================================
Coverage 93.22% 93.22%
=======================================
Files 110 110
Lines 36603 36605 +2
=======================================
+ Hits 34123 34126 +3
+ Misses 2480 2479 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
metcoder95
reviewed
May 29, 2026
Member
metcoder95
left a comment
There was a problem hiding this comment.
this is fair but I'm having troubles to understand under which circumstances this can happen
Member
|
@metcoder95 when the person is using node v20 (prior to v20.12.0), a version undici v8 does not support. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5333.
Summary
crypto.hashwhen validating the WebSocket accept digestcrypto.createHashwhencrypto.hashis unavailablecrypto.hashbeing absentTests
npm run lintnpx borp --timeout 180000 -p "test/websocket/opening-handshake.js"npm run test:websocket