A platform team proposes moving sessions out of signed cookies. Three reviewers.
The ADR proposes a functional session migration but has critical production gaps: a single Redis node creates an authentication SPOF, no persistence risks total session loss, and the migration lacks rollback controls. Stale permissions from cached roles and missing cookie hardening are significant security concerns.
All reviewers agree: one ElastiCache node without replica or Multi-AZ means any Redis failure causes total authentication outage. No fallback path defined.
Raised by Principal Software Architect, Security and Reliability Reviewer, Product Delivery Lead
Redis is in-memory only; restarts or crashes wipe all active sessions. No RDB/AOF or managed persistence configured.
Raised by Principal Software Architect
Storing roles in the session body creates TOCTOU risk: revoked permissions persist up to 14-day TTL unless manual Redis DEL. No invalidation mechanism defined.
Raised by Security and Reliability Reviewer, Product Delivery Lead
New 64-byte opaque session cookie lacks mandated HttpOnly, Secure, and SameSite=Lax/Strict flags, exposing sessions to XSS theft.
Raised by Principal Software Architect, Security and Reliability Reviewer
Dual-read relies on cookie TTL expiry without toggles, monitoring, or a tested rollback procedure. Risk of silent inconsistencies during cutover.
Raised by Product Delivery Lead
Majority view: Principal Architect and consensus view: missing HttpOnly/Secure/SameSite is a Medium-severity session hijacking vector requiring immediate fix.
This document proposes moving user sessions to a Redis database. Reviewers found critical gaps that would cause total authentication outages and security risks if deployed as written.
A score of 45 out of 100 means the reviewers found serious problems with this architecture decision. Low scores indicate the document has significant flaws that must be fixed before implementation.
One reviewer rated the missing cookie security flags as low severity, while the majority rated them medium or high. This disagreement affects how urgently the cookie fixes are prioritized.
Status: Proposed
Date: 2026-07-28
Deciders: Platform team
Supersedes: ADR-006 (stateless signed-cookie sessions)
Our web tier is stateless today. Session data lives in a signed cookie
(HMAC-SHA256, 4KB ceiling). Two constraints have made this uncomfortable:
from the browser limit, and every request carries it on the wire.
copied cookie stays valid until its 14-day expiry. Support has escalated
this twice after laptop-theft reports from enterprise customers.
We evaluated three options.
Option A — Keep signed cookies, shrink the payload. Move everything except
user_id and issued_at into a per-request
database lookup. Cheapest change,
but adds a DB round trip to every authenticated request (~4,000 rps peak) and
does not solve revocation.
Option B — Redis-backed sessions. Cookie carries only an opaque session id.
Session body lives in Redis with a 14-day TTL. Revocation is a
DEL. Adds an
external dependency to the auth path.
Option C — Database-backed sessions. Same shape as B, but Postgres instead
of Redis. Reuses infrastructure we already operate and back up. Higher latency
(~6ms vs ~0.4ms measured on a spike) and adds write load to the primary.
Adopt Option B. A single ElastiCache Redis node in
us-east-1, cache.r6g.large,
with the session body serialised as JSON.
Revocation is the requirement that actually forced this, and B is the only
option that makes it a constant-time operation. Latency matters on the auth
path and Redis is an order of magnitude faster than Postgres for this access
pattern. We already run Redis for the rate limiter, so the operational surface
is not new to the team.
authenticate. We accept this.
by roughly 12%.
on the rate limiter's observed behaviour.
cookie-carried sessions are rejected.
user_id, org_id,
roles, impersonator_id when an
admin is acting as a customer, and a csrf_token.
Week 1: dual-write, read from cookie. Week 2: dual-write, read from Redis with
cookie fallback. Week 3: Redis only. Week 5: remove cookie-session code path.
replica roughly doubles cost and the team has not operated Redis replication
before.
roles live in the session at all, or be
re-fetched per request so a
permission change takes effect immediately?