Reject CRLF/malformed emails and names to stop SMTP header injection
This commit is contained in:
parent
598234b817
commit
75d3c70cc8
6 changed files with 93 additions and 3 deletions
|
|
@ -30,6 +30,10 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db:
|
|||
let email = args.get(2).map(|s| s.to_string());
|
||||
let cleared = email.is_none();
|
||||
if let Some(addr) = &email {
|
||||
if !echo_api::valid_email(addr) {
|
||||
ctx.notice(me, from.uid, "That doesn't look like a valid email address.");
|
||||
return;
|
||||
}
|
||||
if db.is_forbidden(ForbidKind::Email, addr).is_some() {
|
||||
ctx.notice(me, from.uid, "That email address is forbidden by network policy. Use a different one.");
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue