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: [PATCH] [chore]: Bump github.com/microcosm-cc/bluemonday from 1.0.24
to 1.0.25 (#2021)
---
go.mod | 2 +-
go.sum | 4 +-
.../microcosm-cc/bluemonday/helpers.go | 6 +-
.../microcosm-cc/bluemonday/policy.go | 40 ++++++++++++-
.../microcosm-cc/bluemonday/sanitize.go | 57 +++++--------------
vendor/modules.txt | 2 +-
6 files changed, 59 insertions(+), 52 deletions(-)
diff --git a/go.mod b/go.mod
index e2db414a4..91119f29b 100644
--- a/go.mod
+++ b/go.mod
@@ -34,7 +34,7 @@ require (
github.com/h2non/filetype v1.1.3
github.com/jackc/pgconn v1.14.1
github.com/jackc/pgx/v5 v5.4.2
- github.com/microcosm-cc/bluemonday v1.0.24
+ github.com/microcosm-cc/bluemonday v1.0.25
github.com/miekg/dns v1.1.55
github.com/minio/minio-go/v7 v7.0.60
github.com/mitchellh/mapstructure v1.5.0
diff --git a/go.sum b/go.sum
index 89ee1bc9a..557151dba 100644
--- a/go.sum
+++ b/go.sum
@@ -444,8 +444,8 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U=
-github.com/microcosm-cc/bluemonday v1.0.24 h1:NGQoPtwGVcbGkKfvyYk1yRqknzBuoMiUrO6R7uFTPlw=
-github.com/microcosm-cc/bluemonday v1.0.24/go.mod h1:ArQySAMps0790cHSkdPEJ7bGkF2VePWH773hsJNSHf8=
+github.com/microcosm-cc/bluemonday v1.0.25 h1:4NEwSfiJ+Wva0VxN5B8OwMicaJvD8r9tlJWm9rtloEg=
+github.com/microcosm-cc/bluemonday v1.0.25/go.mod h1:ZIOjCQp1OrzBBPIJmfX4qDYFuhU02nx4bn030ixfHLE=
github.com/miekg/dns v1.1.55 h1:GoQ4hpsj0nFLYe+bWiCToyrBEJXkQfOOIvFGFy0lEgo=
github.com/miekg/dns v1.1.55/go.mod h1:uInx36IzPl7FYnDcMeVWxj9byh7DutNykX4G9Sj60FY=
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
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(url *url.URL) (allowUrl bool) {
}
_, 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