Closed
Description
/// Declare with
/// #[foo] (my favorite attribute)
#[foo]
pub fn main() { }
produces
<pre class='rust fn'>pub fn main()</pre><div class='docblock'><p>Declare with</p>
<h1 id="<a-href="my%20favorite%20attribute">foo</a>" class='section-header'><a
href="#<a-href="my%20favorite%20attribute">foo</a>"><a href="my%20favorite%20attribute">foo</a></a></h1>
because it parses as a Markdown link. The right thing to do is put backtics around the attribute syntax, but this is still a really confusing failure.
It would also be an XSS vulnerability if we hosted docs generated from user contributed libraries:
/// Declare with
/// #[foo] (my favorite attribute) <script>alert(document.cookie)</script>
But the conservative solution there is to put user content on another origin (e.g. rust-user-content.org
) which doesn't hold any credentials.