
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Cronet's native API bindings for Node.js.
This native addon uses CMake.js to build when package install.
So we will need to fulfill its requirements at first.
npm install cronet
const { Buffer } = require('node:buffer')
const cronetjs = require('cronet')
const {
CronetEngineParams,
CronetEngine,
CronetExecutor,
CronetUrlRequestCallback,
CronetUrlRequestParams,
CronetUrlRequest,
} = cronetjs
// dynamic load library
CronetEngine.loadLibrary('libcronet.so')
const params = new CronetEngineParams()
params.enableQuic = true // by default
const engine = new CronetEngine()
console.log('CronetEngine version: ' + engine.versionString)
engine.startWithParams(params)
const executor = new CronetExecutor()
executor.start()
function newRequest(url, timeout = 2000) {
return new Promise((resolve, reject) => {
const urlReq = new CronetUrlRequest()
let body = null
let t = setTimeout(function () {
if (!t) {
return
}
console.log('Request timeout.')
t = null
urlReq.cancel()
}, timeout)
const done = function () {
if (t) {
clearTimeout(t)
t = null
}
resolve(body)
}
const urlReqParams = new CronetUrlRequestParams()
urlReqParams.httpMethod = 'GET'
urlReqParams.disableCache = true
const urlCallback = new CronetUrlRequestCallback()
urlCallback.onRedirectReceived = function (request, info, newLocationUrl) {
console.log('onFollowRedirect: ' + info.httpStatusCode + ' ' + newLocationUrl)
request.followRedirect()
}
urlCallback.onResponseStarted = function (request, info) {
console.log('onResponseStarted: ' + info.url
+ ' ' + info.negotiatedProtocol
+ ' ' + info.httpStatusCode + ' ' + info.httpStatusText)
console.log('All headers:')
const allHeadersListSize = info.allHeadersListSize()
for (let i = 0; i < allHeadersListSize; i++) {
const header = info.allHeadersListAt(i)
console.log({ name: header.name, value: header.value })
}
let buffer = new cronetjs.CronetBuffer()
// Create and allocate 32kb buffer.
buffer.initWithAlloc(32 * 1024)
// Started reading the response.
request.read(buffer)
}
urlCallback.onReadCompleted = function (request, info, buffer, bytesRead) {
console.log('onReadCompleted, bytes read: ' + bytesRead)
const bytes = buffer.data.slice(0, bytesRead)
if (!body) {
body = Buffer.from(bytes)
} else {
body = Buffer.concat([body, bytes])
}
// Continue reading the response.
request.read(buffer)
}
urlCallback.onSucceeded = function (request, info) {
console.log('onSucceeded')
done()
}
urlCallback.onFailed = function (request, info, error) {
console.log('onFailed, message: ' + error.message
+ ', error_code: ' + error.errorCode
+ ', internal_error_code: ' + error.internalErrorCode)
done()
}
urlCallback.onCanceled = function (request, info) {
console.log('onCanceled')
done()
}
urlReq.initWithParams(engine, url, urlReqParams, urlCallback, executor)
urlReq.start()
})
}
async function main() {
await newRequest('https://google.com/', 2000)
executor.shutdown()
engine.shutdown()
}
main()
FAQs
Cronet's native API bindings for Node.js.
We found that cronet demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.