취약점 점검 조치

This commit is contained in:
KNKIM 2021-12-02 17:49:28 +09:00
parent 6fe21dd11e
commit a290246f52
9 changed files with 41 additions and 46 deletions

View File

@ -58,7 +58,7 @@ public interface CartService
* @return * @return
* @throws Exception * @throws Exception
*/ */
public String insertCartItem(CollectionVO cartVO) throws Exception; public String insertCartItem(CollectionVO cartVO);
/** /**
* (비로그인자용) 카트에 추가한다. * (비로그인자용) 카트에 추가한다.

View File

@ -34,7 +34,7 @@ public interface CollectionService {
* @return * @return
* @throws Exception * @throws Exception
*/ */
public CollectionVO getItemInfo(CollectionVO searchVO) throws Exception; public CollectionVO getItemInfo(CollectionVO searchVO);
/** /**
* 목록의 자료정보에 상세정보를 조회하여 설정한 리턴한다. * 목록의 자료정보에 상세정보를 조회하여 설정한 리턴한다.

View File

@ -10,20 +10,20 @@ import nlib.col.service.CollectionVO;
@Mapper("cartDAO") @Mapper("cartDAO")
public interface CartDAO { public interface CartDAO {
public List<CollectionVO> listCartItems(@Param("mbInfoId") String mbInfoId, @Param("cartTypeCd") String cartTypeCd) throws Exception; public List<CollectionVO> listCartItems(@Param("mbInfoId") String mbInfoId, @Param("cartTypeCd") String cartTypeCd);
public int changeCartDiv(CollectionVO cartVO) throws Exception; public int changeCartDiv(CollectionVO cartVO);
public int countCartItem(CollectionVO cartVO) throws Exception; public int countCartItem(CollectionVO cartVO);
public int insertCartItem(CollectionVO cartVO) throws Exception; public int insertCartItem(CollectionVO cartVO);
public int deleteCartItems(CollectionVO cartVO) throws Exception; public int deleteCartItems(CollectionVO cartVO);
public int changeCartType(CollectionVO cartVO) throws Exception; public int changeCartType(CollectionVO cartVO);
public int countCartItems(@Param("mbInfoId") String mbInfoId, @Param("cartTypeCd") String cartTypeCd) throws Exception; public int countCartItems(@Param("mbInfoId") String mbInfoId, @Param("cartTypeCd") String cartTypeCd);
public int changeCartProcDivCd(CollectionVO cartVO) throws Exception; public int changeCartProcDivCd(CollectionVO cartVO);
} }

View File

@ -199,7 +199,7 @@ public class CartServiceImpl implements CartService
* @return * @return
* @throws Exception * @throws Exception
*/ */
public String insertCartItem(CollectionVO cartVO) throws Exception { public String insertCartItem(CollectionVO cartVO) {
cartVO = checkValidCartItem(cartVO); cartVO = checkValidCartItem(cartVO);
@ -285,6 +285,7 @@ public class CartServiceImpl implements CartService
*/ */
public void setCookie(HttpServletResponse response, String name, String value) { public void setCookie(HttpServletResponse response, String name, String value) {
Cookie cookie = new Cookie(name, value); Cookie cookie = new Cookie(name, value);
cookie.setSecure(true);
cookie.setDomain(NlibProperty.getString("cart.cookie.domain")); cookie.setDomain(NlibProperty.getString("cart.cookie.domain"));
cookie.setPath(NlibProperty.getString("cart.cookie.path")); cookie.setPath(NlibProperty.getString("cart.cookie.path"));
response.addCookie(cookie); response.addCookie(cookie);
@ -344,7 +345,7 @@ public class CartServiceImpl implements CartService
* @return * @return
* @throws Exception * @throws Exception
*/ */
public CollectionVO checkValidCartItem(CollectionVO cartVO) throws Exception { public CollectionVO checkValidCartItem(CollectionVO cartVO) {
if(cartVO == null) return new CollectionVO("FCART00", "카트에 추가할 자료 정보가 없습니다."); if(cartVO == null) return new CollectionVO("FCART00", "카트에 추가할 자료 정보가 없습니다.");

View File

@ -61,7 +61,7 @@ public class CollectionServiceImpl implements CollectionService {
* @return * @return
* @throws Exception * @throws Exception
*/ */
public CollectionVO getItemInfo(CollectionVO searchVO) throws Exception { public CollectionVO getItemInfo(CollectionVO searchVO) {
String message = null; String message = null;

View File

@ -218,33 +218,25 @@ public class CartController extends NlibCommonController
int changedCnt = 0; int changedCnt = 0;
try { // 로그인한 경우
if(!StringUtil.isEmpty(mbInfoId)) {
// 로그인한 경우 log.debug("insertCartItemAjax > masterId = " + cartVO.getMasterId());
if(!StringUtil.isEmpty(mbInfoId)) { log.debug("insertCartItemAjax > cartDivCd = " + cartVO.getCartTypeCd());
log.debug("insertCartItemAjax > masterId = " + cartVO.getMasterId()); cartVO.setMbInfoId(mbInfoId);
log.debug("insertCartItemAjax > cartDivCd = " + cartVO.getCartTypeCd()); cartVO.setRegId(mbInfoId);
cartVO.setMbInfoId(mbInfoId); message = cartService.insertCartItem(cartVO);
cartVO.setRegId(mbInfoId); }
message = cartService.insertCartItem(cartVO); // 비회원인 경우
} else {
// 비회원인 경우 message = cartService.insertCartItemToCookie(request, response, cartVO);
else {
message = cartService.insertCartItemToCookie(request, response, cartVO);
}
if(message == null) {
code = "S";
message = "정상적으로 추가되었습니다.";
} else {
code = "F";
}
} catch(Exception e) {
code = "F";
message = "등록되지 않았습니다. : " + e.toString();
} }
if(message == null) {
code = "S";
message = "정상적으로 추가되었습니다.";
} else {
code = "F";
}
//------------------------------- //-------------------------------
// JSON변환 응답 처리 // JSON변환 응답 처리

View File

@ -229,7 +229,7 @@ public interface DataApiInterface {
* @return * @return
* @throws Exception : * @throws Exception :
*/ */
public static DataApiResVO checkReqCommonParams(DataApiReqVO reqVO) throws Exception { public static DataApiResVO checkReqCommonParams(DataApiReqVO reqVO) {
if(reqVO == null) { if(reqVO == null) {
return new DataApiResVO("ERR_NO_REQ", "데이터송수신 요청객체가 존재하지 않습니다."); return new DataApiResVO("ERR_NO_REQ", "데이터송수신 요청객체가 존재하지 않습니다.");

View File

@ -16,6 +16,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.dataformat.xml.XmlMapper; import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import nlib.restful.service.DataApiInterface; import nlib.restful.service.DataApiInterface;
@ -109,8 +110,8 @@ public class DataApiTempXml implements DataApiInterface {
log.debug("RES resVO : resultCode = " + resVO.getResultCode()); log.debug("RES resVO : resultCode = " + resVO.getResultCode());
log.debug("RES resVO : resultMessage = " + resVO.getResultMessage()); log.debug("RES resVO : resultMessage = " + resVO.getResultMessage());
} catch(Exception e) { } catch(JsonProcessingException e) {
log.error("ERROR at DataApiTempXml.request : " + e.toString()); log.error("JsonProcessingException at DataApiTempXml.request : " + e.toString());
return DataApiInterface.makeErrorRes("E_REQ_EXCEPTION", e.toString()); return DataApiInterface.makeErrorRes("E_REQ_EXCEPTION", e.toString());
} }
@ -125,7 +126,7 @@ public class DataApiTempXml implements DataApiInterface {
* @return * @return
* @throws Exception * @throws Exception
*/ */
private String getTempDataFromXmlFile(DataApiReqVO reqVO) throws Exception { private String getTempDataFromXmlFile(DataApiReqVO reqVO) throws JsonProcessingException {
HttpMethod method = reqVO.getReqMethod(); HttpMethod method = reqVO.getReqMethod();
String fileName = reqVO.getReqUrl().substring(1).replaceAll("/", "."); String fileName = reqVO.getReqUrl().substring(1).replaceAll("/", ".");
@ -163,8 +164,6 @@ public class DataApiTempXml implements DataApiInterface {
returnXmlStr = strBd.toString(); returnXmlStr = strBd.toString();
} catch (IOException e) { } catch (IOException e) {
log.error("XML 파일 읽는 중 오류 발생 : " + e.toString()); log.error("XML 파일 읽는 중 오류 발생 : " + e.toString());
e.printStackTrace();
resVO = new DataApiServerResponseVO("-22", String.format("%s 파일을 읽는 중 오류가 발생하였습니다(%s). ",xmlPath, e.toString())); resVO = new DataApiServerResponseVO("-22", String.format("%s 파일을 읽는 중 오류가 발생하였습니다(%s). ",xmlPath, e.toString()));
XmlMapper mapper = new XmlMapper(); XmlMapper mapper = new XmlMapper();
returnXmlStr = mapper.writer().withRootName(DataApiVO.XML_EL_NAME_ROOT_NAME).writeValueAsString(resVO); returnXmlStr = mapper.writer().withRootName(DataApiVO.XML_EL_NAME_ROOT_NAME).writeValueAsString(resVO);

View File

@ -171,6 +171,9 @@ public class LoginServiceImpl implements LoginService
nlibLoginVO.setJoinCouncilNm((String)session.getAttribute("councilNm")); nlibLoginVO.setJoinCouncilNm((String)session.getAttribute("councilNm"));
OAuthUniversalUser ousr = SessionConfig.getLoginInfo(sessionId); OAuthUniversalUser ousr = SessionConfig.getLoginInfo(sessionId);
if(ousr == null) {
throw new Exception("잘모된 접근으로 사용자 로그인 정보를 확인할 수 없습니다.");
}
nlibLoginVO.setSnsType(ousr.getSnsType()); nlibLoginVO.setSnsType(ousr.getSnsType());
// 실제 SecurityContext authentication 정보를 등록한다. // 실제 SecurityContext authentication 정보를 등록한다.