Security fixes

This commit is contained in:
2024-07-23 19:36:56 +10:00
parent 244999138c
commit 03bbc7a1dc
3 changed files with 10 additions and 10 deletions

View File

@@ -82,9 +82,9 @@ module Admin
def display_title def display_title
title = name title = name
if prefix_emoji if prefix_emoji
return "#{prefix_emoji} #{title}" "#{prefix_emoji} #{title}"
else else
return title title
end end
end end
@@ -150,7 +150,7 @@ module Admin
end end
def to_h def to_h
clean_content = CGI.unescapeHTML(content.gsub(/<\/?[^>]*>/, "")).strip clean_content = Sanitize.fragment(content).strip
clean_content = clean_content.gsub(prefix_emoji[0], "") if prefix_emoji clean_content = clean_content.gsub(prefix_emoji[0], "") if prefix_emoji
{ {
id: slug, id: slug,

View File

@@ -86,9 +86,9 @@ module Main
def display_title def display_title
title = name title = name
if prefix_emoji if prefix_emoji
return "#{prefix_emoji} #{title}" "#{prefix_emoji} #{title}"
else else
return title title
end end
end end
@@ -154,7 +154,7 @@ module Main
end end
def to_h def to_h
clean_content = CGI.unescapeHTML(content.gsub(/<\/?[^>]*>/, "")).strip clean_content = Sanitize.fragment(content).strip
clean_content = clean_content.gsub(prefix_emoji[0], "") if prefix_emoji clean_content = clean_content.gsub(prefix_emoji[0], "") if prefix_emoji
{ {
id: slug, id: slug,

View File

@@ -3,16 +3,16 @@ module Micropub
module Posts module Posts
class SyndicationUrlToSource class SyndicationUrlToSource
def call(url:) def call(url:)
if url.match("https://social.dnitza.com") if url.match?(/https:\/\/((social)\.)dnitza.com/)
return :mastodon return :mastodon
end end
if url.match("https://bsky.social") if url.match?("https://bsky.social")
return :bluesky return :bluesky
end end
if url.match("https://gist.github.com") if url.match?(/https:\/\/((gist)\.)?github\.com/)
return :gist :gist
end end
end end
end end