Prevent remote image injection with /img/emoji/ in url (#1245)
* test remote img blocking with /img/emoji/ in url * fix emoji filter prevent injection of remote img with /img/emoji in url
This commit is contained in:
@@ -139,7 +139,7 @@ func sanitize(raw string) string {
|
||||
p.AllowElements("br", "p")
|
||||
|
||||
// Allow img tags from the the local emoji directory only
|
||||
p.AllowAttrs("src").Matching(regexp.MustCompile(`(?i)/img/emoji`)).OnElements("img")
|
||||
p.AllowAttrs("src").Matching(regexp.MustCompile(`(?i)^/img/emoji`)).OnElements("img")
|
||||
p.AllowAttrs("alt", "title").Matching(regexp.MustCompile(`:\S+:`)).OnElements("img")
|
||||
p.AllowAttrs("class").OnElements("img")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user