get_body() is not robust to LF line endings
- Dominant language
- Rust
- Stars
- 56
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
Current code of `get_body` expects that body starts after ``:
https://github.com/cloudflare/dkim/blob/b50a0829b3123d247f5e78c5b4c7fb92bbf1f4bb/src/hash.rs#L23
This code does not work for mails extracted from Dovecot Maildir which have LF line endings.
`mailparse` already splits headers and body in a different way inside `parse_headers` function:
https://github.com/staktrace/mailparse/blob/c51e92416c193072c739035fdcd5501c15f690e4/src/lib.rs#L939C1-L952C7
I managed to verify signatures of mails from Maildir, but had to do `.replace("\n", "\r\n")`.
It would be nice to reuse `mailparse` splitting instead of splitting in a non-robust way. `mailparse` currently does not expose `body_bytes` (and `header_bytes`) fields, but proposing this to https://github.com/staktrace/mailparse/ is easy as it is well-maintained.
Contributor guide
Assessment
This issue has not been assessed yet.