- The
CookieStoreusessecret_key_baseto store session session data - Rails 7 introduces a
- When
secret_key_baseis rotated, all sessions are expired - A rotation initializer can be added, which allows users to visit the site and have their cookies read with the old configuration, then rewritten with the new secret_key_base
- The rotator can be disabled either after a period of time, or upon audit that no cookies are stored using the previous
secret_key_base - Multiple rotators can exist at once
- Rotators can be used for other things, such as changing the digest used to sign cookies (SHA1 -> SHA256)
A simple rotator to move between two secret_key_base values may look like this: