Skip to content

A check to only allow MAIL FROM same as the authenticated user's username #268

@onprem

Description

@onprem

Use case

With the default configuration, a user can use any email (from the same domain) in the MAIL FROM and it will work. This means that an authenticated user with username user@example.org can send email from admin@example.org. This can become a major concern in environments with multiple tenants.

Your idea for a solution

There are two options that came to my mind:

  • Add a check that can be used to reject a mail of authenticated user and mail from address doesn't match.
  • Add a modifier that overwrites MAIL FROM with the current username.

I think the second option is more desirable and provides better UX, but I don't think it's possible currently. But I was able to simulate the first option by using the command check and a script that exits with status code 1 when it's two arguments don't match in submission section.

check {
     command match {auth_user} {address} {
         run_on sender

         code 1 reject 550 5.7.0 "Use your own name, you imposter"
    }
}
  • I'm willing to help with the implementation

Metadata

Metadata

Assignees

No one assigned

    Labels

    new featureNew feature.ready-for-releaseFeature is implemented and available for testing in dev branch. It will be included in the next rele

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions