Improve cookie security; Secure flag

SSL 항상 사용 옵션인 경우 쿠키도 이에 맞추어 SSL 인 경우에만 사용되도록 `secure` flag 를 추가합니다.
선택적 SSL 인 경우 SSL 이 적용되지 않은 구간에서도 쿠키를 읽을 수 있어야 하므로, 적용하지 않습니다.
This commit is contained in:
Min-Soo Kim 2018-04-24 19:30:38 +09:00
parent 5ebbbf5b36
commit c1c9a94623
7 changed files with 26 additions and 9 deletions

View file

@ -1055,7 +1055,8 @@ function getOuterHTML(obj) {
function setCookie(name, value, expire, path) {
var s_cookie = name + "=" + escape(value) +
((!expire) ? "" : ("; expires=" + expire.toGMTString())) +
"; path=" + ((!path) ? "/" : path);
"; path=" + ((!path) ? "/" : path) +
((enforce_ssl) ? ";secure" : "");
document.cookie = s_cookie;
}