Skip to content

Commit f60d53f

Browse files
committed
Make email obfuscation CSP friendly
Obfuscation makes email addresses harder to harvest by inserting into them HTML elements which are supposed to be invisible in the rendered HTML (display: none). The style is specified inline, and inline styles may be prohibited by content-security-policy HTTP header, breaking the markup if generated html is served from the server which sets such header. So move the style to CSS and refer to it via `class` in HTML code to fix this.
1 parent 5da7df8 commit f60d53f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/htmldocvisitor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ void HtmlDocVisitor::visit(DocURL *u)
402402
{
403403
p = writeUTF8Char(m_t,p);
404404
}
405-
if (*p) m_t << "<span style=\"display: none;\">.nosp@m.</span>";
405+
if (*p) m_t << "<span class=\"obfuscator\">.nosp@m.</span>";
406406
if (size==5) size=4; else size=5;
407407
}
408408
}

templates/html/doxygen.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,6 +1527,10 @@ span.emoji {
15271527
*/
15281528
}
15291529

1530+
span.obfuscator {
1531+
display: none;
1532+
}
1533+
15301534
.PageDocRTL-title div.toc li.level1 {
15311535
margin-left: 0 !important;
15321536
margin-right: 0;

0 commit comments

Comments
 (0)