
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
express-random
Advanced tools
Express middleware to generate entropy via random bytes from Node.js crypto module.
Canonical URL:
https://alexstevovich.com/a/express-random-nodejs
Software URL:
https://midnightcitylights.com/software/express-random-nodejs
A Express middleware to generate entropy via random bytes from Node.js crypto module.
Note: This package is a community-developed middleware for the Express framework and is not officially endorsed or maintained by the Express team.
npm install express-random
import express from 'express';
import randomBytesHandler from 'express-random';
const app = express();
// Set up the /rng endpoint
app.get('/rng', randomBytesHandler);
app.listen(3000, () => {
console.log('Server is running on http://localhost:3000');
});
// Specify the byte size in the query parameter
const response = await fetch('http://localhost:3000/rng?bytes=64', {
method: 'GET',
});
if (response.ok) {
// Convert the response to an ArrayBuffer or Blob and display
const buffer = await response.arrayBuffer();
const byteArray = new Uint8Array(buffer);
document.getElementById('result').textContent = `Random Bytes (64 bytes):\n${byteArray.join(', ')}`;
}
randomBytesHandler(req, res)Provides a random byte stream in response to an HTTP request.
| Name | Type | Description |
|---|---|---|
req | import('express').Request | The HTTP request. |
res | import('express').Response | The HTTP response. |
| Type | Description |
|---|---|
void | Sends a random byte stream as a binary response. |
?bytes=SIZE (e.g., /rng?bytes=64).Cache-Control: no-store to ensure it is not cached.Licensed under the MIT License.
This package generates random bytes based on Node.js’s built-in crypto.randomBytes(). While this may be suitable for many use cases, users should evaluate its suitability for specific, especially sensitive, applications.
FAQs
Express middleware to generate entropy via random bytes from Node.js crypto module.
We found that express-random demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.