mailgun / flanker

Python email address and Mime parsing library
http://www.mailgun.com
Apache License 2.0
1.63k stars 204 forks source link

Invalid email assumed to be valid AKA Why are untrimmed emails considered valid emails? #225

Open TimeBomb opened 5 years ago

TimeBomb commented 5 years ago

Due to strip() invoked on address at https://github.com/mailgun/flanker/blob/57701a6aad5cb98b73791a85d61546a688f24eb7/flanker/addresslib/address.py#L112 any address passed to is_email that contains trailing or leading whitespace is considered a valid email, making the occasionally incorrect assumption that the consumer will strip whitespace from the presumed-valid email. This can cause issues where an invalid email, i.e. one containing leading/trailing whitespace, is assumed to be valid.