mirror of
https://github.com/KaySar12/NextZen-UserService.git
synced 2025-10-06 19:59:42 +07:00
Merge pull request from GHSA-h5gf-cmm8-cg7c
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@@ -667,6 +668,16 @@ func GetUserImage(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
matched, err := regexp.MatchString(`^/var/lib/casaos/\d`, filePath)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusNotFound, model.Result{Success: common_err.INSUFFICIENT_PERMISSIONS, Message: common_err.GetMsg(common_err.INSUFFICIENT_PERMISSIONS)})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !matched {
|
||||||
|
c.JSON(http.StatusNotFound, model.Result{Success: common_err.INSUFFICIENT_PERMISSIONS, Message: common_err.GetMsg(common_err.INSUFFICIENT_PERMISSIONS)})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
fileTmp, _ := os.Open(filePath)
|
fileTmp, _ := os.Open(filePath)
|
||||||
defer fileTmp.Close()
|
defer fileTmp.Close()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user