← Alle Vorlagen

Uploads direkt in den Speicher, Größen- und Typgrenzen, Malware-Scan, Vorschaubilder.

Spec — File uploads

Status: draft · Created: 2026-11-10

1. Context and goal

People attach files and images without the bytes passing through the API servers, and nobody receives a file before it is checked.

2. Functional requirements (EARS)

  • FR-1: WHEN a client asks to upload, THE SYSTEM SHALL check the name, size and declared type, and return a presigned URL for one object key that is valid for 15 minutes.
  • FR-2: THE SYSTEM SHALL allow only the configured types (for example JPEG, PNG, WebP and PDF) up to 25 MB, and answer 422 naming the broken limit otherwise.
  • FR-3: THE SYSTEM SHALL bind the presigned URL to the declared size and type, so storage rejects an upload that differs from them.
  • FR-4: WHEN an upload completes, THE SYSTEM SHALL detect the real type from the file's content and reject the file if it differs from the declared type.
  • FR-5: WHEN an upload completes, THE SYSTEM SHALL scan it for malware within 60 seconds and keep it in quarantine, not downloadable, until the scan passes.
  • FR-6: IF the scan finds malware, THEN THE SYSTEM SHALL delete the file, mark the upload rejected and tell the uploader.
  • FR-7: WHEN an image passes the scan, THE SYSTEM SHALL create 256 px and 1024 px thumbnails with EXIF metadata removed within 30 seconds.
  • FR-8: THE SYSTEM SHALL serve files only through signed URLs valid for 5 minutes to callers who may read them, with Content-Disposition: attachment for anything that is not an image.
  • FR-9: THE SYSTEM SHALL delete uploads that were never confirmed after 24 hours.

3. Out of scope

  • Resumable uploads of files over 25 MB.
  • Video transcoding.