Skip to Content
LYNKORIADocs

ADR 020: Attachment quarantine keys

  • Status: Accepted
  • Owner: Eng lead
  • Date: 2026-11-13

Context

Clients upload attachments with a presigned PUT that is valid for 5 minutes. Before this decision, the upload key was also the download key. A client could complete an upload (which scans it), then reuse the still-valid presigned URL to overwrite the object with unscanned bytes of the same size and type. Downloads would then serve the replaced file. A regression test reproduced this.

Decision

Clients upload to quarantine/<objectKey>. Completion reads the quarantined bytes, scans them, and the server writes exactly those bytes to <objectKey> (the only key downloads use), then deletes the quarantine object. Without a scanner, completion performs a server-side copy. Retention cleanup deletes both keys.

Consequences

  • Served bytes are always bytes the server wrote after verification; re-uploads land only in quarantine.
  • One extra object write per attachment; the scanner path already holds the file in memory.
  • Uploads started before the deploy and completed after it fail with "Upload not found" and must be retried.
  • A bucket lifecycle rule should expire quarantine/ objects after one day (OpenTofu applies it: infra/opentofu/platform/storage.tf).

On this page