You are working on the hyperswitch repository (Rust payment processing system).…
- User
You are working on the hyperswitch repository (Rust payment processing system).
REPOSITORY SETUP:
- Repository: juspay/hyperswitch
- Working directory: ./repos/hyperswitch_pool_5 (already cloned)
- Base commit: b04ccafe48394fad86bf072b2e3a74626cc26550
- Task ID: juspay__hyperswitch-7931
- Version: v1.114.0
TASK DESCRIPTION: Bug: Modify User-related Redis Operations to Use Global Tenant Prefix
Currently, user-related data in Redis (such as SSO IDs, TOTP codes, email token blacklists, lineage_context etc.) is using tenant-specific prefixes like
public:orpublic_v2:. This causes issues when users use different versions or environments (v1, v2), leading to inconsistency in fetching and setting Redis keys.The correct prefix for all global user-related data should be
global:.Affected Areas
- Blacklisting
- Two-factor Authentication (TOTP, Recovery Codes)
- SSO ID storage
- OpenID Connect (OIDC) token handling
- Role Info Caching
- Lineage Context
DETAILED CONTEXT & HINTS:
Type of Change
- Bugfix
- New feature
- Enhancement
- Refactoring
- Dependency updates
- Documentation
- CI/CD
Description
This PR updates all user-related Redis operations to consistently use the global Redis key prefix (
global:) instead of environment-specific prefixes likepublic:(V1) orpublic_v2:(V2).Previously, different deployments used different prefixes, which caused inconsistencies especially during login, logout, switch, and caching flows.
Changes Introduced:
- Updated Redis connection fetchers for all user modules (lineage context, SSO, blacklist, etc.) to use a global Redis connection.
Affected functions:
utils/user.rsset_sso_id_in_redis
Assistant
I'll help you implement the changes to modify user-related Redis operations to use the global tenant prefix. Let me start by creating a plan and then execute the necessary changes.
First, let me explore the repository structure to understand where the affected files are located.
Assistant
Let me first explore the repository structure to locate the files mentioned in the task description.
Assistant
Now let me look more specifically at the files mentioned in the task description to understand the current Redis key prefix usage:
Assistant
Let me check the utils/user.rs file which contains the SSO ID functions:
Assistant
Now let me check the two_factor_auth.rs file to see the TOTP-related Redis operations:
Assistant
Now let me check the authorization.rs file for role info caching:
Assistant
Let me check the openidconnect.rs file:
Assistant
Now let me check the user.rs file in the services module for blacklist operations:
Assistant
Let me check if there's a user.rs file in the services directory:
Assistant
Let me check the blacklist module in the authentication service:
Assistant
(no content)
Assistant
Now let me check the constants file to understand the current Redis key prefixes:
Assistant
Now I'll check the main Redis connection setup to understand how the global tenant prefix works:
Assistant
Let me also look at the multitenancy configuration to understand how global tenant prefixes work:
Assistant
(no content)
Assistant
Let me search for multitenancy related configurations in the config directory:
Assistant
Let me review the task more carefully and create a clearer plan. I'll look at what changes are needed in more detail and mark the first task as in progress:
Assistant
Looking at the task more carefully, I need to understand what Redis key prefixes are currently used and how to make them consistent. Let me review the files and understand exactly what needs to be changed.
Based on the task description and code examination, the main changes needed are:
-
In
utils/user.rs:- Functions
set_sso_id_in_redisandget_sso_id_from_redisuseREDIS_SSO_PREFIXwhich is"SSO_" get_lineage_context_from_cacheandset_lineage_context_in_cacheuseLINEAGE_CONTEXT_PREFIXwhich is"LINEAGE_CONTEXT_"
- Functions
-
In
utils/user/two_factor_auth.rs:- All TOTP and Recovery Code functions that use prefixes like , , etc.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.