mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-16 20:18:06 +01:00
🔒 XSS through emoji name https://github.com/siyuan-note/siyuan/issues/15034
This commit is contained in:
parent
9718d3b1c8
commit
0a17b83372
5 changed files with 11 additions and 38 deletions
|
|
@ -250,21 +250,6 @@ func setNodeAttrs0(node *ast.Node, nameValues map[string]string) (oldAttrs map[s
|
|||
|
||||
func pushBroadcastAttrTransactions(oldAttrs map[string]string, node *ast.Node) {
|
||||
newAttrs := parse.IAL2Map(node.KramdownIAL)
|
||||
|
||||
// XSS through emoji name https://github.com/siyuan-note/siyuan/issues/15034
|
||||
for name, value := range oldAttrs {
|
||||
if "icon" == name {
|
||||
value = util.FilterUploadEmojiFileName(value)
|
||||
oldAttrs[name] = value
|
||||
}
|
||||
}
|
||||
for name, value := range newAttrs {
|
||||
if "icon" == name {
|
||||
value = util.FilterUploadEmojiFileName(value)
|
||||
newAttrs[name] = value
|
||||
}
|
||||
}
|
||||
|
||||
data := map[string]interface{}{"old": oldAttrs, "new": newAttrs}
|
||||
if "" != node.AttributeViewType {
|
||||
data["data-av-type"] = node.AttributeViewType
|
||||
|
|
|
|||
|
|
@ -65,13 +65,6 @@ func GetDocInfo(blockID string) (ret *BlockInfo) {
|
|||
title := tree.Root.IALAttr("title")
|
||||
ret = &BlockInfo{ID: blockID, RootID: tree.Root.ID, Name: title}
|
||||
ret.IAL = parse.IAL2Map(tree.Root.KramdownIAL)
|
||||
icon := ret.IAL["icon"]
|
||||
if strings.Contains(icon, ".") {
|
||||
// XSS through emoji name https://github.com/siyuan-note/siyuan/issues/15034
|
||||
icon = util.FilterUploadEmojiFileName(icon)
|
||||
ret.IAL["icon"] = icon
|
||||
}
|
||||
|
||||
scrollData := ret.IAL["scroll"]
|
||||
if 0 < len(scrollData) {
|
||||
scroll := map[string]interface{}{}
|
||||
|
|
@ -138,12 +131,7 @@ func GetDocInfo(blockID string) (ret *BlockInfo) {
|
|||
}
|
||||
}
|
||||
ret.SubFileCount = subFileCount
|
||||
icon = tree.Root.IALAttr("icon")
|
||||
if strings.Contains(icon, ".") {
|
||||
// XSS through emoji name https://github.com/siyuan-note/siyuan/issues/15034
|
||||
icon = util.FilterUploadEmojiFileName(icon)
|
||||
}
|
||||
ret.Icon = icon
|
||||
ret.Icon = tree.Root.IALAttr("icon")
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,12 +80,7 @@ func (box *Box) docFromFileInfo(fileInfo *FileInfo, ial map[string]string) (ret
|
|||
ret.Path = fileInfo.path
|
||||
ret.Size = uint64(fileInfo.size)
|
||||
ret.Name = ial["title"] + ".sy"
|
||||
icon := ial["icon"]
|
||||
if strings.Contains(icon, ".") {
|
||||
// XSS through emoji name https://github.com/siyuan-note/siyuan/issues/15034
|
||||
icon = util.FilterUploadEmojiFileName(icon)
|
||||
}
|
||||
ret.Icon = icon
|
||||
ret.Icon = ial["icon"]
|
||||
ret.ID = ial["id"]
|
||||
ret.Name1 = ial["name"]
|
||||
ret.Alias = ial["alias"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue