server: sanitize html using ammonia

This commit is contained in:
2023-11-26 21:00:44 -08:00
parent c8147ded60
commit 87d687cde5
3 changed files with 69 additions and 5 deletions

View File

@@ -243,7 +243,12 @@ impl QueryRoot {
.headers
.get_first_value("date")
.and_then(|d| mailparse::dateparse(&d).ok());
let body = extract_body(&m)?;
let body = match extract_body(&m)? {
Body::Html(Html { html }) => Body::Html(Html {
html: ammonia::clean(&html),
}),
b => b,
};
messages.push(Message {
from,
to,