Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
comlink-everywhere
Advanced tools
This is a workaround to help patch inconsistent environments until module workers (and eventually [module block](https://github.com/tc39/proposal-js-module-blocks) workers) are available everywhere. Module workers are:
comlink-everywhere
This is a workaround to help patch inconsistent environments until module workers (and eventually module block workers) are available everywhere. Module workers are:
node
(with an API significantly differing from all other environments), and deno
.It also helps test bundler compat issues like snowpackjs/snowpack#3476
// index.js
import { workerFileConstructor, wrap } from "comlink-everywhere/outside";
(async () => {
const Worker = await workerFileConstructor();
const api = wrap(
new Worker(new URL("./worker.js", import.meta.url), { type: "module" })
);
console.log(await api.add(3, 4));
})();
// worker.js
import { expose } from "comlink-everywhere/inside";
expose({
add: (x, y) => x + y,
});
import { constructWorkerFromString } from "comlink-everywhere/outside";
(async () => {
const worker = await constructWorkerFromString(
// Note: this example only works in browsers.
`self.postMessage("from worker");`
);
worker.addEventListener("message", (message) => console.log(message.data));
})();
For maximum compatibility in the short term, the best option is to compile the worker into a source string that does not use any imports, and does not use any syntax or functions specific to CommonJS (e.g. require()
), ESM (e.g. import
), or the web (e.g. importScripts()
)
node
, the type
option will be ignored and the worker will be instantiated as a classic/module worker matching the calling code. See https://github.com/nodejs/node/issues/30682Worker
constructor cannot be retrieved synchronously.
node
constructor for better compatibility (by not importing node
modules unless necessary), which means it is not available synchronously..terminate()
is not currently available on node
workers. Please file an issue if you want to use this library and be able to call .terminate()
.
.unref()
for node
workers, which means they will not hold up program exit.FAQs
This is a workaround to help patch inconsistent environments until module workers (and eventually [module block](https://github.com/tc39/proposal-js-module-blocks) workers) are available everywhere. Module workers are:
The npm package comlink-everywhere receives a total of 1 weekly downloads. As such, comlink-everywhere popularity was classified as not popular.
We found that comlink-everywhere 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.