From 6b57520afda7d7b782fe398a729aeafca4022514 Mon Sep 17 00:00:00 2001 From: infraurp Date: Mon, 31 Aug 2026 10:31:41 +0900 Subject: [PATCH] =?UTF-8?q?[=EB=B3=B4=EC=95=88/SER-004]=20SMS=20DB=20?= =?UTF-8?q?=EC=9E=90=EA=B2=A9=EC=A6=9D=EB=AA=85=20=ED=95=98=EB=93=9C?= =?UTF-8?q?=EC=BD=94=EB=94=A9=20=EC=A0=9C=EA=B1=B0=20+=20=EB=B3=B4?= =?UTF-8?q?=EC=95=88=20=EC=9D=91=EB=8B=B5=20=ED=97=A4=EB=8D=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1) 계정정보 하드코딩 (CWE-798) - SmsBasicDBUtil 의 JDBC URL/USER/PASSWORD 소스 하드코딩 제거 → EgovProperties(Globals.sms.jdbc.url/username/password)로 외부화. ※ globals-*.properties 는 .gitignore 대상(자격증명 미추적)이므로, 배포 환경마다 아래 키를 별도 설정해야 한다: Globals.sms.jdbc.url / .username / .password 2) 보안 응답 헤더 (CWE-693 등) - web.xml 에 Tomcat HttpHeaderSecurityFilter 추가. X-Frame-Options: SAMEORIGIN(관리자 iframe 사용 → DENY 아님), X-Content-Type-Options: nosniff. HSTS 는 HTTP 환경 오작동 방지로 off(운영 HTTPS 시 on). - 쿠키 HttpOnly 는 Tomcat 기본 적용 확인(추가 조치 불요). Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01AbEjijyQdS54xso1d2ks3u --- .../cop/sms/service/impl/SmsBasicDBUtil.java | 10 +++++-- src/main/webapp/WEB-INF/web.xml | 28 +++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/main/java/egovframework/com/cop/sms/service/impl/SmsBasicDBUtil.java b/src/main/java/egovframework/com/cop/sms/service/impl/SmsBasicDBUtil.java index 9e99c8b..0368814 100644 --- a/src/main/java/egovframework/com/cop/sms/service/impl/SmsBasicDBUtil.java +++ b/src/main/java/egovframework/com/cop/sms/service/impl/SmsBasicDBUtil.java @@ -12,6 +12,8 @@ import org.apache.commons.dbcp.PoolingDriver; import org.apache.commons.pool.impl.GenericObjectPool; import org.apache.log4j.Logger; +import egovframework.com.cmm.service.EgovProperties; + /** * 문자메시지를 위한 DB Util 클래스 (프레임워크 비종속 버전) * Apache commons의 DBCP를 활용한 예로 각 프로젝트에 맞게 수정 필요 @@ -39,12 +41,14 @@ public class SmsBasicDBUtil { private static final String JDBC_ALIAS = "default"; /** JDBC Driver 명 */ private static final String JDBC_DRIVER = "org.gjt.mm.mysql.Driver"; + /* [보안/SER-004] SMS 발송 DB 접속정보 하드코딩(CWE-798) 제거 — 프로퍼티(globals)로 외부화. + Globals.sms.jdbc.url / .username / .password 로 설정한다(환경별 분리·암호화 계층 이관). */ /** JDBC 접속 URL */ - private static final String JDBC_URL = "jdbc:mysql://192.168.200.24:1621/com"; + private static final String JDBC_URL = EgovProperties.getProperty("Globals.sms.jdbc.url"); /** JDBC 접속 사용자ID */ - private static final String JDBC_USER = "com"; + private static final String JDBC_USER = EgovProperties.getProperty("Globals.sms.jdbc.username"); /** JDBC 접속 패스워드 */ - private static final String JDBC_PASSWORD = "com01"; + private static final String JDBC_PASSWORD = EgovProperties.getProperty("Globals.sms.jdbc.password"); /** 한번에 pool에서 갖다 쓸 수 있는 최대 커넥션 개수 */ private static final int MAX_ACTIVE = 20; /** 사용되지 않고 pool에 저정될 수 있는 최대 커넥션 개수 */ diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index 64306a0..e0354c2 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -13,6 +13,34 @@ ************************************************************************************************ --> egovframework default + + + + httpHeaderSecurityFilter + org.apache.catalina.filters.HttpHeaderSecurityFilter + + antiClickJackingOption + SAMEORIGIN + + + blockContentTypeSniffingEnabled + true + + + hstsEnabled + false + + + + httpHeaderSecurityFilter + /* + + encodingFilter org.springframework.web.filter.CharacterEncodingFilter