Allow the session name suffix to be configurable

Created on 10 April 2017, over 7 years ago
Updated 3 June 2024, 6 months ago

Problem/Motivation

After upgrading from Drupal 7, no users are able to log into the site until clearing the cookies (or presumably, waiting 3 weeks until the cookie expires). The main reason for it is that Drupal 7 strips www from cookie domain as described in #2522002: Do not strip www. from cookie domain by default because that leaks session cookies to subdomains .

Steps to reproduce

Upgrade Drupal 7 site to Drupal 8+. Do not clear the cookies for the domain. Try to log in.

Proposed resolution

Add a new session parameter name_suffix to default.services.yml.

Remaining tasks

-
-
- RTBC

User interface changes

-

API changes

-

Data model changes

-

Release notes snippet

A new session parameter name_suffix is available in services.yml. If its set, it allows sites upgrading from Drupal 7 to log in users after the upgrade.

Original report:

After upgrading from Drupal 7, no users are able to log into the site until clearing cookies (or presumably, waiting 3 weeks until the cookie expires).

Before and after the upgrade, the site is hosted on https and with www.

Unfortunately, since I cleared my cookies I don't have the Drupal 7 cookie anymore, but comparing with other sites, it looks like the cookie name / value are the same format across D7/D8, both are HttpOnly and Secure, path is the same. However, the D8 cookie includes the www. in the cookie domain while the D7 one does not.

Drupal 7 cookie: .example.com
Drupal 8 cookie: .www.example.com

I also tried to login using the one-time login created with drush uli, but even this wouldn't work.

Proposed Solution:
Unset or ignore any cookies that do not correspond to an active session.

🐛 Bug report
Status

Fixed

Version

10.3

Component
Base 

Last updated 31 minutes ago

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024