웹 취약점 : 누락된 콘텐츠 - Content-Type 헤더에 추가

This commit is contained in:
hylee 2024-07-04 10:36:56 +09:00
parent 7481d5d1df
commit 3856b740cd
2 changed files with 21 additions and 2 deletions

View File

@ -1,9 +1,15 @@
package kcc.com.cmm;
import egovframework.rte.fdl.cmmn.exception.handler.ExceptionHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import egovframework.rte.fdl.cmmn.exception.handler.ExceptionHandler;
/**
* @Class Name : EgovComExcepHndlr.java
@ -20,10 +26,22 @@ import org.slf4j.LoggerFactory;
* @see
*
*/
@ControllerAdvice
public class EgovComExcepHndlr implements ExceptionHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(EgovComExcepHndlr.class);
@RequestMapping("/common/error.jsp")
@ResponseBody
public ResponseEntity<String> notFound() {
HttpHeaders headers = new HttpHeaders();
headers.add(HttpHeaders.CONTENT_TYPE, "application/json");
return new ResponseEntity<>("{\"error\": \"Resource not found\"}", headers, HttpStatus.NOT_FOUND);
}
/**
* 발생된 Exception을 처리한다.
*/

View File

@ -48,6 +48,7 @@
<mvc:view-controller path="/cmmn/validator.do" view-name="cmmn/validator"/>
<mvc:annotation-driven/>
<context:component-scan base-package="kcc.com.cmm" />
<!-- System Log Aspect -->
<bean id="syslog" class="kcc.let.sym.log.lgm.service.EgovSysLogAspect" />
<aop:config>