Skip to content

fix: nil guards, safe type assertions, panic prevention, and rate limiter plugin#3757

Open
srpatcha wants to merge 5 commits intohigress-group:mainfrom
srpatcha:docs/fix-trailing-whitespace
Open

fix: nil guards, safe type assertions, panic prevention, and rate limiter plugin#3757
srpatcha wants to merge 5 commits intohigress-group:mainfrom
srpatcha:docs/fix-trailing-whitespace

Conversation

@srpatcha
Copy link
Copy Markdown

Automated contribution by @srpatcha.

Changes

docs: remove trailing whitespace from README.md

Signed-off with GPG.

Signed-off-by: Srikanth Patchava <spatchava@meta.com>
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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>
@CH3CHO
Copy link
Copy Markdown
Collaborator

CH3CHO commented Apr 25, 2026

Please sign the CLA and ass Signed-off-by note to your commit. Thanks.

@CH3CHO
Copy link
Copy Markdown
Collaborator

CH3CHO commented Apr 25, 2026

I believe the PR isn't submitted with a correct title.

@srpatcha srpatcha changed the title docs: remove trailing whitespace from README.md fix: nil guards, safe type assertions, panic prevention, and rate limiter plugin Apr 25, 2026
@srpatcha
Copy link
Copy Markdown
Author

Hi @CH3CHO, thank you for the review!

  1. PR title — Fixed. Updated to: fix: nil guards, safe type assertions, panic prevention, and rate limiter plugin
  2. Signed-off-by — Adding now to all commits and will force-push shortly.
  3. CLA — Will sign the CLA via the assistant link.

Thank you for your patience!

@srpatcha srpatcha force-pushed the docs/fix-trailing-whitespace branch from 08b66b9 to 7a438f3 Compare April 25, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants