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

feat(api): Apply rate limit decorators to api controllers and methods #4915

Merged
merged 199 commits into from
Dec 5, 2023

Conversation

rifont
Copy link
Contributor

@rifont rifont commented Nov 29, 2023

What change does this PR introduce?

  • Apply rate limit guard category and cost decorators to api controllers and methods. All non decorated endpoints have a Global category and Single cost applied by default, per feat(api): Add API rate limiting NestJS guard #4910
  • Categories - Controllers - Endpoints [Cost]:
    • Trigger:
      • /events
        • /events/trigger - [Bulk]
        • /events/broadcast - [Bulk]
    • Configuration
      • /subscribers
        • /subscribers/bulk - [Bulk]
      • /tenants
      • /topics
    • Global
      • /changes
        • /changes/bulk/apply - [Bulk]
      • /invites
        • /invites/bulk - [Bulk]

Why was this change needed?

In order to provide a fair service to all clients, some API resources must have a differing category and cost applied given that underlying resource consumption can vary. This change colocates resources and methods whose category falls into a similar infrastructure bucket, and applies bulk cost to bulk endpoints which place a higher load on infrastructure.

Other information (Screenshots)

N/A

…vuhq/novu into nv-3059-get-rate-limit-use-case
Copy link

linear bot commented Nov 29, 2023

NV-3062 🏎️ API Resource Protection

What?

  • Attach the rate limiting guard to the relevant controllers - UseGuards(RateLimitGuard(CategoryTypeEnum.<ENUM>))
  • Attach the guard to the App-level - UseGuards(RateLimitGuard(CategoryTypeEnum.Global))

Why? (Context)

In order to rate limit access to specific resources in the service, we must apply the custom Rate Limiting controller to specific resources to allocate access to them into a specific bucket.

Definition of Done

  • All endpoints listed in a specific resource category have the rate limiting controller applied

@rifont rifont changed the title feat(api): Apply rate limit category and cost decorators to api controllers and methods feat(api): Apply rate limit decorators to api controllers and methods Nov 29, 2023
Base automatically changed from nv-3061-rate-limiting-nestjs-guard to next December 5, 2023 07:16
@rifont rifont merged commit 3e0a58e into next Dec 5, 2023
20 checks passed
@rifont rifont deleted the nv-3062-api-resource-protection branch December 5, 2023 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants