This website is under development — some content and data may be incomplete or inaccurate.

Learn more
USystems logo

Hardening Uploads End to End

Nadia Rahimi

Security Engineer

19 May 20264 min read

Hardening Uploads End to End

A health platform handles some of the most sensitive files there are: lab reports, scanned prescriptions, identity documents, radiology images. File upload is also one of the easiest paths to abuse, so we treat every byte the client sends as untrusted and validate it at every layer.

Trust nothing the client sends

At the edge we enforce strict size limits and an allow-list of content types, rejecting anything whose real, sniffed type does not match its extension. A file named report.pdf that is actually a script never makes it past the door.

Clean before you keep

Files are scanned and rewritten before they ever reach permanent storage. Images are re-encoded to strip embedded scripts and normalise metadata; documents are validated against their declared format. What we store is a known-good copy, not whatever arrived.

  • Content-type allow-listing with magic-byte sniffing, not just file extensions.
  • Image re-encoding and metadata stripping to remove hidden payloads.
  • Served files come from an isolated origin with locked-down headers, so a malicious upload can never execute in the app.

Access is part of security

Storage safety is only half the job. Role-based access controls decide who can see each file, so a pharmacist and a cashier do not share the same view of a patient’s documents. Defence in depth means assuming any single layer can fail — and making sure the next one holds.