DAV PUT: check the size an item is charged, not its body (#499) #508

Merged
jcoffey-dev merged 1 commits from fix/dav-put-charged-size into main 2026-11-20 20:10:40 +00:00
Owner

Part of the inbuxa/inbuxa-admin#257 remediation (Refs inbuxa/inbuxa-admin#257). Refs #499; follows #507.

A CalDAV, CardDAV or WebDAV PUT checked the account's quota, and its tenant's, against the bare body length. The item is charged more: its names, properties and record as well. So a PUT that fit by body length could go past the limit, by a few hundred bytes per item for an event. Creating and updating events, cards and files now check the size the item is charged, the same figure the usage counters move by. #507 did the same for COPY and MOVE.

  • A file's check now comes before its blob is written, so a refused PUT stores nothing.
  • A new item is checked even when its body is empty, since it's still charged for the rest.

No CHANGELOG entry: the next version PR adds it.

Tests

  • The webdav PUT quota loop now checks usage never goes past the quota, where it used to expect success whenever the body fit. Each type gets its own room, since deleted items stay counted while they're kept.
  • New: a PUT with room for its body but not for its charge is refused, and usage stays as it was.
  • Failed before the fix (a file PUT went past the quota); passes after. The tenant suite passes too.
Part of the inbuxa/inbuxa-admin#257 remediation (Refs inbuxa/inbuxa-admin#257). Refs #499; follows #507. A CalDAV, CardDAV or WebDAV PUT checked the account's quota, and its tenant's, against the bare body length. The item is charged more: its names, properties and record as well. So a PUT that fit by body length could go past the limit, by a few hundred bytes per item for an event. Creating and updating events, cards and files now check the size the item is charged, the same figure the usage counters move by. #507 did the same for COPY and MOVE. - A file's check now comes before its blob is written, so a refused PUT stores nothing. - A new item is checked even when its body is empty, since it's still charged for the rest. No CHANGELOG entry: the next version PR adds it. ## Tests - The webdav PUT quota loop now checks usage never goes past the quota, where it used to expect success whenever the body fit. Each type gets its own room, since deleted items stay counted while they're kept. - New: a PUT with room for its body but not for its charge is refused, and usage stays as it was. - Failed before the fix (a file PUT went past the quota); passes after. The tenant suite passes too.
jcoffey-dev added this to the 27.1 milestone 2026-11-20 19:46:20 +00:00
jcoffey-dev added 1 commit 2026-11-20 19:46:21 +00:00
DAV PUT: check the size an item is charged, not its body (#499)
ci / fork-checks (pull_request) Skipped
ci / build (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 23m27s
47784bec2b
Part of the inbuxa/inbuxa-admin#257 remediation (Refs inbuxa/inbuxa-admin#257).

A CalDAV, CardDAV or WebDAV PUT checked the account's quota, and its
tenant's, against the bare body length, while the item is charged
more: its names, properties and record as well. So a PUT that fit by
body length went past the limit, by a few hundred bytes per item for
an event. Creating and updating events, cards and files now check the
size the item is charged, the same figure the usage counters move by.

A file's check now comes before its blob is written, so a refused PUT
stores nothing. A new item is checked even when its body is empty,
since it's still charged for the rest.

Tests: the webdav PUT quota loop now checks usage never goes past the
quota (instead of expecting success whenever the body fits), giving
each type its own room since deleted items stay counted while kept;
and a PUT with room for its body but not for its charge is refused,
leaving usage as it was. Failed before the fix (a file PUT went past
the quota; an edge PUT was created).

Refs #499
jcoffey-dev merged commit bd4552ec71 into main 2026-11-20 20:10:40 +00:00
jcoffey-dev deleted branch fix/dav-put-charged-size 2026-11-20 20:10:41 +00:00
Sign in to join this conversation.