-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the ui_lang
& accepts-cookies
preference cookies Secure
#7541
base: master
Are you sure you want to change the base?
Conversation
accepts-cookies
cookie Secure
ui_lang
& accepts-cookies
preference cookies Secure
var expires = ""; | ||
var domain = ";domain=" + URLUtils.getDomain(window.location.href); | ||
|
||
if (days) { | ||
const date = new Date(); | ||
date.setTime(date.getTime() + (days*24*60*60*1000)); | ||
var date = new Date(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need to avoid const
since es6 is widely supported?
} | ||
|
||
/** | ||
* Handles language change by setting the `ui_locale` cookie. | ||
*/ | ||
function setUILocaleCookie(language) { | ||
var EXPIRY_DAYS = 30; | ||
setCookie('ui_lang', language, EXPIRY_DAYS); | ||
setCookie('ui_lang', language, EXPIRY_DAYS, { secure: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we set ui_lang to secure, js logic will fail to read the cookie, won't it?
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7541 +/- ##
==========================================
+ Coverage 41.77% 41.85% +0.07%
==========================================
Files 42 42
Lines 936 939 +3
Branches 235 238 +3
==========================================
+ Hits 391 393 +2
- Misses 501 502 +1
Partials 44 44
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Purpose
This pull request includes several changes aimed at enhancing the security of cookies by making them secure. The changes span across multiple files and involve adding the
Secure
attribute to cookies and updating related functions to support additional options for cookies.Security Enhancements:
.changeset/cyan-cheetahs-warn.md
: Documented the changes as patch updates for several packages and specified making theui_lang
&accepts-cookies
preference cookiesSecure
.apps/myaccount/src/components/shared/header.tsx
: Updated thesetCookie
function call to include thesecure
option.apps/myaccount/src/layouts/dashboard.tsx
: Updated thesetCookie
function call to include thesecure
option.identity-apps-core/apps/authentication-portal/src/main/webapp/includes/footer.jsp
: Added theSecure
attribute to the cookie consent clear function.identity-apps-core/apps/authentication-portal/src/main/webapp/includes/language-switcher.jsp
: Modified thesetCookie
function to accept additional options (httpOnly
andsecure
) and updated the function implementation accordingly.identity-apps-core/apps/recovery-portal/src/main/webapp/includes/footer.jsp
: Added theSecure
attribute to the cookie consent clear function.identity-apps-core/apps/recovery-portal/src/main/webapp/includes/language-switcher.jsp
: Modified thesetCookie
function to accept additional options (httpOnly
andsecure
) and updated the function implementation accordingly. [1] [2]identity-apps-core/apps/x509-certificate-authentication-portal/src/main/webapp/includes/footer.jsp
: Added theSecure
attribute to the cookie consent clear function.identity-apps-core/apps/x509-certificate-authentication-portal/src/main/webapp/includes/language-switcher.jsp
: Modified thesetCookie
function to accept additional options (httpOnly
andsecure
) and updated the function implementation accordingly.modules/core/src/utils/__tests__/cookie-storage-utils.test.ts
: Added a test case to verify that thesetCookie
function correctly sets cookies withHttpOnly
andSecure
options.modules/core/src/utils/storage-utils.ts
: Updated thesetCookie
function inCookieStorageUtils
to accept additional options (httpOnly
andsecure
) and updated the function implementation accordingly. [1] [2] [3]modules/react-components/src/components/banner/cookie-consent-banner.tsx
: Updated thesetCookie
function call to include thesecure
option.Related Issues
Related PRs
Checklist
Security checks