Keep an account's disk quota within its tenant's #494

Merged
jcoffey-dev merged 1 commits from fix/tenant-disk-quota into main 2026-11-20 01:54:25 +00:00
Owner

Fixes inbuxa/inbuxa-admin#257, reported by @bultester.

A tenant admin could give an account more disk space than the whole tenant has. The server now refuses that, for any admin, with a message naming both sizes, and the console shows it under the quota field. Accounts that are already over a lowered tenant limit keep their quota until someone edits it, and leaving the quota empty still means the account shares the tenant's space.

JMAP Quota/get and IMAP GETQUOTA now report the limit the account will actually hit (its own quota or what's left in the tenant), the way DAV already did, so the webmail stops showing space that isn't there.

Tenant, system, IMAP and WebDAV suites pass locally.

Fixes inbuxa/inbuxa-admin#257, reported by @bultester. A tenant admin could give an account more disk space than the whole tenant has. The server now refuses that, for any admin, with a message naming both sizes, and the console shows it under the quota field. Accounts that are already over a lowered tenant limit keep their quota until someone edits it, and leaving the quota empty still means the account shares the tenant's space. JMAP Quota/get and IMAP GETQUOTA now report the limit the account will actually hit (its own quota or what's left in the tenant), the way DAV already did, so the webmail stops showing space that isn't there. Tenant, system, IMAP and WebDAV suites pass locally.
jcoffey-dev added this to the 27.1 milestone 2026-11-20 01:39:48 +00:00
jcoffey-dev added 1 commit 2026-11-20 01:39:48 +00:00
Keep an account's disk quota within its tenant's (inbuxa-admin#257)
ci / fork-checks (pull_request) Skipped
ci / build (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 14m6s
0885753efe
A tenant administrator could give an account any disk quota, even ten
times the tenant's own. Writes still stopped at the tenant's limit, but
the account's mail was refused as over quota while the webmail showed
most of its 50 GB free.

- x:Account/set (JMAP and SCIM) refuses an account disk quota above its
  tenant's maxDiskQuota with invalidProperties on quotas, naming both
  sizes, whoever writes it. Checked when the quota is set or changed or
  the account changes tenant: an account already over a lowered tenant
  limit keeps it until someone edits it, like the count limits (MT-18).
  No quota stays allowed (the account shares the tenant's space).
  Accounts a directory creates at sign-in and restored accounts aren't
  checked, so neither is refused for a setting nobody can edit first.
- JMAP Quota/get and IMAP GETQUOTA report the limit the account will
  really meet: its own quota or its tenant's remaining space, whichever
  comes first, as DAV already did. One helper, effective_disk_quota,
  serves all three. An account with no quota of its own in a limited
  tenant now gets a Quota object too.

Tests: the tenant suite covers refusals for the tenant and server
administrators, an update over the limit, an unrelated edit to an
account over a lowered limit, and Quota/get for a member without a
quota.
jcoffey-dev merged commit 74bc74bcb0 into main 2026-11-20 01:54:25 +00:00
jcoffey-dev deleted branch fix/tenant-disk-quota 2026-11-20 01:54:25 +00:00
jcoffey-dev referenced this issue from a commit 2026-11-20 01:59:38 +00:00
Sign in to join this conversation.