mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-19 23:06:09 +01:00
🔒 Arbitrary file reading vulnerability https://github.com/siyuan-note/siyuan/issues/16860
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
f922745aa7
commit
b2274baba2
3 changed files with 118 additions and 3 deletions
|
|
@ -66,14 +66,26 @@ func globalCopyFiles(c *gin.Context) {
|
|||
srcs = append(srcs, s.(string))
|
||||
}
|
||||
|
||||
for _, src := range srcs {
|
||||
if !filelock.IsExist(src) {
|
||||
for i, src := range srcs {
|
||||
absSrc, _ := filepath.Abs(src)
|
||||
|
||||
if !filelock.IsExist(absSrc) {
|
||||
msg := fmt.Sprintf("file [%s] does not exist", src)
|
||||
logging.LogErrorf(msg)
|
||||
ret.Code = -1
|
||||
ret.Msg = msg
|
||||
return
|
||||
}
|
||||
|
||||
if util.IsSensitivePath(absSrc) {
|
||||
msg := fmt.Sprintf("refuse to copy sensitive file [%s]", src)
|
||||
logging.LogErrorf(msg)
|
||||
ret.Code = -2
|
||||
ret.Msg = msg
|
||||
return
|
||||
}
|
||||
|
||||
srcs[i] = absSrc
|
||||
}
|
||||
|
||||
destDir := arg["destDir"].(string) // 相对于工作空间的路径
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue