Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce a max header size of 998 characters in emails #4420

Merged
merged 1 commit into from
Mar 4, 2020

Conversation

jodyheavener
Copy link
Contributor

Closes #4390

Enforces a maximum header size of 998 characters per RFC 5322 recommendation. This is a hopeful solution to a failed mail delivery noted in Bugzilla 1618831.

Note this is 998 characters total (key + value).

Copy link
Contributor

@vbudhram vbudhram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jodyheavener Thank you!

@@ -28,6 +28,8 @@ use hyperx::{
header::{parsing::from_one_raw_str, Formatter, Raw as RawHeader},
};

const HEADER_MAX_LENGTH: usize = 998;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a comment here would be helpful for future us on why this exists.

fn any_header_length() {
let mut rng = rand::thread_rng();

let header = Link::new(std::iter::repeat("X").take(rng.gen_range(0, 2000)).collect::<String>().to_owned());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk that this needs to be a random length string, just one over the max.

@jodyheavener jodyheavener force-pushed the jh/4390-truncate-headers branch 2 times, most recently from 101d4d2 to 06ce6e5 Compare March 4, 2020 22:51
…2 recommendation

RFC 5322 2.1.1 - https://tools.ietf.org/html/rfc5322#section-2.1.1

This is an attempt tp address Bugzilla #1618831
@jodyheavener jodyheavener force-pushed the jh/4390-truncate-headers branch from 06ce6e5 to 08cb9de Compare March 4, 2020 22:53
@jodyheavener jodyheavener merged commit 08cb9de into master Mar 4, 2020
@meandavejustice meandavejustice deleted the jh/4390-truncate-headers branch March 23, 2020 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Limit email header size to less than 998 characters
3 participants