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.
@koa-lite/controller
Advanced tools
$ yarn add @koa-lite/controller
// controller.ts
import { Prefix, Tag, Get, Summary, Query } from '@koa-lite/controller'
@Prefix('/ucenter')
export default class User {
@Tag('User')
@Get('/user') // or request.get('/user'), request('get', '/user')
@Summary('User list')
@Query(Joi.object({
name: Joi.string().required().description('name'),
})) // check.query()
async sms(ctx: BaseContext) {
ctx.body = {}
}
}
// router.ts
import { Controller, InjectHandle } from '@koa-lite/controller'
import User from './controller.ts'
// 包装函数
InjectHandle(({ fn }) => fn)
const router = new Controller({
prefix: '/v1',
docs: {
title: '接口文档 - 客户端',
version: 'v1',
description: '业务接口文档 - by Hotchcms',
securities: [{
type: 'headers',
key: 'Authorization', // 自动注入token等信息
value: function (data) {
var ret = (data instanceof Object) && data.ret
return /^Bearer\s/.test(ret) ? ret : ''
},
}, {
type: 'headers',
key: 'x-device-id',
value: '10001',
}],
}})
.controllers([ User ])
.get('/', ctx => { ctx.body = 'API V1' })
// app.ts
app.use(router.routes())
Prefix()
Get()
Post()
Put()
Delete()
Body
Query
Params
Headers
Middle([])
Summary()
Tag()
FAQs
integrated koa-router and joi, support api docs generated
The npm package @koa-lite/controller receives a total of 1 weekly downloads. As such, @koa-lite/controller popularity was classified as not popular.
We found that @koa-lite/controller 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.