JAVA-088 / Intermediate
Missing Content-Disposition on download responses (MIME sniffing)
Why is this a problem?
Uploaded files interpreted as HTML execute on the same origin.
How to fix it
java
return ResponseEntity.ok()
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition.attachment().filename(name).build().toString())
.header("X-Content-Type-Options", "nosniff")
.contentType(MediaType.APPLICATION_OCTET_STREAM).body(resource);