Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2026-01-28 21:42:30 +08:00
parent 399a38893e
commit d7f790755e
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 10 additions and 0 deletions

View file

@ -141,6 +141,14 @@ func copyFile(c *gin.Context) {
}
dest := arg["dest"].(string)
if util.IsSensitivePath(dest) {
msg := fmt.Sprintf("refuse to copy sensitive file [%s]", dest)
logging.LogErrorf(msg)
ret.Code = -2
ret.Msg = msg
return
}
if err = filelock.Copy(src, dest); err != nil {
logging.LogErrorf("copy file [%s] to [%s] failed: %s", src, dest, err)
ret.Code = -1