IT Security/Secure Coding
[Secure Coding] 언어별 no-cache 설정
준셰이
2018. 12. 30. 16:36
웹 브라우저에서의 캐싱 방지 방법
※ 캐싱 방지를 하지 않을 경우의 보안상의 문제점
- 웹 서비스 내 주요 정보 및 민감 정보를 다루는 페이지가 존재할 경우 해당 페이지의 캐싱 방지 설정이 없다면,
로그아웃 등의 사용자 인증이 만료된 이후에도 브라우저 내 "뒤로가기" 등을 통해 사용자의 올바른 인증 없이 주요 페이지에 접근이 가능해집니다.
주요/민감 정보들이 악의적 사용자에게 노출될 가능성이 있기 때문에 캐싱 방지를 해야합니다.
각 언어별 no-cache 설정방법은 언어별 문법 형태의 차이만 있을뿐 설정 방법은 동일하다.
제목 |
설명 |
첫번째 속성 (Cache-Control) |
HTTP 1.1 에서의 no-cache 설정 방법 |
두번째 속성 (Pragma) |
HTTP 1.0 에서 no-cache 설정을 위해 사용되는 값 |
세번째 속성 (Expires) |
캐싱 만료 시간 지정 "-1" 설정 시 캐시가 되지 않음 |
[JSP]
1 2 3 4 5 | <% response.setHeader("Cache-Control", "no-cache, no-store"); response.setHeader("Pragma", "no-cache"); response.setDateHeader("Expires", -1); %> | cs |
[PHP]
1 2 3 4 5 | <%php header(‘Cache-Control: no-cache, no-store’); header(‘Pragma: no-cache’); header(‘Expires: -1’); %> | cs |
[ASP]
1 2 3 4 5 | <% Response.AddHeader "Cache-Control","no-store, no-cache" Response.AddHeader "Pragma", "no-cache" Response.Expires = -1 %> | cs |
[ASP.NET]
1 2 3 4 5 | <% Response.Cache.AppendCacheExtension("no-store"); Response.AppendHeader("Pragma", "no-cache"); Response.AppendHeader("Expires", "-1"); // %> | cs |
참고 사이트 : https://support.microsoft.com/ko-kr/help/234067/how-to-prevent-caching-in-internet-explorer