You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix: Add mutual TLS support for dedicated rate limiter Redis connection
## Problem
The dedicated Redis connection for the rate limiter (when configured with `rate_limiter.storage.type: redis`) was not properly implementing mutual TLS authentication. When `UseSSL` was enabled, the code only set `InsecureSkipVerify` and ignored the client certificate configuration (`CertFile`, `KeyFile`, `CAFile`).
This created a security vulnerability where even if administrators configured mTLS for all Redis connections, the rate limiter's dedicated connection would bypass these security controls.
## Solution
Enhanced the `NewStorage` function in `internal/rate/storage.go` to properly handle TLS configuration with full mutual TLS support:
- Added `createTLSConfig` helper function that loads CA certificates, client certificates, and keys
- Added support for TLS version configuration (`TLSMinVersion`, `TLSMaxVersion`)
- Properly handles certificate loading errors with appropriate logging
- Maintains backward compatibility with existing configurations
## Testing
- Added comprehensive unit tests for all TLS configuration scenarios
- Tests cover: basic SSL, mTLS, CA certificates, TLS versions, and error cases
- All existing rate limiter tests continue to pass
## Impact
This fix ensures that when administrators configure mutual TLS for Redis connections, the rate limiter's dedicated connection will properly authenticate using client certificates, maintaining consistent security across all Redis connections.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
0 commit comments