[PR #5946] [MERGED] [management] refactor: changeable pat rate limiting #27177

Closed
opened 2026-08-05 07:08:19 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/5946
Author: @crn4
Created: 4/21/2026
Status: Merged
Merged: 4/23/2026
Merged by: @crn4

Base: mainHead: feature/dynamic-rate-limit-config


📝 Commits (3)

  • b6b1b8b feat: changeable pat rate limiting
  • 6b252de review comments
  • cc09d82 Merge remote-tracking branch 'origin/main' into feature/dynamic-rate-limit-config

📊 Changes

7 files changed (+304 additions, -59 deletions)

View changed files

📝 management/internals/server/boot.go (+11 -1)
📝 management/server/http/handler.go (+7 -37)
📝 management/server/http/middleware/auth_middleware.go (+3 -10)
📝 management/server/http/middleware/auth_middleware_test.go (+13 -9)
📝 management/server/http/middleware/rate_limiter.go (+97 -0)
📝 management/server/http/middleware/rate_limiter_test.go (+171 -0)
📝 management/server/http/testing/testing_tools/channel/channel.go (+2 -2)

📄 Description

Describe your changes

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

some refactoring

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Summary by CodeRabbit

  • New Features
    • Configurable API request rate limiting (enable/disable, requests-per-minute, burst) via environment.
    • Rate limiting can be toggled and updated at runtime without restart.
    • API enforces request limits and falls back gracefully when disabled or unconfigured.
    • Terraform-related requests remain exempt from rate limiting.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/5946 **Author:** [@crn4](https://github.com/crn4) **Created:** 4/21/2026 **Status:** ✅ Merged **Merged:** 4/23/2026 **Merged by:** [@crn4](https://github.com/crn4) **Base:** `main` ← **Head:** `feature/dynamic-rate-limit-config` --- ### 📝 Commits (3) - [`b6b1b8b`](https://github.com/netbirdio/netbird/commit/b6b1b8b3384e7f6d16f123a5bfdb81369bd4f70b) feat: changeable pat rate limiting - [`6b252de`](https://github.com/netbirdio/netbird/commit/6b252de8203963a42e652d8667428d8a1c25774c) review comments - [`cc09d82`](https://github.com/netbirdio/netbird/commit/cc09d821a0421c51b5022b6c308e277318af754d) Merge remote-tracking branch 'origin/main' into feature/dynamic-rate-limit-config ### 📊 Changes **7 files changed** (+304 additions, -59 deletions) <details> <summary>View changed files</summary> 📝 `management/internals/server/boot.go` (+11 -1) 📝 `management/server/http/handler.go` (+7 -37) 📝 `management/server/http/middleware/auth_middleware.go` (+3 -10) 📝 `management/server/http/middleware/auth_middleware_test.go` (+13 -9) 📝 `management/server/http/middleware/rate_limiter.go` (+97 -0) 📝 `management/server/http/middleware/rate_limiter_test.go` (+171 -0) 📝 `management/server/http/testing/testing_tools/channel/channel.go` (+2 -2) </details> ### 📄 Description ## Describe your changes ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [x] It is a refactor - [ ] Created tests that fail without the change (if possible) > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [ ] I added/updated documentation for this change - [x] Documentation is **not needed** for this change (explain why) some refactoring ### Docs PR URL (required if "docs added" is checked) Paste the PR link from https://github.com/netbirdio/docs here: https://github.com/netbirdio/docs/pull/__ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Configurable API request rate limiting (enable/disable, requests-per-minute, burst) via environment. * Rate limiting can be toggled and updated at runtime without restart. * API enforces request limits and falls back gracefully when disabled or unconfigured. * Terraform-related requests remain exempt from rate limiting. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 07:08:19 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#27177