Skip to content

Persist the tester cookie for 30 days so it survives browser restarts - #1137

Open
jevansnyc wants to merge 1 commit into
mainfrom
worktree-tester-cookie-max-age
Open

Persist the tester cookie for 30 days so it survives browser restarts#1137
jevansnyc wants to merge 1 commit into
mainfrom
worktree-tester-cookie-max-age

Conversation

@jevansnyc

Copy link
Copy Markdown
Collaborator

Fixes #1136

Problem

GET /_ts/set-tester minted the ts-tester cookie without Max-Age or Expires, making it a session cookie. Safari deletes session cookies when the application quits, so Safari testers lost the cookie on every restart and silently fell back to the baseline arm on their next visit. Chrome and Firefox mask the defect because session restore resurrects session cookies.

Change

  • Add TESTER_COOKIE_MAX_AGE_SECONDS (30 days, 2592000) and append Max-Age to the tester cookie in format_tester_cookie
  • Update the two tests that assert the exact Set-Cookie string (core tester_cookie test, fastly dispatch_set_tester test)

/_ts/clear-tester already expires the cookie explicitly with Max-Age=0 and is unchanged. The module documents that the cookie only affects tester routing and must not gate sensitive behavior, so the bounded persistent lifetime does not change its security posture.

Testing

  • Test-first: updated both assertions, watched both fail, then implemented
  • cargo test-fastly: 170 adapter + 2357 core tests pass
  • cargo test-axum: pass
  • cargo fmt --all -- --check, cargo clippy-fastly, cargo clippy-axum: clean

Generated with Claude Code

The set-tester endpoint minted the ts-tester cookie without Max-Age or
Expires, making it a session cookie. Safari deletes session cookies when
the browser quits, so Safari testers silently fell back to the baseline
arm on every restart. Add a 30-day Max-Age; /_ts/clear-tester already
expires the cookie explicitly and is unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tester cookie does not survive browser restart because it is a session cookie

1 participant