From 81fe59dadcc1351ee4a2f23b29cc889e288613da Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Jul 2023 10:24:03 +0000 Subject: [chore]: Bump github.com/microcosm-cc/bluemonday from 1.0.24 to 1.0.25 (#2021) --- .../github.com/microcosm-cc/bluemonday/helpers.go | 6 +-- .../github.com/microcosm-cc/bluemonday/policy.go | 40 ++++++++++++++- .../github.com/microcosm-cc/bluemonday/sanitize.go | 57 ++++++---------------- 3 files changed, 55 insertions(+), 48 deletions(-) (limited to 'vendor/github.com/microcosm-cc') diff --git a/vendor/github.com/microcosm-cc/bluemonday/helpers.go b/vendor/github.com/microcosm-cc/bluemonday/helpers.go index 2b03d7e7d..aa0b7b92d 100644 --- a/vendor/github.com/microcosm-cc/bluemonday/helpers.go +++ b/vendor/github.com/microcosm-cc/bluemonday/helpers.go @@ -222,11 +222,7 @@ func (p *Policy) AllowDataURIImages() { } _, err := base64.StdEncoding.DecodeString(url.Opaque[len(matched):]) - if err != nil { - return false - } - - return true + return err == nil }, ) } diff --git a/vendor/github.com/microcosm-cc/bluemonday/policy.go b/vendor/github.com/microcosm-cc/bluemonday/policy.go index 995f46c2d..b4f09879a 100644 --- a/vendor/github.com/microcosm-cc/bluemonday/policy.go +++ b/vendor/github.com/microcosm-cc/bluemonday/policy.go @@ -118,9 +118,18 @@ type Policy struct { allowURLSchemes map[string][]urlPolicy // These regexps are used to match allowed URL schemes, for example - // if one would want to allow all URL schemes, they would add `.+` + // if one would want to allow all URL schemes, they would add `.+`. + // However pay attention as this can lead to XSS being rendered thus + // defeating the purpose of using a HTML sanitizer. + // The regexps are only considered if a schema was not explicitly + // handled by `AllowURLSchemes` or `AllowURLSchemeWithCustomPolicy`. allowURLSchemeRegexps []*regexp.Regexp + // If srcRewriter is not nil, it is used to rewrite the src attribute + // of tags that download resources, such as and