[보안/SER-004] SMS DB 자격증명 하드코딩 제거 + 보안 응답 헤더
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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AbEjijyQdS54xso1d2ks3u
This commit is contained in:
parent
e82e0611c0
commit
6b57520afd
@ -12,6 +12,8 @@ import org.apache.commons.dbcp.PoolingDriver;
|
|||||||
import org.apache.commons.pool.impl.GenericObjectPool;
|
import org.apache.commons.pool.impl.GenericObjectPool;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import egovframework.com.cmm.service.EgovProperties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 문자메시지를 위한 DB Util 클래스 (프레임워크 비종속 버전)
|
* 문자메시지를 위한 DB Util 클래스 (프레임워크 비종속 버전)
|
||||||
* Apache commons의 DBCP를 활용한 예로 각 프로젝트에 맞게 수정 필요
|
* Apache commons의 DBCP를 활용한 예로 각 프로젝트에 맞게 수정 필요
|
||||||
@ -39,12 +41,14 @@ public class SmsBasicDBUtil {
|
|||||||
private static final String JDBC_ALIAS = "default";
|
private static final String JDBC_ALIAS = "default";
|
||||||
/** JDBC Driver 명 */
|
/** JDBC Driver 명 */
|
||||||
private static final String JDBC_DRIVER = "org.gjt.mm.mysql.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 */
|
/** 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 */
|
/** JDBC 접속 사용자ID */
|
||||||
private static final String JDBC_USER = "com";
|
private static final String JDBC_USER = EgovProperties.getProperty("Globals.sms.jdbc.username");
|
||||||
/** JDBC 접속 패스워드 */
|
/** JDBC 접속 패스워드 */
|
||||||
private static final String JDBC_PASSWORD = "com01";
|
private static final String JDBC_PASSWORD = EgovProperties.getProperty("Globals.sms.jdbc.password");
|
||||||
/** 한번에 pool에서 갖다 쓸 수 있는 최대 커넥션 개수 */
|
/** 한번에 pool에서 갖다 쓸 수 있는 최대 커넥션 개수 */
|
||||||
private static final int MAX_ACTIVE = 20;
|
private static final int MAX_ACTIVE = 20;
|
||||||
/** 사용되지 않고 pool에 저정될 수 있는 최대 커넥션 개수 */
|
/** 사용되지 않고 pool에 저정될 수 있는 최대 커넥션 개수 */
|
||||||
|
|||||||
@ -13,6 +13,34 @@
|
|||||||
************************************************************************************************
|
************************************************************************************************
|
||||||
-->
|
-->
|
||||||
<display-name>egovframework default</display-name>
|
<display-name>egovframework default</display-name>
|
||||||
|
|
||||||
|
<!-- [보안/SER-004] 보안 응답 헤더 (Tomcat 내장 필터, 2026.08.31)
|
||||||
|
· X-Frame-Options: SAMEORIGIN — 클릭재킹 방지. 관리자 화면이 같은 출처 iframe 을
|
||||||
|
쓰므로 DENY 가 아닌 SAMEORIGIN(같은 출처 프레임은 허용).
|
||||||
|
· X-Content-Type-Options: nosniff — MIME 스니핑 방지(ZAP 지적 항목).
|
||||||
|
· HSTS 는 HTTP 로컬/혼합 환경 오작동 방지를 위해 off. 운영 HTTPS 전환 시 hstsEnabled=true 로.
|
||||||
|
· 쿠키 HttpOnly 는 Tomcat 기본 적용(Set-Cookie 확인). Secure 는 운영 HTTPS 에서 context useHttpOnly/secure 로. -->
|
||||||
|
<filter>
|
||||||
|
<filter-name>httpHeaderSecurityFilter</filter-name>
|
||||||
|
<filter-class>org.apache.catalina.filters.HttpHeaderSecurityFilter</filter-class>
|
||||||
|
<init-param>
|
||||||
|
<param-name>antiClickJackingOption</param-name>
|
||||||
|
<param-value>SAMEORIGIN</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>blockContentTypeSniffingEnabled</param-name>
|
||||||
|
<param-value>true</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>hstsEnabled</param-name>
|
||||||
|
<param-value>false</param-value>
|
||||||
|
</init-param>
|
||||||
|
</filter>
|
||||||
|
<filter-mapping>
|
||||||
|
<filter-name>httpHeaderSecurityFilter</filter-name>
|
||||||
|
<url-pattern>/*</url-pattern>
|
||||||
|
</filter-mapping>
|
||||||
|
|
||||||
<filter>
|
<filter>
|
||||||
<filter-name>encodingFilter</filter-name>
|
<filter-name>encodingFilter</filter-name>
|
||||||
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
|
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user