Quota / rate-limit for POST /api/v1/uploads #24
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
posta/server#24
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
`POST /api/v1/uploads` (#22) is authenticated but has no per-token
quota or rate limit. A compromised bearer token, or a buggy client
retrying with re-encoded bytes (fresh hash each time → idempotency
doesn't help), can fill the daemon's disk:
(filed separately), so the floor never moves down.
Options
uploads owned by a token; reject `POST /uploads` with 413 once the
threshold is exceeded. Needs a token-id column on uploads and a
quota config knob. Most informative for clients.
token bucket pattern already used by `api.IPRateLimiter`. Cheaper to
implement but doesn't bound total bytes — N requests under the limit
still equals N × 10 MiB.
Cheap, but punishes shared-IP devices.
Recommend (1) for production, (2) as a stopgap if it lands sooner.
Acceptance
with `error: "quota-exceeded"` (or similar stable code).
file per identity and shouldn't count).
Related: #22, follow-up to the upload-quota item in the PR #22 review.