diff options
author | Paul Barker <paul@pbarker.dev> | 2021-06-07 11:02:51 +0100 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2021-06-07 08:49:23 -0400 |
commit | 366bcd1fd8a10b6125e591f0c35cc85b10c9c950 (patch) | |
tree | 182506f7ad4dbf44584802642ad1bf6aa39efbf7 /tests/__init__.py | |
parent | a727eaeb9a7183262659b8192fc823e409bba49a (diff) | |
download | b4-366bcd1fd8a10b6125e591f0c35cc85b10c9c950.tar.gz |
Handle MIME encoded-word in DKIM-Signature headers
As recently found in patatt [1], mail gateways and archivers may mangle
headers like DKIM-Signature if they are sent as an excessively long
line. An example of this occuring was found when the DKIM-Signature
header generated by Microsoft Office 365 collided with the
header re-encoding performed by lists.sr.ht when generating mbox
archive files. This encoding causes dkim.verify() to fail.
The Python email.header module provides the decode_header() and
make_header() functions which can be used to handle MIME encoded-word
syntax or other header manglings which may occur. Fixing up the header
content using these functions before calling dkim.verify() allows the
verification to succeed.
[1]: https://lore.kernel.org/tools/20210531140539.7630-1-paul@pbarker.dev/
Signed-off-by: Paul Barker <paul@pbarker.dev>
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Link: https://lore.kernel.org/r/20210607100252.8253-2-paul@pbarker.dev
Diffstat (limited to 'tests/__init__.py')
0 files changed, 0 insertions, 0 deletions