forked from forgejo/forgejo
Upgrade Bluemonday to v1.0.16 (#17372)
Upgrade Bluemonday to latest version Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
parent
35b918f574
commit
c5a408df05
14 changed files with 103 additions and 24 deletions
30
vendor/github.com/microcosm-cc/bluemonday/policy.go
generated
vendored
30
vendor/github.com/microcosm-cc/bluemonday/policy.go
generated
vendored
|
@ -134,6 +134,19 @@ type Policy struct {
|
|||
setOfElementsMatchingAllowedWithoutAttrs []*regexp.Regexp
|
||||
|
||||
setOfElementsToSkipContent map[string]struct{}
|
||||
|
||||
// Permits fundamentally unsafe elements.
|
||||
//
|
||||
// If false (default) then elements such as `style` and `script` will not be
|
||||
// permitted even if declared in a policy. These elements when combined with
|
||||
// untrusted input cannot be safely handled by bluemonday at this point in
|
||||
// time.
|
||||
//
|
||||
// If true then `style` and `script` would be permitted by bluemonday if a
|
||||
// policy declares them. However this is not recommended under any circumstance
|
||||
// and can lead to XSS being rendered thus defeating the purpose of using a
|
||||
// HTML sanitizer.
|
||||
allowUnsafe bool
|
||||
}
|
||||
|
||||
type attrPolicy struct {
|
||||
|
@ -714,6 +727,23 @@ func (p *Policy) AllowElementsContent(names ...string) *Policy {
|
|||
return p
|
||||
}
|
||||
|
||||
// AllowUnsafe permits fundamentally unsafe elements.
|
||||
//
|
||||
// If false (default) then elements such as `style` and `script` will not be
|
||||
// permitted even if declared in a policy. These elements when combined with
|
||||
// untrusted input cannot be safely handled by bluemonday at this point in
|
||||
// time.
|
||||
//
|
||||
// If true then `style` and `script` would be permitted by bluemonday if a
|
||||
// policy declares them. However this is not recommended under any circumstance
|
||||
// and can lead to XSS being rendered thus defeating the purpose of using a
|
||||
// HTML sanitizer.
|
||||
func (p *Policy) AllowUnsafe(allowUnsafe bool) *Policy {
|
||||
p.init()
|
||||
p.allowUnsafe = allowUnsafe
|
||||
return p
|
||||
}
|
||||
|
||||
// addDefaultElementsWithoutAttrs adds the HTML elements that we know are valid
|
||||
// without any attributes to an internal map.
|
||||
// i.e. we know that <table> is valid, but <bdo> isn't valid as the "dir" attr
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue