[TT-16259] [Security] Unable to delete Session that uses a quota and is under heavy load [Plan A]#8254
Conversation
|
This pull request addresses a critical security vulnerability (TT-16259) where a session utilizing a quota could be recreated after deletion if the system is under heavy load. The root cause is a race condition: an in-flight request, authenticated before the session's deletion, would write the session back to the data store upon completion to update its state (e.g., quota usage), effectively "resurrecting" the deleted session. The fix introduces an "update-if-exists" strategy for session persistence. A new This PR also includes a significant refactoring of the Files Changed AnalysisThe changes span 29 files with 1090 additions and 56 deletions, primarily impacting the gateway and storage layers.
Architecture & Impact Assessment
Race Condition and Fix VisualizationsequenceDiagram
participant Admin
participant User
participant Gateway
participant Redis
Admin->>Gateway: DELETE /session/{key}
Gateway->>Redis: DEL {key}
Redis-->>Gateway: OK
par In-flight Request (Authenticated before DEL)
User->>Gateway: GET /api (with {key})
Note right of Gateway: Request proceeds, session is updated in memory (e.g., quota)
Gateway->>Redis: SET {key} '...' XX (update-if-exists)
Note over Redis: Key does not exist, so SET command fails
Redis-->>Gateway: (nil)
Note right of Gateway: Session is NOT recreated.
end
Scope Discovery & Context Expansion
Metadata
Powered by Visor from Probelabs Last updated: 2026-06-10T05:45:12.568Z | Triggered by: pr_updated | Commit: 0fe41ab 💡 TIP: You can chat with Visor using |
🎯 Recommended Merge TargetsBased on JIRA ticket TT-16259: [Security] Unable to delete Session that uses a quota and is under heavy load Fix Version: Tyk 5.8.15Required:
Fix Version: Tyk 5.13.1Required:
Fix Version: Tyk 5.14.0
Required:
📋 Workflow
|
Security Issues (3)
Architecture Issues (3)
Security Issues (3)
Quality Issues (5)
Powered by Visor from Probelabs Last updated: 2026-06-10T05:44:49.267Z | Triggered by: pr_updated | Commit: 0fe41ab 💡 TIP: You can chat with Visor using |
758d1bf to
21d5f0f
Compare
98316f1 to
8ad76e6
Compare
|
/visor ask "SetRawKeyEx" is implemented the same way as "SetRawKey" for MDCBStorage; If someone uses this MDCBStorage as session storage, it will fail anyway. So it is not a problem at all from my point of view. |
|
/visor ask |
fe65b4a to
2dae261
Compare
1fa04d0 to
a9b1103
Compare
27093de to
aab5a4f
Compare
|
I've analyzed the concerns raised in the comments regarding serialization and refactoring: 1. Serialization of
2. Refactoring of |
…-that-uses-a-quota-and-is-under-heavy-load
…-that-uses-a-quota-and-is-under-heavy-load
🚨 Jira Linter FailedCommit: The Jira linter failed to validate your PR. Please check the error details below: 🔍 Click to view error detailsNext Steps
This comment will be automatically deleted once the linter passes. |
|
|
/release to release-5.8 |
|
/release to release-5.13 |
|
✅ Cherry-pick successful. A PR was created: #8305 |
|
/release to release-5.13 |
|
✅ Cherry-pick successful. A PR was created: #8306 |
…ota and is under heavy load [Plan A] (#8254)" This reverts commit 989c668. <!-- Provide a general summary of your changes in the Title above --> ## Description <!-- Describe your changes in detail --> ## Related Issue <!-- This project only accepts pull requests related to open issues. --> <!-- If suggesting a new feature or change, please discuss it in an issue first. --> <!-- If fixing a bug, there should be an issue describing it with steps to reproduce. --> <!-- OSS: Please link to the issue here. Tyk: please create/link the JIRA ticket. --> ## Motivation and Context <!-- Why is this change required? What problem does it solve? --> ## How This Has Been Tested <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> ## Screenshots (if appropriate) ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why



Description
Related Issue
Motivation and Context
How This Has Been Tested
Screenshots (if appropriate)
Types of changes
Checklist
Ticket Details
TT-16259
Generated at: 2026-06-05 11:28:49