fix: nil guards, safe type assertions, panic prevention, and rate limiter plugin#3757
Open
srpatcha wants to merge 5 commits intohigress-group:mainfrom
Open
fix: nil guards, safe type assertions, panic prevention, and rate limiter plugin#3757srpatcha wants to merge 5 commits intohigress-group:mainfrom
srpatcha wants to merge 5 commits intohigress-group:mainfrom
Conversation
Signed-off-by: Srikanth Patchava <spatchava@meta.com>
|
|
Added nil pointer guard before dereferencing in db.go, converted unsafe type assertions to comma-ok form to prevent panics, and added rows.Err() checks after scan loops to catch iteration errors. Signed-off-by: Srikanth Patchava <spatchava@meta.com>
Add rate-limit-advanced plugin with: - Sliding window algorithm for accurate rate limiting - Per-user and per-IP rate limiting support - Configurable response codes and headers - Token bucket fallback for burst handling - Thread-safe counter store with cleanup - Redis-compatible counter interface - Configurable retry-after headers Signed-off-by: Srikanth Patchava <spatchava@meta.com>
… on invalid regexp Replace regexp.MustCompile with regexp.Compile in parseConfig to prevent a panic when users provide invalid regexp patterns in the block_regexp_urls configuration. The function now returns a descriptive error instead of crashing the plugin. Signed-off-by: Srikanth Patchava <spatchava@meta.com>
Add tests covering: - SlidingWindowCounter creation, allow, expiry, count, reset - TokenBucket creation, allow, refill, remaining tokens - CounterStore creation, get-or-create, cleanup - RateLimitConfig default values - Client key extraction config Signed-off-by: Srikanth Patchava <spatchava@meta.com>
Collaborator
|
Please sign the CLA and ass |
Collaborator
|
I believe the PR isn't submitted with a correct title. |
Author
|
Hi @CH3CHO, thank you for the review!
Thank you for your patience! |
08b66b9 to
7a438f3
Compare
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.
Automated contribution by @srpatcha.
Changes
docs: remove trailing whitespace from README.md
Signed-off with GPG.