Skip to content

Commit

Permalink
🎨 增加 XSS 过滤漏洞说明 Fix #197
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed May 25, 2023
1 parent 2a04ac5 commit 2afc437
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lute.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,8 @@ func (lute *Lute) SetRenderListStyle(b bool) {
lute.RenderOptions.RenderListStyle = b
}

// SetSanitize 设置为 true 时表示对输出进行 XSS 过滤。
// 注意:Lute 目前的实现存在一些漏洞,请不要依赖它来防御 XSS 攻击。
func (lute *Lute) SetSanitize(b bool) {
lute.RenderOptions.Sanitize = b
}
Expand Down
1 change: 1 addition & 0 deletions render/renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ type Options struct {
// ChineseParagraphBeginningSpace 设置是否使用传统中文排版“段落开头空两格”。
ChineseParagraphBeginningSpace bool
// Sanitize 设置是否启用 XSS 安全过滤 https://github.com/88250/lute/issues/51
// 注意:Lute 目前的实现存在一些漏洞,请不要依赖它来防御 XSS 攻击。
Sanitize bool
// FixTermTypo 设置是否对普通文本中出现的术语进行修正。
// https://github.com/sparanoid/chinese-copywriting-guidelines
Expand Down

0 comments on commit 2afc437

Please sign in to comment.