Skip to content

Instantly share code, notes, and snippets.

@superche
Last active March 18, 2022 06:19
Show Gist options
  • Save superche/d12f3fb5083426f9179d5cbb21d47ed0 to your computer and use it in GitHub Desktop.
Save superche/d12f3fb5083426f9179d5cbb21d47ed0 to your computer and use it in GitHub Desktop.
node-ipc cve check
// /usr/local/bin/node
const fs = require('fs');
const blackList = [{
name: 'node-ipc',
affectingVersion: '>=10.1.1 <10.1.3',
}];
const packages = fs.readdirSync('./node_modules');
const dangerList = [];
blackList.forEach(item => {
if (packages.includes(item.name)) {
dangerList.push(item);
}
});
if (dangerList.length) {
console.error(`危险包存在,请检查是否为受影响版本: 共${dangerList.length}个`);
dangerList.forEach(item => {
console.error(`${item.name}: 受影响版本 ${item.affectingVersion}`);
});
} else {
console.log('检测无毒');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment