Skip to content
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

RateLimit fails closed if Redis isn't available #1555

Open
Sam-tesouro opened this issue Jan 31, 2025 · 2 comments
Open

RateLimit fails closed if Redis isn't available #1555

Sam-tesouro opened this issue Jan 31, 2025 · 2 comments
Labels
enhancement New feature or request internally-reviewed The issue has been reviewed internally.

Comments

@Sam-tesouro
Copy link

Component(s)

router

Is your feature request related to a problem? Please describe.

On testing a Cosmo Rate Limit implementation I discovered every request would get a 500 response if Redis is scaled to zero, or if authentication is malformed. The following is the utilized config.

    rate_limit:
      enabled: true
      strategy: "simple"
      simple_strategy:
          rate: 10
          burst: 10
          period: 1s
          reject_exceeding_requests: true
          reject_status_code: 429
          hide_stats_from_response_extension: false
      storage:
          url: "redis://USER:PASSWORD@redis-master.redis.svc.cluster.local:6379"
          key_prefix: "cosmo_rate_limit"
      debug: true
      key_suffix_expression: "request.auth.claims.sub ?? request.header.Get('X-Forwarded-For')"
      error_extension_code:
          enabled: true
          code: "RATE_LIMIT_EXCEEDED"

Describe the solution you'd like

If it's intentional y'all are failing closed on Redis availability, a configuration flag to fail open instead would be ideal.

Describe alternatives you've considered

No response

Additional context

As a side note, while implementing this I discovered your Cosmo Router documentation example YAML malformed the top config key as rate_limiting instead of rate_limit.
https://cosmo-docs.wundergraph.com/router/configuration#rate-limiting-example-yaml-configuration

@Sam-tesouro Sam-tesouro added the enhancement New feature or request label Jan 31, 2025
Copy link

WunderGraph commits fully to Open Source and we want to make sure that we can help you as fast as possible.
The roadmap is driven by our customers and we have to prioritize issues that are important to them.
You can influence the priority by becoming a customer. Please contact us here.

@Aenimus Aenimus added the internally-reviewed The issue has been reviewed internally. label Feb 4, 2025
@Aenimus
Copy link
Member

Aenimus commented Feb 4, 2025

Hi @Sam-tesouro

Thanks for the report.

We'll fix the documentation.

We'll discuss how to handle this; at the very least we will update the documentation to declare the behaviour explicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request internally-reviewed The issue has been reviewed internally.
Projects
None yet
Development

No branches or pull requests

2 participants