Skip to content

Crash in dependencies using SlowBuffer in v24.0.0 #58203

@suiboli314

Description

@suiboli314

Version

v24.0.0

Platform

Linux a3399d7de011 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 Linux

Subsystem

No response

What steps will reproduce the bug?

  1. Use the node:alpine Docker image (which now uses Node.js v24.0.0).
  2. Install a package (e.g. jsonwebtoken) that depends on buffer-equal-constant-time@1.0.1.
  3. Run the Node.js app in docker.

How often does it reproduce? Is there a required condition?

every time.
sample repo

What is the expected behavior? Why is that the expected behavior?

The app should not crash. In earlier Node.js versions (e.g. v23, node:lts-alpine), there is no error.

What do you see instead?

/usr/src/app/node_modules/buffer-equal-constant-time/index.js:37
var origSlowBufEqual = SlowBuffer.prototype.equal;
                                  ^

TypeError: Cannot read properties of undefined (reading 'prototype')
    at Object.<anonymous> (/usr/src/app/node_modules/buffer-equal-constant-time/index.js:37:35)
    at Module._compile (node:internal/modules/cjs/loader:1734:14)
    at Object..js (node:internal/modules/cjs/loader:1899:10)
    at Module.load (node:internal/modules/cjs/loader:1469:32)
    at Module._load (node:internal/modules/cjs/loader:1286:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.require (node:internal/modules/cjs/loader:1491:12)
    at require (node:internal/modules/helpers:135:16)
    at Object.<anonymous> (/usr/src/app/node_modules/jwa/index.js:1:19)

Node.js v24.0.0

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions