Add bare minimum input sanitization
This is not secure at all, and I'm not sure where I broke Mastodon's built-in sanitization, but whatever.
This commit is contained in:
parent
7fb8981cbc
commit
b2209363eb
@ -123,7 +123,14 @@ toVirtualDomEach mentions emoji node =
|
|||||||
-- VERY janky.
|
-- VERY janky.
|
||||||
handleEmoji : String -> List Emoji -> Html Msg
|
handleEmoji : String -> List Emoji -> Html Msg
|
||||||
handleEmoji s emojis =
|
handleEmoji s emojis =
|
||||||
span [ property "innerHTML" <| Json.Encode.string <| Regex.replace Regex.All shortcodeRegex (\{match} -> displayEmoji match emojis) <| s ] []
|
span [ property "innerHTML" <| Json.Encode.string <| Regex.replace Regex.All shortcodeRegex (\{match} -> displayEmoji match emojis) <| simpleSanitize <| s ] []
|
||||||
|
|
||||||
|
|
||||||
|
simpleSanitize : String -> String
|
||||||
|
simpleSanitize content =
|
||||||
|
content
|
||||||
|
|> replace "<" "<"
|
||||||
|
|> replace ">" ">"
|
||||||
|
|
||||||
|
|
||||||
displayEmoji : String -> List Emoji -> String
|
displayEmoji : String -> List Emoji -> String
|
||||||
|
Loading…
Reference in New Issue
Block a user