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 @@ -99,7 +99,10 @@ impl Default for MetaTags {
9999
100100impl Display for MetaTags {
101101 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> std:: fmt:: Result {
102- let description = escape_html ( & self . description ) ;
102+ let description = escape_html ( & self . description )
103+ . chars ( )
104+ . take ( 250 )
105+ . collect :: < String > ( ) ;
103106 let image = & self . image ;
104107 let title = escape_html ( & self . title ) ;
105108
@@ -115,6 +118,8 @@ impl Display for MetaTags {
115118<meta property=\" twitter:image\" content=\" {image}\" >"
116119 ) ?;
117120 if let Some ( json_unsafe) = & self . json {
121+ // If we would serialize plain JSON in HTML,
122+ // users might escape the HTML tag and execute arbitrary code.
118123 let json_base64 = base64:: encode ( json_unsafe) ;
119124 write ! (
120125 f,
You can’t perform that action at this time.
0 commit comments