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.
api-checker
Advanced tools
根据自定义的模板数据结构来检测后端数据接口返回的数据是否满足前端要求.
对于必要属性发生缺失,直接报错;对于非必要属性,可以通过模板数据赋值合并,且可以设置默认值
In a browser:
<script src="api-checker.js"></script>
Using npm:
$ npm i -S api-checker / yarn add api-checker
key1: '', // 字符串类型
key2: 0, // 数字类型
key3: true, // 布尔类型
...
key: {
v: '', // 这里可以设置任意简单数据类型的初始值
required: true
}
key: {
v: [...],
required: true
}
or
key: {
v: {..},
required: true
}
被设置为必要属性的字段发生缺失或类型错误,直接抛出错误,所以凡是前端可以用默认值替代的字段尽量不建议设置为必要字段。其次,接口数据如果在模板数据中为出现,直接过滤掉。
数据模板结构:
apiChecker.check(tplData, apiData, {
showLog: true,
success: function (data) {
console.log(data)
},
error: function (err) {
console.log(err)
},
warn: function (curVal, oldItem, newItem) {
// console.log('warn!')
}
})
FAQs
check api data
The npm package api-checker receives a total of 0 weekly downloads. As such, api-checker popularity was classified as not popular.
We found that api-checker 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.