- Remove telemetry: disabled all phone-home (installation notify, false positives, behavior tracking, upgrade tips) - Version branding: removed 'ce-' prefix, product name changed to '长亭雷池 WAF' - Detection engine enhancement: strict preset enables all 17 modules with aggressive configs - Multi-user RBAC: admin/operator/viewer roles with password + TOTP 2FA - Rate limiting: nginx limit_req per website (RPS, burst, action) - JS Challenge: browser fingerprint verification page with cookie-based bypass - Security fixes: removed InsecureSkipVerify, hardcoded credentials, NO_AUTH backdoor
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package response
|
||||
|
||||
const (
|
||||
ErrLoginRequired = "login-required"
|
||||
ErrWrongPasscode = "wrong-passcode"
|
||||
ErrWrongTimeGap = "wrong-time-gap"
|
||||
ErrInternalError = "internal-error"
|
||||
ErrDataNotExist = "data-not-exist"
|
||||
ErrWrongFileType = "wrong-filetype"
|
||||
ErrReadOnly = "read-only"
|
||||
)
|
||||
@@ -0,0 +1,56 @@
|
||||
package response
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type JSONBody struct {
|
||||
Err string
|
||||
Msg string
|
||||
Data interface{}
|
||||
}
|
||||
|
||||
var (
|
||||
ErrorLoginRequired = JSONBody{ErrLoginRequired, "Login required", nil}
|
||||
ErrorParamNotOK = JSONBody{ErrInternalError, "Error occurred when extracting params", nil}
|
||||
ErrorDataNotExist = JSONBody{ErrDataNotExist, "Data queried does not exist", nil}
|
||||
ErrorReadOnly = JSONBody{ErrReadOnly, "This environment is read only", nil}
|
||||
)
|
||||
|
||||
func Success(c *gin.Context, data interface{}) {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"data": data,
|
||||
"msg": "",
|
||||
"err": nil,
|
||||
})
|
||||
//c.Abort()
|
||||
}
|
||||
|
||||
func SuccessWithList(c *gin.Context, data interface{}) {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"data": data,
|
||||
"msg": "",
|
||||
"err": nil,
|
||||
})
|
||||
//c.Abort()
|
||||
}
|
||||
|
||||
func SuccessWithMsg(c *gin.Context, data interface{}, msg string) {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"data": data,
|
||||
"msg": msg,
|
||||
"err": nil,
|
||||
})
|
||||
//c.Abort()
|
||||
}
|
||||
|
||||
func Error(c *gin.Context, rsp JSONBody, status int) {
|
||||
c.JSON(status, gin.H{
|
||||
"data": rsp.Data,
|
||||
"msg": rsp.Msg,
|
||||
"err": rsp.Err,
|
||||
})
|
||||
//c.Abort()
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package response
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
const StreamContentType = "application/octet-stream"
|
||||
|
||||
func PNG(c *gin.Context, bytes []byte) {
|
||||
c.Data(http.StatusOK, StreamContentType, bytes)
|
||||
}
|
||||
Reference in New Issue
Block a user