Move to junk shall be last in dovecot .sieve recipe
The "Move to Junk" setting in mailbox settings creates a .sieve recipe at the beginning of the mail. This prevents user to add exception rules for whitelisting recipients or doing any other filter work, because filters are inserted after the Move to Junk rule.
It would probable be preferable to have the Move to Junk last in the .sieve so that the user can insert other rules that will modify the move-to-junk default.
There's a thread related to this issue here: https://www.howtoforge.com/community/threads/spamfilter-per-user-whitelist.76421/
This is an example of the currently created .sieve which illustrates the problem:
require ["fileinto", "regex", "vacation"];
if header :contains "X-Spam-Flag" "YES" { fileinto "Junk"; stop; }
if header :regex ["from"] ["^whitelisted@sender.org$"] { fileinto "INBOX"; stop; } keep;