Decision 0004 · Accepted · 2026-11-22

Validate images by content, reject SVG, strip metadata

Context

Visitors upload files that are later stored, forwarded to Slack and served back to browsers. File names and declared content types are controlled by the sender, SVG can carry script, and phone photos often embed GPS coordinates.

Options considered

  1. Trust the extension or declared content type: trivially bypassed.
  2. Accept any file and rely on serving headers: still stores and forwards untrusted content.
  3. Identify the format from the bytes, allow a fixed list of raster formats, strip metadata where it is safe to do so, and serve defensively.

Decision

Option 3. Formats are recognised by signature (PNG, JPEG, GIF, WebP, AVIF, HEIC, BMP, TIFF); everything else, including SVG, is rejected. JPEG EXIF and XMP segments are removed before storage. Responses use nosniff, a CSP of default-src 'none'; sandbox, and inline display only for formats browsers render safely, otherwise as an attachment.

Consequences

← 0003 Sync replies with Socket Mode events plus a periodic reconcile0005 Layer abuse controls instead of relying on one →