feat: accept sheets of up to 5 GB end to end
Some checks failed
Build and deploy / Validate source (push) Successful in 12s
Build and deploy / Integration suite on a real stack (push) Failing after 2m36s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Has been skipped

Sheets of several GB are the normal order. The upload limit is now 5 GB.
ClamAV scans files up to 2 GB; a larger file is released only when its
first bytes match the format its name claims, and a disguised file is
refused. The Site grades a sheet over 150 MB from the pixel size in its
PNG, JPEG or WebP header without decoding it, and reads large PDFs in
ranges. The worker never opens a source over 300 MB: a finished sheet
placed whole becomes its own print file, which the Kanban offers to approve
as the final, and anything else goes to hand preparation. Files start
uploading as they enter the cart, with progress in the summary, and each
part renews the reservation so slow uploads do not expire. Quotas grow to
50 GB per customer and 500 GB in total; the Swarm config for ClamAV is
renamed because a deployed config cannot change in place.

Verified locally with a 386 MB and a 1.8 GB PNG (scanned, paid, original
as print file), a 2.3 GB PNG (format check) and a disguised 2.3 GB file
(refused).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-09-29 13:18:18 -03:00
parent 4437232d27
commit 5f2be7ea20
21 changed files with 329 additions and 54 deletions

View File

@@ -82,10 +82,13 @@ x-app-environment: &app-environment
COOKIE_SECURE: "true"
MAX_UPLOAD_BYTES: "5368709120"
UPLOAD_PART_BYTES: "8388608"
STORAGE_QUOTA_BYTES: "53687091200"
OWNER_UPLOAD_QUOTA_BYTES: "10737418240"
# Sheets of several GB are the normal order, so room for many of them.
STORAGE_QUOTA_BYTES: "${STORAGE_QUOTA_BYTES:-536870912000}"
OWNER_UPLOAD_QUOTA_BYTES: "${OWNER_UPLOAD_QUOTA_BYTES:-53687091200}"
MAX_PENDING_UPLOADS: "10"
SCAN_MAX_BYTES: "134217728"
# ClamAV scans up to this; larger files (up to MAX_UPLOAD_BYTES) are released
# after a file-format check instead (app/scanning.py).
SCAN_MAX_BYTES: "2097152000"
services:
db:
@@ -131,7 +134,7 @@ services:
image: clamav/clamav@sha256:9cb27d7660bdf66e9878c832cb433dd8aa152cfbe16f3c2c0084c80b04ae22b4
entrypoint: [clamd, --foreground=true, --config-file=/etc/clamav/clamd.conf]
configs:
- source: clamd_config
- source: clamd_config_2gb
target: /etc/clamav/clamd.conf
mode: 0444
networks: [backend]
@@ -234,7 +237,9 @@ services:
restart_policy: {condition: on-failure, delay: 5s}
configs:
clamd_config:
# Renamed whenever infra/clamd.conf changes: Swarm cannot update a deployed
# config in place, and a redeploy with new content under the old name fails.
clamd_config_2gb:
file: ./infra/clamd.conf
volumes: