implement rate limit support for mastodon endpoints #23
No reviewers
Labels
No labels
bug
customization
duplicate
enhancement
feature parity
help wanted
high priority
invalid
low priority
question
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: woem.men/forkey#23
Loading…
Reference in a new issue
No description provided.
Delete branch "sugar/forkey:implement-rate-limits-for-mastodon-endpoints"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Implement rate limits for future Mastodon endpoints.
Why
Some endpoints will need stricter rate limits.
Additional info (optional)
Note that rate limits are by default disabled in development, see
RateLimiterService
.Checklist
689ac72c22
toaaa49f2131
@ -456,1 +440,4 @@
async #checkRateLimit(ep: IEndpoint | IMastodonEndpoint, user: MiLocalUser | null | undefined, request: FastifyRequest<{ Body: Record<string, unknown> | undefined, Querystring: Record<string, unknown> }>): Promise<void> {
const bypassRateLimit = this.config.bypassRateLimit?.some(({ header, value }) => request.headers[header] === value) ?? false;
console.log(ep);
Looks like you forgot to remove this console log
fixed :3
aaa49f2131
tod5983dc12e
how would i go about testing these endpoints? are there unit tests we can write, perhaps?
fae tested them by removing code that only enforces rate limits in production, adding a limit to an already existing endpoint, and repeatedly visiting it
not sure how would fae go about testing it, but if that helps it's the same system as for regular misskey endpoints
also, it's worth noting that rate limiter only works in production environments (as in upstream), which makes it tough to test
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.