SECURITY: ensure embed_url contains valid http(s) uri

This commit is contained in:
Blake Erickson
2020-05-22 14:54:56 -06:00
parent bf8085e436
commit 03d26cd6f0
4 changed files with 25 additions and 0 deletions
+2
View File
@@ -109,6 +109,8 @@ class TopicEmbed < ActiveRecord::Base
url = UrlHelper.escape_uri(url)
original_uri = URI.parse(url)
raise URI::InvalidURIError unless original_uri.is_a?(URI::HTTP)
opts = {
tags: %w[div p code pre h1 h2 h3 b em i strong a img ul li ol blockquote],
attributes: %w[href src class],