JAVA-088 / 중급
파일 다운로드 응답의 Content-Disposition 미설정 (MIME 스니핑)
왜 문제가 될까요?
HTML로 해석되는 업로드 파일이 같은 출처에서 실행된다.
이렇게 수정하세요
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);