
Research
/Security News
10 npm Typosquatted Packages Deploy Multi-Stage Credential Harvester
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.
用于考拉用户登陆校验和简单的权限控制
只适配 Koa2
##Getting Start
const auth = require('klg-auth')
app.use(auth.validate({
errHandle: async function (ctx) {
console.log('授权错误')
// 检测到用户没有登陆时会触发此 handle
// 跳转到SSO的登陆页面或者 返回url给前端跳转
ctx.body = {
code: 1,
message: '授权错误',
url: 'http://'
}
ctx.status = 200
},
cookieDomain: 'localhost' // 更新cookie domain
cookieMaxAge: 30 * 60 * 1000 // 更新cookie时间(30分钟)
}))
import { allow } from 'klg-auth'
router.get('/user/:username', allow('管理员', '开发'), UserController.getUserByName)
allow('管理员', '开发') 表示此 url 只允许 管理员 和 开发 角色访问 非以上角色访问会默认返回(后面会开放自定义处理函数): 200
{ code: 1, message: '该用户没有权限执行此操作' }
ban('实习') 表示此 url 不允许 实习 角色访问 非以上角色访问会默认返回:200
{ code: 1, message: '该用户没有权限执行此操作' }
FAQs
We found that klg-auth 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 found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.