Skip to content

Fix stacking transaction cookies #2077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 13, 2025

Conversation

tusharpandey13
Copy link
Contributor

@tusharpandey13 tusharpandey13 commented May 2, 2025

Fixes: #1917

Overview

The original logout handler (handleLogout) only deleted the session cookie, leaving transaction cookies behind.
This caused potential accumulation of transaction state cookies (__txn_{state}) for users, particularly those who were unauthenticated or experienced interrupted login flows.

Changes

  • Modified AuthClient.handleLogout to actively clear all transaction cookies (matching the transaction store's cookie prefix)
  • Added a public getter method getCookiePrefix to TransactionStore
  • Added test file redundant-txn-cookie-deletion.test.ts to test this specific flow.
  • Some linting changes.

Tests

PASSING

Usage

No change in contract

@tusharpandey13 tusharpandey13 requested a review from a team as a code owner May 2, 2025 09:46
@codecov-commenter
Copy link

codecov-commenter commented May 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.25%. Comparing base (1ef1862) to head (af84ca0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2077      +/-   ##
==========================================
+ Coverage   82.05%   82.25%   +0.19%     
==========================================
  Files          21       21              
  Lines        1967     1989      +22     
  Branches      343      348       +5     
==========================================
+ Hits         1614     1636      +22     
  Misses        347      347              
  Partials        6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tusharpandey13 tusharpandey13 changed the title delete redundant txn cookies impl, tests and some linting changes Fix cascading transaction cookies May 12, 2025
@tusharpandey13 tusharpandey13 changed the title Fix cascading transaction cookies Fix stacking transaction cookies May 12, 2025
@tusharpandey13 tusharpandey13 enabled auto-merge (squash) May 12, 2025 10:52
@tusharpandey13 tusharpandey13 merged commit 3ce7c59 into main May 13, 2025
12 checks passed
@tusharpandey13 tusharpandey13 deleted the feature/delete-redundant-txn-cookies branch May 13, 2025 06:44
@tusharpandey13 tusharpandey13 mentioned this pull request May 21, 2025
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.

v4: Infinitely stacking cookies
4 participants