Repository navigation
feat(integrations): rate-limit incoming webhook calls - #102
Merged
itsskofficial merged 2 commits intoOct 8, 2026
Merged
Conversation
POST /hooks/{id} checked the secret and a body size limit but had no rate
limit, so a leaked webhook URL could flood Sentient with task runs.
Each hook now has a token bucket. `integrations.webhook_rate_limit_per_minute`
(default 30, 0 turns it off) sets its size, and a call over the limit gets
a 429 with a `Retry-After` header. The check runs after the secret check, so
callers without the secret can't use up a real caller's budget, and a refused
call is neither published nor counted. A deleted hook drops its bucket.
Closes existence-master#91
anushkaanair
requested review from
Kabeer2004 and
itsskofficial
as code owners
October 8, 2026 08:53
|
All contributors have signed the CLA ✍️ ✅ |
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
Contributor
|
Merged, thank you @anushkaanair! Clean change, good tests, and the contract update in API.md was exactly right. If you'd like another one, #92 (IMAP STARTTLS and folders) is a nice next step in the same area. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
What and why
Webhook calls to Sentient are now rate limited, so a leaked webhook URL can no longer flood Sentient with task runs. Each hook accepts 30 calls a minute by default; extra calls get a
429with aRetry-Afterheader.Closes #91
integrations.webhook_rate_limit_per_minute(default 30,0turns the limit off), with a description like the settings around it.HookStore.rate_limited). An idle hook can take a burst the size of the limit, and a steady caller is held to it.POST /hooks/{id}runs after the secret check. That way someone who only knows the URL can't use up a real caller's budget, and a call without the secret still gets401, not429.calls.HookStore, so it gets the same limit. A test covers that.docs/API.mdsection 16 documents the setting and the429.How I tested it
The new behaviour tests fail when the check in the route is removed. They use a movable clock (
sentient.integrations.hooks._monotonic), so they never sleep. I didn't run the desktop app; nothing indesktop/changed.Checklist
pytest/npm run typecheckpass locally for what I touchedruff check sentient testsis cleandocs/API.mdupdated if the desktop ↔ engine contract changed