Tenant can allocate bigger disk space to an account than available. #257

Closed
opened 2026-11-20 01:03:09 +00:00 by bultester · 6 comments

If you create in inbuxa-admin a tenat with a quota that sets a "Maximum disk space allocated (bytes)" the tenant's admin can create an account with any quota.

So you can have a tenant with 5 GB as max size, but in that tenant domain you can find an user with 50 GB quota.

That user won't be able to use more than 5 GB, that user can use all tenant's assigned size, but no more.

This is confusing and dangerous, tenants shouldn't be able to overprovisioning disk space.

If you create in inbuxa-admin a tenat with a quota that sets a "Maximum disk space allocated (bytes)" the tenant's admin can create an account with any quota. So you can have a tenant with 5 GB as max size, but in that tenant domain you can find an user with 50 GB quota. That user won't be able to use more than 5 GB, that user can use all tenant's assigned size, but no more. This is confusing and dangerous, tenants shouldn't be able to overprovisioning disk space.
jcoffey-dev added the bug
priority
p2
labels 2026-11-20 01:15:17 +00:00
jcoffey-dev self-assigned this 2026-11-20 01:15:17 +00:00
jcoffey-dev added this to the 27.1 milestone 2026-11-20 01:15:17 +00:00
Owner

Thanks @bultester, good catch. Fixed in inbuxa/inbuxa-server#494: the server now refuses an account disk quota bigger than its tenant's, whoever sets it, and the console shows why under the quota field. Webmail and mail apps also report the space the account can really use, so you won't see 45 GB free in a 5 GB tenant anymore. Accounts already set too high keep their quota until someone edits them. It'll be in the next 27.1 release candidate.

Thanks @bultester, good catch. Fixed in inbuxa/inbuxa-server#494: the server now refuses an account disk quota bigger than its tenant's, whoever sets it, and the console shows why under the quota field. Webmail and mail apps also report the space the account can really use, so you won't see 45 GB free in a 5 GB tenant anymore. Accounts already set too high keep their quota until someone edits them. It'll be in the next 27.1 release candidate.
Author

Tenant can still do overprovisioning by creating multiple accounts of max tenant size each.
In example a 5GB tenant can create four accounts and allocate 5 GB to each one. So the tenant actually allocated 20 GB which is much more than allocated to tenant.

Tenant can still do overprovisioning by creating multiple accounts of max tenant size each. In example a 5GB tenant can create four accounts and allocate 5 GB to each one. So the tenant actually allocated 20 GB which is much more than allocated to tenant.
Owner

You're right, thanks @bultester. #494 only checked each account against the tenant, never the total. Reopening.

The fix is in inbuxa/inbuxa-server#497: the quotas set on a tenant's accounts now have to add up to no more than the tenant's own. Accounts with no quota are still allowed and share what's left. While I was in there I closed the other ways around it too: restoring a deleted account after giving its space away, moving a domain with quota'd accounts into the tenant, and two writes landing at the same moment. Lowering a quota always works, even in a tenant that's already over. I'll close this once it's merged; it'll be in the next 27.1 release candidate.

You're right, thanks @bultester. #494 only checked each account against the tenant, never the total. Reopening. The fix is in inbuxa/inbuxa-server#497: the quotas set on a tenant's accounts now have to add up to no more than the tenant's own. Accounts with no quota are still allowed and share what's left. While I was in there I closed the other ways around it too: restoring a deleted account after giving its space away, moving a domain with quota'd accounts into the tenant, and two writes landing at the same moment. Lowering a quota always works, even in a tenant that's already over. I'll close this once it's merged; it'll be in the next 27.1 release candidate.
Owner

Merged in inbuxa/inbuxa-server#497. It'll be in the next 27.1 release candidate. Closing again; thanks for catching it.

Merged in inbuxa/inbuxa-server#497. It'll be in the next 27.1 release candidate. Closing again; thanks for catching it.
Owner

Reopening. This report started a full review of tenant limits, and that review found more ways around them. The fixes are tracked here, and this stays open until all of them land.

Done:

  • inbuxa/inbuxa-server#494 and #497: account disk quotas must fit the tenant, one at a time and in total, including restores, domain moves and simultaneous writes.

In progress (PRs will link back here):

  • Count limits (accounts, groups, domains, mailing lists and so on) can be passed by sending creates at the same moment. They'll get the same per-tenant lock as the disk quota.
  • Copying a single calendar event or contact into another account over CalDAV/CardDAV skips the quota check.
  • Usage from calendar, file and sieve writes and from deletes is counted against the writer's tenant rather than the owner's. Destroying an account never subtracts its usage from the tenant, and a tenant recount leaves out deleted accounts that are still kept.
  • Kept deleted items (undelete) and held spam-training copies don't count toward the quota, so filling, deleting and filling again stored more than the limit. They'll count from now on.
  • Smaller overshoots: parallel writes, encrypted mail being stored larger than the size that was checked, calendar invitations, and the vacation script.

All of it is aimed at the next 27.1 release candidate.

Reopening. This report started a full review of tenant limits, and that review found more ways around them. The fixes are tracked here, and this stays open until all of them land. Done: - inbuxa/inbuxa-server#494 and #497: account disk quotas must fit the tenant, one at a time and in total, including restores, domain moves and simultaneous writes. In progress (PRs will link back here): - Count limits (accounts, groups, domains, mailing lists and so on) can be passed by sending creates at the same moment. They'll get the same per-tenant lock as the disk quota. - Copying a single calendar event or contact into another account over CalDAV/CardDAV skips the quota check. - Usage from calendar, file and sieve writes and from deletes is counted against the writer's tenant rather than the owner's. Destroying an account never subtracts its usage from the tenant, and a tenant recount leaves out deleted accounts that are still kept. - Kept deleted items (undelete) and held spam-training copies don't count toward the quota, so filling, deleting and filling again stored more than the limit. They'll count from now on. - Smaller overshoots: parallel writes, encrypted mail being stored larger than the size that was checked, calendar invitations, and the vacation script. All of it is aimed at the next 27.1 release candidate.
Owner

All the fixes from the tenant-limits review have landed, so I'm closing this. Thanks again @bultester for the report that started it.

  • inbuxa/inbuxa-server#494, #497: account disk quotas fit the tenant, one at a time and in total, including restores, domain moves and simultaneous writes. (27.1-rc.34, 27.1-rc.35)
  • inbuxa/inbuxa-server#501: count limits (accounts, groups, domains and the rest) are held under the same per-tenant lock, so simultaneous creates can't pass them. An object moved into a tenant counts against its limits, and DKIM keys added later count toward maxDkimKeys. (27.1-rc.35)
  • inbuxa/inbuxa-server#502: kept deleted items count toward usage while they're kept, held spam-training copies let go once the account's own copy is gone, and encrypted mail, invitations and vacation replies are checked at their real size. (27.1-rc.35)
  • inbuxa/inbuxa-server#507, #508: usage follows the account that owns the data, destroying an account takes its usage off its tenant, a recount includes kept deleted accounts, single-item CalDAV/CardDAV copies and moves check quota, and DAV writes are checked at the size they're charged. Along the way we found that destroying an account could reset the usage of an unrelated tenant with the same number; that's fixed too. (27.1-rc.36)

After upgrading to 27.1-rc.36, run a tenant quota recount once to correct any counter that was reset before.

One small overshoot is left on purpose: writes landing at the same instant can each pass the check before any of them is saved, so a tenant can end up one burst of writes past its limit, after which everything is refused. Closing that would mean refusing (and bouncing) mail for a moment after every write.

All the fixes from the tenant-limits review have landed, so I'm closing this. Thanks again @bultester for the report that started it. - inbuxa/inbuxa-server#494, #497: account disk quotas fit the tenant, one at a time and in total, including restores, domain moves and simultaneous writes. (27.1-rc.34, 27.1-rc.35) - inbuxa/inbuxa-server#501: count limits (accounts, groups, domains and the rest) are held under the same per-tenant lock, so simultaneous creates can't pass them. An object moved into a tenant counts against its limits, and DKIM keys added later count toward `maxDkimKeys`. (27.1-rc.35) - inbuxa/inbuxa-server#502: kept deleted items count toward usage while they're kept, held spam-training copies let go once the account's own copy is gone, and encrypted mail, invitations and vacation replies are checked at their real size. (27.1-rc.35) - inbuxa/inbuxa-server#507, #508: usage follows the account that owns the data, destroying an account takes its usage off its tenant, a recount includes kept deleted accounts, single-item CalDAV/CardDAV copies and moves check quota, and DAV writes are checked at the size they're charged. Along the way we found that destroying an account could reset the usage of an unrelated tenant with the same number; that's fixed too. (27.1-rc.36) After upgrading to 27.1-rc.36, run a tenant quota recount once to correct any counter that was reset before. One small overshoot is left on purpose: writes landing at the same instant can each pass the check before any of them is saved, so a tenant can end up one burst of writes past its limit, after which everything is refused. Closing that would mean refusing (and bouncing) mail for a moment after every write.
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: inbuxa/inbuxa-admin#257