Skip to content

Configurable Session Cookie Prefix

What does this merge request do and why?

GitLab Rails Application now allows to configure the session cookie to have a prefixed value. See this MR for context how this was implemented on the Rails Application.

This MR adds this as a new configuration to GitLab Development Kit.

Addressing: gitlab#439945 (closed)

Context

As part of the Cells project, adding prefixes to the session cookie value will allow us to do routing based on the session cookie prefix value. See here.

For more details regarding the Cells Routing, see this blueprint page.

How to set up and validate locally

1. Setting a new prefix

  1. Change the configured prefix. Feel free to change the prefix to anything you want. gdk config set gitlab.rails.session_store.session_cookie_token_prefix some_new_prefix_
  2. gdk reconfigure
  3. Make sure the config has been set in the Rails application using this command cat gitlab/config/session_store.yml
  4. Restart the rails app gdk restart rails-web
  5. Clear your gitlab cookies in the local GDK localhost:3000. Right Click -> Inspect -> Application -> Cookies -> http://127.0.0.0/localhost / Select gitlab_session_***** -> Right Click -> Delete
  6. Refresh. You should see the session cookie was set again with a new value set to the prefix.

2. Reset the prefix

  1. Reset the prefix to the default value gdk config set gitlab.rails.session_store.session_cookie_token_prefix ""
  2. gdk reconfigure
  3. Make sure the config has been removed from the Rails application using this command cat gitlab/config/session_store.yml

Repeat steps 4 to 6

Impacted categories

The following categories relate to this merge request:

Merge request checklist

  • This change is backward compatible. If not, please include steps to communicate to our users.
  • Tests added for new functionality. If not, please raise an issue to follow-up.
  • Documentation added/updated, if needed.
  • Announcement added, if change is notable.
  • gdk doctor test added, if needed.
  • Add the ~highlight label if this MR should be included in the CHANGELOG.md.
Edited by Omar Qunsul

Merge request reports