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.
safe-umd-webpack-plugin
Advanced tools
Webpack plugin to handle optional dependency safely when using libraryTarget: umd
Webpack plugin to handle optional dependencies safely when using libraryTarget: umd
.
When using umd
as a libraryTarget with config like :
module.exports = {
entry: './src/index.js',
output: {
library: ['my', 'module'],
libraryTarget: 'umd',
filename: 'bundle.js'
},
externals: {
'my-ext-module': {
commonjs: 'my-ext-module',
commonjs2: 'my-ext-module',
amd: 'my-ext-module',
root: ['my', 'ext', 'module']
}
}
};
You can't use optional dependencies for a root (namespace) because of the generated code like :
root["my"] = root["my"] || {}, root["my"]["module"] = factory(root["my"]["ext"]["module"]);
This plugin replace code above to safely access the namespace with code like :
root["my"] = root["my"] || {}, root["my"]["module"] = factory(root["my"] && root["my"]["ext"] && root["my"]["ext"]["module"]);
npm install safe-umd-webpack-plugin --save-dev
// webpack.config.js
var SafeUmdPlugin = require('safe-umd-webpack-plugin');
// ...
module.exports = {
// ...
plugins: [
//...
new SafeUmdPlugin()
]
}
FAQs
Webpack plugin to handle optional dependency safely when using libraryTarget: umd
We found that safe-umd-webpack-plugin 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.