Skip to content

Conversation

aidecoe
Copy link
Contributor

@aidecoe aidecoe commented Nov 27, 2017

Filter tags e-mail having DKIM header with either dkim-ok or
dkim-fail.

@flokli
Copy link
Member

flokli commented Nov 27, 2017

@aidecoe Thanks again for the contribution - will have a look ASAP :-)

Do you by any chance have the time to add a small testing harness, so we could run a chain of filters with a specific configuration on an email and check if tags get applied correctly?

I'd like to refactor some parts of the config parsing area (which is quite a mess), but am afraid this will break other things we might not catch…


def handle_message(self, message):
if message.get_header(self.header):
dkim_ok = all(map(verify_dkim, message.get_filenames()))
Copy link
Member

Choose a reason for hiding this comment

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

not sure about message.get_filenames(). This could yield multiple file names, and we need to open the file in python, which can easily be done wrongly.

Is it possible to simply pass message.get_message_parts() to dkim.verify?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is different. dkim.verify takes full raw e-mail message (as bytes, not as string). get_filenames() may yield multiple messages that's why for sanity all() is used, so we don't have false positive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In other words that's the way to do it and there's no issue here.

# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
Copy link
Member

Choose a reason for hiding this comment

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

Can you use SPDX, and simply add a single

# SPDX-License-Identifier: ISC

instead of the license text?
I still have a PR lying around fixing this in other places as well :-)

Copy link
Member

Choose a reason for hiding this comment

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

@aidecoe see #171 for the PR.

@aidecoe aidecoe force-pushed the dkim-validity-filter branch from 026f57d to 7977d4e Compare November 28, 2017 21:44
@aidecoe
Copy link
Contributor Author

aidecoe commented Nov 28, 2017

@flokli It would be nice to have some test suites but I don't have too much spare time. Of course I will provide test suites for any other changes I will make in the future if the framework is in place.

@aidecoe aidecoe force-pushed the dkim-validity-filter branch from 7977d4e to bef6fff Compare November 30, 2017 23:49
Copy link
Collaborator

@GuillaumeSeren GuillaumeSeren left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@flokli
Copy link
Member

flokli commented Dec 3, 2017

There are currently conflicts. Could you rebase?

In addition, I'd prefer to use message.get_filename(), which randomly picks one file location to open instead of mapping over all. In theory, the messages shouldn't differ (and if they do regardless, we'd have other problems :-) )

If you don't have the time to add tests, could you still add an example of a message with a valid DKIM signature, so we can add this to the test harness later?

@aidecoe
Copy link
Contributor Author

aidecoe commented Dec 4, 2017

@flokli Just let me know when test framework is in place and I will write tests for those filters myself.

@aidecoe
Copy link
Contributor Author

aidecoe commented Dec 4, 2017

In addition, I'd prefer to use message.get_filename(), which randomly picks one file location to open instead of mapping over all. In theory, the messages shouldn't differ (and if they do regardless, we'd have other problems :-) )

The filter verifies integrity of the message. So if any of those is wrong then that's integrity violation which should be signalled.

Filter tags e-mail having DKIM header with either `dkim-ok` or
`dkim-fail`.
@aidecoe aidecoe force-pushed the dkim-validity-filter branch from f03e8c1 to 9e32573 Compare December 7, 2017 23:08
@GuillaumeSeren
Copy link
Collaborator

Hey @aidecoe
can you rebase the branch ?

@aidecoe
Copy link
Contributor Author

aidecoe commented Jan 22, 2018

@GuillaumeSeren, I believe it is rebased onto afewmail master, isn't it?

@GuillaumeSeren
Copy link
Collaborator

@aidecoe Ah ok I was a bit confused but the changes requested.

@flokli Completing the test suite is a long task and we don't have it right now.
I want to merge this PR and #175,to move forward and tag the 1.3.0,
we have small manpower let's not discourage users, and if we merge something bad we can fix it.

@flokli flokli merged commit 4c389d5 into afewmail:master Feb 6, 2018
@GuillaumeSeren
Copy link
Collaborator

👍 🍻

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.

3 participants