Rate-limit df.start() per user to prevent DoS (security D-1, D-2)#142
Open
Copilot wants to merge 3 commits into
Open
Rate-limit df.start() per user to prevent DoS (security D-1, D-2)#142Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
8 tasks
Agent-Logs-Url: https://github.com/microsoft/pg_durable/sessions/7f465c69-8a33-49e5-a106-f671146ed2a2 Co-authored-by: pinodeca <32303022+pinodeca@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/pg_durable/sessions/7f465c69-8a33-49e5-a106-f671146ed2a2 Co-authored-by: pinodeca <32303022+pinodeca@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add rate limiting to df.start() to prevent DoS
Rate-limit df.start() per user to prevent DoS (security D-1, D-2)
May 5, 2026
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.
df.start()was unconstrained — any user could flood instances, exhausting disk, the worker connection pool, and duroxide history. This adds two complementary per-user quotas enforced before any rows are written or worker capacity consumed. Superusers bypass both checks.New GUCs (
PGC_SUSET— superuser-only at runtime)df.max_concurrent_per_user100df.max_instances_per_user10000df.instancesper user0= unlimited for both.Enforcement in
df_start()(src/dsl.rs)After identity capture, before
insert_nodes()/ duroxide enqueue:Error messages include the exact
DELETEstatement needed to reclaim quota.Other changes
src/lib.rs— GUC statics +_PG_initregistration withGucContext::Susetsrc/types.rs—get_max_concurrent_per_user()/get_max_instances_per_user()helperstests/e2e/sql/22_rate_limit.sql— E2E: cap rejection, slot-free-then-succeed, quota rejection, superuser bypassUSER_GUIDE.md— New "Rate Limiting" section with GUC reference, error examples, and quota reclamation instructionsWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.compostgres: pg_durable_worker(dns block)httpbingo.orgpostgres: pg_durable_worker(dns block)If you need me to access, download, or install something from one of these locations, you can either: