
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
ext-corb-workaround
Advanced tools
This package is a work-around for a bug with Cross-Origin Request Blocking (CORB) as implemented in Chrome extensions.
According to https://www.chromium.org/Home/chromium-security/extension-content-script-fetches, "content scripts should be subject to the same request rules as the page they are running within", but currently Chrome blocks requests from content scripts if the extension has permissions to the requested domain, regardless of whether the page it's running within also has permissions to the requested domain because of CORS.
In order to work around this issue, this package allows creating a replacement XMLHttpRequest object for a content script to use which proxies its connections through the page's context, so the request is treated exactly as a request from the parent page instead of from the extension.
Because this proxies the connection through the web page's javascript context, it is possible for the web page to modify the content of the request. This package should only be used by extensions that trust the web page the content script is running in. This makes this package a good fit for an extension that adds features to one specific site. It is not recommended to use this package in a content script that executes inside all web pages.
If possible, follow the recommendations inside the "Recommended Developer Actions" section of Chrome's CORB/extension documentation instead of using this package. This package should only be used where you specifically want the request to run as if it came from the content script's page rather than as the extension.
In order to use this library, you must execute a script in the page's main world which calls an initializer function from this library. This requires a separate content script, background script, and page world script in your extension.
In an extension content script:
chrome.runtime.sendMessage({ type: 'injectPageWorld' });
In an extension background service worker:
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
if (message.type === 'injectPageWorld' && sender.tab) {
chrome.scripting.executeScript({
target: { tabId: sender.tab.id },
world: 'MAIN',
files: ['pageWorld.js'],
});
}
});
In pageWorld.js:
import { init } from 'ext-corb-workaround/dist/src/pageWorld';
init();
This library exports two functions:
This function returns an XMLHttpRequest-like object which can be used like XMLHttpRequest, but with all of its requests proxied through the page's context.
Usage example:
import { getXMLHttpRequest } from 'ext-corb-workaround';
function getWithCorbWorkaround(url) {
return new Promise((resolve, reject) => {
const XMLHttpRequest = getXMLHttpRequest();
const xhr = new XMLHttpRequest();
xhr.addEventListener('loadend', () => {
if (xhr.status !== 200) {
reject(new Error(`Error fetching: ${xhr.statusText}`));
} else {
resolve(xhr.responseText);
}
});
xhr.open('GET', url);
xhr.send();
});
}
This is a convenience function which replaces window.XMLHttpRequest with the value returned by getXMLHttpRequest(). This may be useful for an extension content script that wants to globally opt into proxying its connections through the page.
TypeScript type definitions for this module are included.
FAQs
A work-around for CORB restrictions in Chrome extensions
The npm package ext-corb-workaround receives a total of 57 weekly downloads. As such, ext-corb-workaround popularity was classified as not popular.
We found that ext-corb-workaround 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 researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.