Issue Description
With an Enterprise license and two tenants, a user of Tenant A can share a calendar, mailbox or address book with an account of Tenant B via JMAP (shareWith/). The share is accepted, and the Tenant B user then sees the Tenant A account in its session and can read the shared data. The directory itself is isolated correctly (Principal/query only returns the own tenant, foreign ids are notFound), so this looks like a missing tenant check on shareWith.
Setup: two tenants, each with one domain and two user accounts, memberTenantId set on domains and accounts, users with the default User role.
Expected Behavior
Setting shareWith to a principal of a different tenant is rejected (for example invalidProperties or forbidden), the same way the directory hides principals of other tenants. The tenants documentation says that “principals that belong to one tenant cannot reach resources that belong to another” (Tenants | Stalwart), and in Item references with multiple tenants cross-tenant references are described as blocked by design.
Actual Behavior
The share is accepted for Calendar/set, Mailbox/set and AddressBook/set. The Tenant B user sees the Tenant A account in its JMAP session and Calendar/get on that account returns the shared calendar.
In addition, the error reveals which ids exist: shareWith/ fails with invalidProperties (“Account id … is invalid”), while the id of an account in another tenant is accepted. Principal ids are short and sequential, so a user can enumerate principals of other tenants although the directory is hidden.
Reproduction Steps
- Create Tenant A and Tenant B; assign one domain and two user accounts to each (memberTenantId).
- Log in as user A1 (Tenant A) and send:
[“Calendar/set”, {“accountId”: “”, “update”: {“”: {“shareWith/”: {“mayReadItems”: true}}}}, “0”]
where is the principal id of a Tenant B account. - The update succeeds (no notUpdated).
- Log in as B1: the session lists account , Calendar/get on returns the calendar.
- Same result with Mailbox/set and AddressBook/set (shareWith/).
- shareWith/ fails with “Account id … is invalid”, a foreign valid id succeeds.
Relevant Log Output
No errors are logged; all requests succeed.
Stalwart Version
v0.16.x
Installation Method
Binary (Linux)
Database Backend
RocksDB
Blob Storage
RocksDB
Search Engine
Internal
Directory Backend
Internal
Additional Context
Tested on a test instance with an Enterprise trial license, accessed directly via JMAP behind an nginx reverse proxy. Not tested: FileNode and group principals as share targets.
The report was written with the help of an AI assistant (Claude); I checked the steps and results.
I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.
on
I have searched this support forum (open and closed topics) and confirm this is not a duplicate.
on
I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.
on