chasquid icon indicating copy to clipboard operation
chasquid copied to clipboard

Move post-data hook to after alias resolution

Open nolanl opened this issue 4 months ago • 1 comments

I use spamc to filter with Spamassassin, using it's "-u" flag to pass in the user. Unfortunately, with the current order, this means I need to strip the domain off (easy) and then do alias resolution myself (not terribly hard, but annoying). If the resolved user was available as an additional environment variable, this wouldn't be necessary.

Which is really silly since a few milliseconds later Chasquid will be doing the exact same thing!

Alternately, a new, additional hook after alias expansion would work too, as long as I can still add the X-Spam- headers in it.

nolanl avatar Sep 04 '25 00:09 nolanl

Thank you for filing this!

I think this is a reasonable request in principle.

However, there are some complications:

  1. Alias expansion may result in multiple destinations, and some of them may not be emails but pipe commands.
    • Note that even without aliases, there could be multiple destinations already. That wouldn't change but it's important to keep in mind.
    • We need to be careful about how to expose the resulting destinations in a way that's useful and safe/hard to accidentally misuse.
  2. Each alias resolution runs a hook too.
    • Today these run after post-data hook, changing the order is something important to flag in the release notes. There are scenarios where this could be problematic but I don't think that should be a blocker to do it.
  3. This would be a significant code change.
    • Not a problem on itself, but I want to check that the change in complexity is reasonable and worth it for the benefit.

I am going to do a little proof of concept to explore further how this could look, and let you know how it goes!

albertito avatar Sep 05 '25 11:09 albertito