File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,10 @@ impl Default for MetaTags {
100100
101101impl Display for MetaTags {
102102 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> std:: fmt:: Result {
103- let description = escape_html ( & self . description ) ;
103+ let description = escape_html ( & self . description )
104+ . chars ( )
105+ . take ( 250 )
106+ . collect :: < String > ( ) ;
104107 let image = & self . image ;
105108 let title = escape_html ( & self . title ) ;
106109
@@ -116,6 +119,8 @@ impl Display for MetaTags {
116119<meta property=\" twitter:image\" content=\" {image}\" >"
117120 ) ?;
118121 if let Some ( json_unsafe) = & self . json {
122+ // If we would serialize plain JSON in HTML,
123+ // users might escape the HTML tag and execute arbitrary code.
119124 let json_base64 = base64:: encode ( json_unsafe) ;
120125 write ! (
121126 f,
You can’t perform that action at this time.
0 commit comments