I need to change the "secure" and "httpOnly" values of the cookies, as I am getting a vulnerability error "CWE-614: Sensitive Cookie in HTTPS Session Without 'Secure' Attribute".
I have tried from the settings.php using the following code:
ini_set('session.cookie_secure', 1);
However it didn't work, I also tried with some modules but it didn't work either.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

LeJuanChis created an issue. See original summary.

lejuanchis’s picture

Category: Support request » Feature request
Priority: Normal » Major
semapo82’s picture

Hi, we have the same problem, so I'll work in a solution to add this secure flag from the config form to make it optional.

semapo82’s picture

Sorry, but we can't update the module to the last version right now and I've to work in a local patch.

svenryen’s picture

Version: 2.0.x-dev » 8.x-1.x-dev

I'll assume this report concerns 8.x-1.x.

Elzan’s picture

Does anyone have an idea about this issue? i use drupal 10 and the module eu cookie compliance

Emircan Erkul made their first commit to this issue’s fork.

emircan erkul’s picture

StatusFileSize
new100.05 KB

My PR includes secure attribute options for both. We can not make httpOnly true because eu_cookie_compliance uses those cookies via JS.

ss

If the HttpOnly flag (optional) is included in the HTTP response header, the cookie cannot be accessed through client side script (https://owasp.org/www-community/HttpOnly)

alex bukach made their first commit to this issue’s fork.

alex.bukach’s picture

Assigned: lejuanchis » Unassigned
Status: Active » Needs review
StatusFileSize
new72.7 KB

Provided patch for 8.x-1.24 based on MR!142.

adamcadot’s picture

Version: 8.x-1.x-dev » 8.x-1.25
Status: Needs review » Needs work
Issue tags: +Needs reroll

The patch does not apply to 8.x-1.25. Needs reroll.

prem suthar made their first commit to this issue’s fork.

prem suthar’s picture

Status: Needs work » Needs review
pilot3’s picture

hi @prem suthar, I updated the module to 1.25, and tried to apply the patch with your new commit. The patch can't apply.

pilot3’s picture

Status: Needs review » Needs work
kruser’s picture

Version: 8.x-1.25 » 8.x-1.26
Priority: Major » Critical

this won't apply to the security release either - 1.26.0

alex.bukach’s picture

Status: Needs work » Needs review
StatusFileSize
new74.54 KB

Created MR!160 that re-rolls patch #11 against HEAD (still based on the idea of MR!142). Here's the respective patch.

atowl made their first commit to this issue’s fork.

atowl’s picture

Thanks @alex.bukach for the re-roll, i've made some corrections since the setCookies wasn't working.

I removed the version option, as this seems deprecated in modern times, feel free to correct me.
When set in the configuration, the Secure flag will now be set in the cookie.

I'm just wondering if someone happens to untick the config option for Secure, should the cookie consent pop up again?

Also - haven't done anything about httpOnly, should we be checking headers? i'm not sure if we can? Or should it be an option that is set by default and we unset it if not needed?

i'll leave this in needs review, if the community could test, and i'll look at merging this for the next release.

Thanks!

atowl’s picture

StatusFileSize
new147.31 KB

I've re-rolled the MR160 to be up to date with the main branch,
also attached a patch for those following.

if this is acceptable we can look at merging this into the next release