Skip to content

Fix atomic rate limiting and webhook retry behavior - #5

Draft
Jemade wants to merge 5 commits into
mainfrom
hardening/atomic-rate-limits-20261009
Draft

Jemade wants to merge 5 commits into
mainfrom
hardening/atomic-rate-limits-20261009

Conversation

@Jemade

@Jemade Jemade commented Oct 9, 2026

Copy link
Copy Markdown
Owner

Actual changes

  • Replace non-atomic read/check/add Redis sliding-window sequence with WATCH/MULTI optimistic transactions, retrying conflicting updates.
  • Avoid loading every window entry into memory; count active entries and retrieve only oldest score.
  • Add concurrent quota regression test and configuration validation tests.
  • Retry webhook HTTP 429/5xx and transport failures, not permanent HTTP 4xx errors; add regression test.

Validation status

Changes committed but not test-executed. Local GitHub clone failed because DNS resolution of github.com is unavailable in the execution container. Run pip install -e '.[dev]', ruff check ., and pytest -q, including tests with the project's fakeredis version. Do not merge before green CI.

Still required for high-scale public deployment

  • Strong SSRF protection for user-supplied webhook URLs (DNS resolution and rebinding, private-network blocking, redirects, and proxy behavior).
  • Durable outbox/background webhook workers; currently request path waits on delivery.
  • Shared HTTP client lifecycles, bounded provider concurrency, idempotency keys, per-tenant quota/budget enforcement, and load tests.
  • Reconsider production Redis fail-open policy, security controls and database pool sizing.

This PR is a targeted reliability improvement, not a claim of production scalability.

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.

1 participant