feat(storage): redis interface addition#167
Closed
su-shivanshmathur wants to merge 10 commits into
Closed
Conversation
…pts and increase delay
…ch-card-vault into redis-interface-addtion
…redis-interface-addtion
|
SentinelOne CNS Hardcoded Secret Detector
SentinelOne CNS detects secrets in your source code. We encourage you to remediate any secret incidents detected. If you want to ignore secrets or change your check runs settings, please go to your SentinelOne CNS Dashboard. 🛠 Guidelines to remediate hardcoded secrets
SentinelOne CNS is a cloud-agnostic, agentless CSPM & CWPP solution that continuously detects and prevents vulnerabilities that have the highest probability of being exploited in Azure, AWS, Google Cloud, and Kubernetes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a Redis client to the locker, built on the
redis_interfacecrate from https://github.com/juspay/hyperswitch (fred backend). It is gated behind a newredisCargo feature, so it is off by default and compiles out completely when the feature is not enabled.This PR includes the following changes:
redisfeature (also part of thereleasefeature set);hyperswitch_redis_interfaceis now an optional dependency.get_redis_conn) that does not hand back the pool when Redis is known to be down./health/diagnostics(Working/Failing/Disabled) via a set/get/delete round-trip.[redis]config, or the server cannot reach Redis at startup, the locker logs it and keeps running.[redis]block todevelopment.toml,docker-configuration.toml, andconfig.example.toml(the example file documents each field inline).Testing
RedisSettinginGlobalConfig[INFO] log_utils: Using console filtering directive: WARN,hyperswitch_masking=DEBUG,tower_http=DEBUG,build_info=DEBUG,locker=DEBUG,tartarus=DEBUG,log_utils=DEBUG 2026-06-15T05:22:06.193816Z INFO tartarus::app: Locker started [Server { host: "127.0.0.1", port: 3001 }] [Log { console: LogConsole { enabled: true, level: Level(Level(Debug)), log_format: Default, filtering_directive: None } }] at src/app.rs:219 2026-06-15T05:22:06.193864Z DEBUG tartarus::app: startup_config: GlobalConfig { server: Server { host: "127.0.0.1", port: 3001 }, database: Database { username: "db_user", password: *** alloc::string::String ***, host: "localhost", port: 5432, dbname: "locker", pool_size: None }, secrets: Secrets, secrets_management: NoEncryption, log: Log { console: LogConsole { enabled: true, level: Level(Level(Debug)), log_format: Default, filtering_directive: None } }, cache: Cache { tti: Some(7200), max_capacity: 5000 }, tenant_secrets: TenantsSecrets({"public": TenantSecrets { master_key: [254, 255, 233, 146, 134, 101, 115, 28, 109, 106, 143, 148, 103, 48, 131, 8, 254, 255, 233, 146, 134, 101, 115, 28, 109, 106, 143, 148, 103, 48, 131, 8], schema: "public" }}), tls: None, api_client: ApiClientConfig { client_idle_timeout: 90, pool_max_idle_per_host: 5 }, external_key_manager: Disabled, redis: Some(RedisSettings { host: "127.0.0.1", port: 6379, cluster_enabled: false, cluster_urls: [], use_legacy_version: false, pool_size: 5, reconnect_max_attempts: 5, reconnect_delay: 5, default_ttl: 300, default_hash_ttl: 900, stream_read_count: 1, auto_pipeline: true, disable_auto_backpressure: false, max_in_flight_commands: 5000, default_command_timeout: 30, max_feed_count: 200, unresponsive_timeout: 10, unresponsive_check_interval: 2, broadcast_channel_capacity: 32, max_failure_threshold_seconds: 5 }) }Request
Response
{ "key_custodian_locked": false, "database": { "database_connection": "Failing", "database_read": "Failing", "database_write": "Failing", "database_delete": "Failing" }, "redis_status": "Working" }Logs
2026-06-15T05:45:38.602663Z DEBUG tartarus::app: startup_config: GlobalConfig { server: Server { host: "127.0.0.1", port: 3001 }, database: Database { username: "db_user", password: *** alloc::string::String ***, host: "localhost", port: 5432, dbname: "locker", pool_size: None }, secrets: Secrets, secrets_management: NoEncryption, log: Log { console: LogConsole { enabled: true, level: Level(Level(Debug)), log_format: Default, filtering_directive: None } }, cache: Cache { tti: Some(7200), max_capacity: 5000 }, tenant_secrets: TenantsSecrets({"public": TenantSecrets { master_key: [254, 255, 233, 146, 134, 101, 115, 28, 109, 106, 143, 148, 103, 48, 131, 8, 254, 255, 233, 146, 134, 101, 115, 28, 109, 106, 143, 148, 103, 48, 131, 8], schema: "public" }}), tls: None, api_client: ApiClientConfig { client_idle_timeout: 90, pool_max_idle_per_host: 5 }, external_key_manager: Disabled, redis: Some(RedisSettings { host: "127.0.0.1", port: 6379, cluster_enabled: false, cluster_urls: [], use_legacy_version: false, pool_size: 5, reconnect_max_attempts: 0, reconnect_delay: 200, default_ttl: 300, default_hash_ttl: 900, stream_read_count: 1, auto_pipeline: true, disable_auto_backpressure: false, max_in_flight_commands: 5000, default_command_timeout: 30, max_feed_count: 200, unresponsive_timeout: 10, unresponsive_check_interval: 2, broadcast_channel_capacity: 32, max_failure_threshold_seconds: 5 }) } at src/app.rs:225 2026-06-15T05:45:43.439948Z WARN fred::router::responses: fred-WQNTeoiVmR: Ending reader task from 127.0.0.1:6379 due to None at /Users/shivansh.mathur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/fred-8.0.6/src/router/responses.rs:350 2026-06-15T05:45:43.440260Z ERROR redis_interface::module::fred: Redis protocol or connection error, error: Redis Error - kind: Canceled, details: Canceled. at /Users/shivansh.mathur/.cargo/git/checkouts/hyperswitch-90748e17e947b406/c15bf9c/crates/redis_interface/src/module/fred.rs:291 2026-06-15T05:45:43.440343Z WARN fred::router::responses: fred-pCs6Vbkqc3: Ending reader task from 127.0.0.1:6379 due to None at /Users/shivansh.mathur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/fred-8.0.6/src/router/responses.rs:350 2026-06-15T05:45:43.440322Z WARN fred::router::responses: fred-NXMKQD7IMZ: Ending reader task from 127.0.0.1:6379 due to None at /Users/shivansh.mathur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/fred-8.0.6/src/router/responses.rs:350 2026-06-15T05:45:43.440400Z ERROR redis_interface::module::fred: Redis protocol or connection error, error: Redis Error - kind: Canceled, details: Canceled. at /Users/shivansh.mathur/.cargo/git/checkouts/hyperswitch-90748e17e947b406/c15bf9c/crates/redis_interface/src/module/fred.rs:291 2026-06-15T05:45:43.440417Z ERROR redis_interface::module::fred: Redis protocol or connection error, error: Redis Error - kind: Canceled, details: Canceled. at /Users/shivansh.mathur/.cargo/git/checkouts/hyperswitch-90748e17e947b406/c15bf9c/crates/redis_interface/src/module/fred.rs:291 2026-06-15T05:45:43.440458Z WARN fred::router::responses: fred-YoUkJlWZbv: Ending reader task from 127.0.0.1:6379 due to None at /Users/shivansh.mathur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/fred-8.0.6/src/router/responses.rs:350 2026-06-15T05:45:43.440497Z WARN fred::router::responses: fred-QDZ4MRi4Yh: Ending reader task from 127.0.0.1:6379 due to None at /Users/shivansh.mathur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/fred-8.0.6/src/router/responses.rs:350 2026-06-15T05:45:43.440563Z ERROR redis_interface::module::fred: Redis protocol or connection error, error: Redis Error - kind: Canceled, details: Canceled. at /Users/shivansh.mathur/.cargo/git/checkouts/hyperswitch-90748e17e947b406/c15bf9c/crates/redis_interface/src/module/fred.rs:291 2026-06-15T05:45:43.440590Z WARN fred::router::responses: fred-YsNKXlfkHe: Ending reader task from 127.0.0.1:6379 due to None at /Users/shivansh.mathur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/fred-8.0.6/src/router/responses.rs:350 2026-06-15T05:45:43.440623Z WARN fred::router::responses: fred-RnJf9p1RwM: Ending reader task from 127.0.0.1:6379 due to None at /Users/shivansh.mathur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/fred-8.0.6/src/router/responses.rs:350 2026-06-15T05:45:43.440666Z ERROR redis_interface::module::fred: Redis protocol or connection error, error: Redis Error - kind: Canceled, details: Canceled. at /Users/shivansh.mathur/.cargo/git/checkouts/hyperswitch-90748e17e947b406/c15bf9c/crates/redis_interface/src/module/fred.rs:291 2026-06-15T05:45:43.645426Z ERROR redis_interface::module::fred: Redis protocol or connection error, error: Redis Error - kind: IO, details: Os { code: 61, kind: ConnectionRefused, message: "Connection refused" } at /Users/shivansh.mathur/.cargo/git/checkouts/hyperswitch-90748e17e947b406/c15bf9c/crates/redis_interface/src/module/fred.rs:291 2026-06-15T05:45:43.672502Z ERROR redis_interface::module::fred: Redis protocol or connection error, error: Redis Error - kind: IO, details: Os { code: 61, kind: ConnectionRefused, message: "Connection refused" } at /Users/shivansh.mathur/.cargo/git/checkouts/hyperswitch-90748e17e947b406/c15bf9c/crates/redis_interface/src/module/fred.rs:291 2026-06-15T05:45:43.694324Z ERROR redis_interface::module::fred: Redis protocol or connection error, error: Redis Error - kind: IO, details: Os { code: 61, kind: ConnectionRefused, message: "Connection refused" } at /Users/shivansh.mathur/.cargo/git/checkouts/hyperswitch-90748e17e947b406/c15bf9c/crates/redis_interface/src/module/fred.rs:291 2026-06-15T05:45:43.708261Z ERROR redis_interface::module::fred: Redis protocol or connection error, error: Redis Error - kind: IO, details: Os { code: 61, kind: ConnectionRefused, message: "Connection refused" } at /Users/shivansh.mathur/.cargo/git/checkouts/hyperswitch-90748e17e947b406/c15bf9c/crates/redis_interface/src/module/fred.rs:291 2026-06-15T05:45:43.728115Z ERROR redis_interface::module::fred: Redis protocol or connection error, error: Redis Error - kind: IO, details: Os { code: 61, kind: ConnectionRefused, message: "Connection refused" } at /Users/shivansh.mathur/.cargo/git/checkouts/hyperswitch-90748e17e947b406/c15bf9c/crates/redis_interface/src/module/fred.rs:291 2026-06-15T05:45:51.303474Z INFO tower_http::trace::on_request: started processing request at /Users/shivansh.mathur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tower-http-0.6.8/src/trace/on_request.rs:80 in tartarus::utils::request with method: GET, uri: /health/diagnostics, version: HTTP/1.1, tenant_id: "public", request_id: "019ec9d0-97c6-7661-9977-48cb249f42f7" 2026-06-15T05:45:51.303858Z INFO tartarus::routes::health: Health diagnostics was called at src/routes/health.rs:62 in tartarus::utils::request with method: GET, uri: /health/diagnostics, version: HTTP/1.1, tenant_id: "public", request_id: "019ec9d0-97c6-7661-9977-48cb249f42f7" 2026-06-15T05:45:51.465903Z INFO tower_http::trace::on_response: finished processing request, latency: 162826 μs, status: 200 at /Users/shivansh.mathur/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tower-http-0.6.8/src/trace/on_response.rs:114 in tartarus::utils::request with method: GET, uri: /health/diagnostics, version: HTTP/1.1, tenant_id: "public", request_id: "019ec9d0-97c6-7661-9977-48cb249f42f7"