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.
github.com/real-web-world/go-api
基于gin+gorm的快速curd框架
模型:
每个模型都有 id,ctime(创建时间),utime(更新时间),dtime(删除时间) 4个字段
请求均使用post方法,每个接口模型均有5个常用接口 请求路径: /model/operation
其他定制接口均需要自己编写,若常用接口内有非登录权限问题(如管理员与其他用户操作不同) 则需要重新编写 安全性: 在路由定义中加入授权中间件 比如user模型 未登录5个接口都不能访问,普通用户只能访问detail接口 管理员可以访问所有。 返回值:
// 通用返回json
// 所有的接口均返回此对象
type RetJSON struct {
Code int `json:"code" example:"0"`
Data interface{} `json:"data,omitempty"`
Msg string `json:"msg,omitempty" example:"提示信息"`
Count *int `json:"count,omitempty"`
Page int `json:"page,omitempty"`
Limit int `json:"limit,omitempty"`
Extra *RespJsonExtra `json:"extra,omitempty"`
}
type RespJsonExtra struct {
ReqID string `json:"requestID"`
SQLs interface{} `json:"sqls,omitempty"`
ProcTime string `json:"procTime" example:"0.2s"`
TempData interface{} `json:"tempData,omitempty"`
}
请求参数 AddData 一般为模型中的字段,如有关联 如预览图列表 则有 profilePicIDList字段
请求参数 EditData 一般为 id + AddData 并将AddData必填字段设置为非必填
请求参数 id+scene 根据不同scene返回不同json 不传则返回 defaultScene,
admin scene 需要admin权限 如 请求用户详情 default scene返回信息较多,
profile scene 只返回id 昵称 头像 介绍4个字段
请求参数
ListData struct {
Page int `json:"page" binding:"omitempty,required,min=0"`
Limit int `json:"limit" binding:"omitempty,required,min=0,max=50"`
Filter Filter `json:"filter" binding:""`
Order map[string]string `json:"order" binding:""`
Extra map[string]interface{} `json:"extra" binding:""`
}
type (
Filter = map[string]FilterItem
FilterCond string
FilterItem struct {
Condition FilterCond
Val interface{}
}
)
const (
// 筛选条件
CondUndefined FilterCond = "undefined"
// 数值
CondEq FilterCond = "eq"
CondLt FilterCond = "lt"
CondElt FilterCond = "elt"
CondGt FilterCond = "gt"
CondEgt FilterCond = "egt"
CondNeq FilterCond = "neq"
CondBetweenValue FilterCond = "betweenValue"
// 字符串
CondEqString FilterCond = "eqString"
CondLike FilterCond = "like"
// ... other condition
)
请求参数: ids id列表。 根据id删除
// todo b站做个视频
FAQs
Unknown package
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.