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

[#7877] Fix uuencoding attachment processing #7900

Merged
merged 3 commits into from
Sep 15, 2023

Conversation

gbp
Copy link
Member

@gbp gbp commented Sep 11, 2023

Relevant issue(s)

Fixes #7877

What does this do?

Fixes uuencoding attachment processing by moving the decoding of these attachments from IncomingMessage into MailHandler

Why was this needed?

So attachments can be have censor rules and masks applied using the original raw attachment as a starting point.

1. Replace output body_without_headers with original_body
2. Use inject with accumulator when mapping over attachments

These changes will make it easier to add additional processing into this
method in the coming commits.
@gbp gbp force-pushed the 7877-uuencoding-attachment-processing branch 2 times, most recently from 0fb77c8 to e4464fb Compare September 15, 2023 08:28
Move Unix-to-Unix encoding [1] into the `MailHandler` as this will allow
us to extract uuencoded attachments attributes without initialising
`FoiAttachment` instances.

[1] https://en.wikipedia.org/wiki/Uuencoding
For attachments which are encoded with Unix-to-Unix encoding we are
unable process some attachments in order to apply masks or censor rules
to them.

This is down to when the attachments are extracted and saved into the
database. It happens outside of our `MailHandler` library which we're
using to retrieve the original unmasked attachment body for processing.

This change fixes this by checking plain text attachments for begin/end
markers and calculating the relevant hexdigest for comparison.

Fixes #7877
@gbp gbp force-pushed the 7877-uuencoding-attachment-processing branch from e4464fb to f98545a Compare September 15, 2023 08:33
@gbp gbp marked this pull request as ready for review September 15, 2023 08:33
@gbp gbp merged commit 86b2275 into develop Sep 15, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken attachment masking - attachments encoded as uuencoded
1 participant