Skip to content

Email Stuffer flaw when creating DKIM signatures w/ multi-part emails #43

Description

@SteveTheTechie

This module has a flaw when trying to produce DKIM signatures w/ multi-part emails. The problem is that too many of the methods call $self->email, which resets the parts and recreates the boundary markers (new marker text). The former is not a problem with creating DKIM sigs, but the latter will cause DKIM verification failures if the boundary markers are recreated after the DKIM signature is created.

For example, consider the following steps:

  1. Use Email::Stuffer->new to create the "stuffed" email.
  2. Use ->as_string (which calls $self->email) to produce string version of email for Mail::DKIM::Signer
  3. Use ->header() to insert the DKIM Signature. This does not change the email body.
  4. Use ->send (which calls $self->email) to send the email.
    Because ->send calls $self->email, the boundary markers are changed which invalidates the DKIM signature just inserted. I keep getting "body altered" DKIM verification failures because of this.

Method $self->email is called too many times unnecessarily, particularly when the Email::MIME email object is cached in $self->{email} A better approach would be to use the cached object as much as possible, with certain methods "undefing" the cached object (cache invalidation) in {email} to force it to be recreated when needed. This would solve the DKIM verification problem for multi-part emails, and would make the module more performant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions