
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
sky-core是一个处理浏览器兼容问题的polyfill库和工具库。
npm i sky-core
import "sky-core/polyfill/document/head";
console.log(document.head);
//rollup.config.js
const polyfill = require("rollup-plugin-polyfill-inject");
module.exports = {
plugins: [
polyfill({
polluting: {
".includes": [
"sky-core/polyfill/Array/prototype/includes",
"sky-core/polyfill/String/prototype/includes"
],
"Set":"sky-core/polyfill/Set",
"Map":"sky-core/polyfill/Map",
},
exclude: ["**/node_modules/sky-core/**"]
})
]
}
//before
console.log([].includes('a'));
//after
import "sky-core/polyfill/Array/prototype/includes";
import "sky-core/polyfill/String/prototype/includes";
console.log([].includes('a'));
//rollup.config.js
const polyfill = require("rollup-plugin-polyfill-inject");
module.exports = {
plugins: [
polyfill({
pure: {
"XMLHttpRequest":"sky-core/pure/XMLHttpRequest"
},
exclude: ["**/node_modules/sky-core/**"]
})
]
}
// before
export const isIE6=!window.XMLHttpRequest;
export function get(url){
var xhr=new XMLHttpRequest();
return new Promise(function(){
//...
});
}
// after
import injectXMLHttpRequest from "sky-core/pure/XMLHttpRequest";
export const isIE6=!window.XMLHttpRequest; //window.XXX和typeof XXX不会改变
export function get(url){
var xhr=new injectXMLHttpRequest();
return new Promise(function(){
//...
});
}
//rollup.config.js
const polyfill = require("rollup-plugin-polyfill-inject");
module.exports = {
plugins: [
polyfill({
getter: {
"document.currentScript": ["sky-core/utils/getCurrentScript", 'getCurrentScript'],
"window.innerWidth": ["sky-core/utils/getInnerWidth", 'getInnerWidth'],
"innerWidth": ["sky-core/utils/getInnerWidth", 'getInnerWidth'],
}
exclude: ["**/node_modules/sky-core/**"]
})
]
}
// before
console.log(innerWidth)
console.log(window.innerWidth)
// after
import { getInnerWidth } from "sky-core/utils/getInnerWidth";
console.log(getInnerWidth())
console.log(getInnerWidth())
//rollup.config.js
const polyfill = require("rollup-plugin-polyfill-inject");
module.exports = {
plugins: [
polyfill({
timer: {
"setTimeout": "sky-core/pure/setTimeout",
"setInterval": "sky-core/pure/setInterval"
}
exclude: ["**/node_modules/sky-core/**"]
})
]
}
// before
let args = [0, 1, 2];
setTimeout(function() { }, 0);
setTimeout(function() { });
setTimeout(function() { }, ...args);
setTimeout.apply(window, args);
console.log(setTimeout);
// after
import argsSetTimeout from "sky-core/pure/setTimeout";
let args = [0, 1, 2];
setTimeout(function() { }, 0);
setTimeout(function() { });
argsSetTimeout(function() { }, ...args);
argsSetTimeout.apply(window, args);
console.log(argsSetTimeout);
在低版本浏览器下,部分功能是不能完全实现的。因此需要按照以下约定开发从而避免出现浏览器差异。
你的对象不允许占用“__proto__”、“constructor”这2个成员变量。否则原型相关功能可能运行不正确。如:Object.getPrototypeOf。
本项目将使用“@@”开头表示Symbol。如果您使用在对象中使用“@@”开头的成员,在Object.keys等函数中将被跳过。
本项目将使用“__”开头命名不可枚举成员。且Symbol作key必须是不可枚举的。如果您使用在对象中使用“__”开头的成员或Symbol,在Object.keys等函数中将被跳过。
defineProperty无法polyfill,因此不允许在业务代码中使用defineProperty。在框架中可以根据浏览器兼容情况进行降级处理。
本项目的部分实现和测试用例取自 core-js
FAQs
Javascript toolkit core library
The npm package sky-core receives a total of 34 weekly downloads. As such, sky-core popularity was classified as not popular.
We found that sky-core demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.