1
0
mirror of https://github.com/Mailu/Mailu.git synced 2026-05-22 10:15:19 +02:00
Files
Mailu/core
bors-mailu[bot] b0bb7144a4 Merge #4023
4023: enhancement: checks for anonmail access and ensure no wildcard collisions r=nextgens a=lhw

## What type of PR?

Enhancement to resolve remaining comments from #3968

## What does this PR do?

- Simplifies the anonmail has_access checks (removed some duplicate checks for global admin
- Fixes the alias generation check to avoid collisions with wildcard aliases

Two Notes:
The `Alias.resolve` would make domains that have catch alls with `%`@domain`` essentially non-functional for anonmail generation, even if allowed as it would return an alias for every single call. Aliases are matched by length with explicit matches first and then by length of match if got this right:
```
.order_by(cls.wildcard, sqlalchemy.func.char_length(cls.localpart).desc())
```
Question is if that is what we want here. 

Second note. Right now the match with `Alias.resolve` requires the extra check against the alias db anyhow due to disabled aliases not being listed by `Alias.resolve` and causing a collision. An optional change would be to introduce a form of `Alias.resolve_any` or an optional parameter to `Alias.resolve(cls, localpart, domain_name, list_disabled=False)` e.g.

### Related issue(s)
- #3968 

## Prerequisites
Before we can consider review and merge, please make sure the following list is done and checked.
If an entry in not applicable, you can check it or remove it from the list.

- [ ] In case of feature or enhancement: documentation updated accordingly
- [ ] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/workflow.html#changelog) entry file.


Co-authored-by: Lennart Weller <lhw@ring0.de>
2026-05-15 11:20:36 +00:00
..
2026-05-15 11:20:36 +00:00
2026-05-11 15:35:53 +00:00