Shared mailboxes: let Full members manage the mailbox's filters (sort only; forwarding needs an admin) #643

Closed
opened 2026-11-25 20:19:38 +00:00 by jcoffey-dev · 0 comments
Owner

A shared mailbox (MA-S) can't have filters that its members manage. The server already runs a shared mailbox's own active Sieve script when mail arrives (crates/email/src/message/delivery.rs, sieve_script_get_active for every recipient account; sieve/ingest.rs runs it "as written" for shared mailboxes). But only an owner or an Impersonate holder can create one:

  • SieveScript/get, /query, /set (and /validate) call assert_is_member(account_id) (crates/jmap/src/api/request.rs), which a delegate never passes: delegations go into access_to for Mailbox, Email, Calendar, Contacts and FileNode, never member_of. A member with Full access gets Forbidden.
  • The session still advertises urn:ietf:params:jmap:sieve on every shared account (api/session.rs), so clients offer a Filters page that can't work.
  • A member's personal script can't file into the shared mailbox's folders (fileinto resolves in the script owner's account only, falling back to INBOX), so personal rules written for a shared address silently land in the member's Inbox.

The result: mail to shared addresses (hello@, legal@, ops@ …) can't be sorted automatically by the people who work them, and rules people write for it in their own Filters never fire.

What's wanted (decided):

  1. Full delegates manage the shared mailbox's scripts. A member whose delegation on a shared-mailbox lock is Access::Full may SieveScript/get, /query, /set, /validate on that account, including onSuccessActivateScript. Read and Organize members may not (Forbidden, as today). Admins (Impersonate) unchanged.
  2. Sort only, unless an admin saves it. A script saved by a Full delegate who isn't an admin may only file, flag, mark read, discard and stop. A script that forwards or answers mail — redirect (with or without :copy), vacation, notify/enotify, reject/ereject — is refused at SieveScript/set with a clear description ("Forwarding and automatic replies on a shared mailbox can only be saved by an administrator"). Check the compiled script's instructions, not the require line. An admin may save any script; a member then editing it must remove those actions or ask an admin.
  3. Audited. Every create/update/destroy/activate of a script on a shared mailbox is in the audit log with the actor and the shared account (it's a change to where shared mail goes).
  4. Session honesty. Advertise urn:ietf:params:jmap:sieve on a shared account only to members who can use it (Full, or admins).

ManageSieve stays per-account (it can't address another account); out of scope.

Tests: Full member can create + activate a sorting script and mail to the shared address is filed by it; Organize/Read member gets Forbidden; Full member saving redirect/vacation is refused and the active script is unchanged; admin can save one; audit entries recorded; session capability per role.

A shared mailbox (MA-S) can't have filters that its members manage. The server already runs a shared mailbox's own active Sieve script when mail arrives (`crates/email/src/message/delivery.rs`, `sieve_script_get_active` for every recipient account; `sieve/ingest.rs` runs it "as written" for shared mailboxes). But only an owner or an `Impersonate` holder can create one: - `SieveScript/get`, `/query`, `/set` (and `/validate`) call `assert_is_member(account_id)` (`crates/jmap/src/api/request.rs`), which a delegate never passes: delegations go into `access_to` for Mailbox, Email, Calendar, Contacts and FileNode, never `member_of`. A member with **Full** access gets Forbidden. - The session still advertises `urn:ietf:params:jmap:sieve` on every shared account (`api/session.rs`), so clients offer a Filters page that can't work. - A member's personal script can't file into the shared mailbox's folders (`fileinto` resolves in the script owner's account only, falling back to INBOX), so personal rules written for a shared address silently land in the member's Inbox. The result: mail to shared addresses (hello@, legal@, ops@ …) can't be sorted automatically by the people who work them, and rules people write for it in their own Filters never fire. **What's wanted (decided):** 1. **Full delegates manage the shared mailbox's scripts.** A member whose delegation on a shared-mailbox lock is `Access::Full` may `SieveScript/get`, `/query`, `/set`, `/validate` on that account, including `onSuccessActivateScript`. Read and Organize members may not (Forbidden, as today). Admins (`Impersonate`) unchanged. 2. **Sort only, unless an admin saves it.** A script saved by a Full delegate who isn't an admin may only file, flag, mark read, discard and stop. A script that forwards or answers mail — `redirect` (with or without `:copy`), `vacation`, `notify`/`enotify`, `reject`/`ereject` — is refused at `SieveScript/set` with a clear description ("Forwarding and automatic replies on a shared mailbox can only be saved by an administrator"). Check the compiled script's instructions, not the `require` line. An admin may save any script; a member then editing it must remove those actions or ask an admin. 3. **Audited.** Every create/update/destroy/activate of a script on a shared mailbox is in the audit log with the actor and the shared account (it's a change to where shared mail goes). 4. **Session honesty.** Advertise `urn:ietf:params:jmap:sieve` on a shared account only to members who can use it (Full, or admins). ManageSieve stays per-account (it can't address another account); out of scope. Tests: Full member can create + activate a sorting script and mail to the shared address is filed by it; Organize/Read member gets Forbidden; Full member saving `redirect`/`vacation` is refused and the active script is unchanged; admin can save one; audit entries recorded; session capability per role.
jcoffey-dev added this to the 27.1 milestone 2026-11-25 20:19:38 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: inbuxa/inbuxa-server#643