mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +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
|
|
@ -25,6 +25,7 @@ import (
|
|||
"github.com/88250/lute/editor"
|
||||
"github.com/88250/lute/parse"
|
||||
"github.com/siyuan-note/siyuan/kernel/treenode"
|
||||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func ParseJSONWithoutFix(jsonData []byte, options *parse.Options) (ret *parse.Tree, err error) {
|
||||
|
|
@ -57,6 +58,14 @@ func ParseJSON(jsonData []byte, options *parse.Options) (ret *parse.Tree, needFi
|
|||
}
|
||||
|
||||
ret = &parse.Tree{Name: "", ID: root.ID, Root: &ast.Node{Type: ast.NodeDocument, ID: root.ID, Spec: root.Spec}, Context: &parse.Context{ParseOption: options}}
|
||||
if icon := root.Properties["icon"]; "" != icon {
|
||||
// XSS through emoji name https://github.com/siyuan-note/siyuan/issues/15034
|
||||
if newIcon := util.FilterUploadEmojiFileName(icon); newIcon != icon {
|
||||
root.Properties["icon"] = newIcon
|
||||
needFix = true
|
||||
}
|
||||
}
|
||||
|
||||
ret.Root.KramdownIAL = parse.Map2IAL(root.Properties)
|
||||
ret.Root.SetIALAttr("type", "doc")
|
||||
for _, kv := range ret.Root.KramdownIAL {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue