diff options
author | Rémy Coutable <remy@rymai.me> | 2018-09-04 14:00:31 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-09-04 14:00:31 +0300 |
commit | c181d4fc4b07edbe958799d208e743d85c783d39 (patch) | |
tree | a30914956c4597d2b78b1717d20eae34fbbf604b /app/helpers | |
parent | 4d41bbd711d95e8def52621db9213dccda348887 (diff) | |
parent | b9cee4ba3c5e22766de771edde2b8d523ee84993 (diff) |
Merge branch 'sh-set-secure-cookies' into 'master'
Set issuable_sort and diff_view cookies to secure when possible
Closes #49120
See merge request gitlab-org/gitlab-ce!21442
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/cookies_helper.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/helpers/cookies_helper.rb b/app/helpers/cookies_helper.rb new file mode 100644 index 00000000000..3a7e9987190 --- /dev/null +++ b/app/helpers/cookies_helper.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module CookiesHelper + def set_secure_cookie(key, value, httponly: false, permanent: false) + cookie_jar = permanent ? cookies.permanent : cookies + + cookie_jar[key] = { value: value, secure: Gitlab.config.gitlab.https, httponly: httponly } + end +end |