Interview Prep/DevSecOps/Vulnerability Management and OWASP

A team stores user uploads in S3 and serves them from the main domain. A tester uploaded an HTML file that ran JavaScript. What do you do?

AdvancedScenarioVulnerability Management and OWASP
Answer

Situation read → Stored XSS through file upload, running in the main app's origin, so it can read session data.

What I'd do →

  1. Serve user content from a separate, cookieless domain (for example usercontent-example.com), so scripts cannot reach app cookies or storage.
  2. Set Content-Disposition: attachment and the correct Content-Type on objects; add X-Content-Type-Options: nosniff.
  3. Validate file types by content (magic bytes), not by extension, and limit allowed types.
  4. Scan uploads for malware (S3 malware protection in GuardDuty, or ClamAV in a Lambda).
  5. Use presigned URLs with short expiry for private files.

Why → Origin isolation is the strongest fix; that is why large providers host user content on separate domains.

Interview tip → Mention the separate-domain pattern; it shows real-world experience.

All DevSecOps questions Roadmap: Security in the pipeline

More on Vulnerability Management and OWASP