Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rate limit the public api #899

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

feat: rate limit the public api #899

wants to merge 11 commits into from

Conversation

WcaleNieWolny
Copy link
Contributor

No description provided.

@riderx
Copy link
Contributor

riderx commented Dec 2, 2024

missing limit on file endpoint as well

@WcaleNieWolny
Copy link
Contributor Author

missing limit on file endpoint as well

Tell me please, what should be the key for the file endpoint

@riderx
Copy link
Contributor

riderx commented Dec 12, 2024

we added in prod device_id for files so you can now use it

@riderx
Copy link
Contributor

riderx commented Dec 12, 2024

i think the rate limit PR is missing wrangler config

@WcaleNieWolny
Copy link
Contributor Author

i think the rate limit PR is missing wrangler config

it's not. You need to set the rate limits in the code, and than use the newly created script (scripts/generate_rate_limits.ts) to generate the rate limits for the wrangler config.

I have shared the command with you privately, but I will share it again here:

bun run scripts/generate_rate_limits.ts ./cloudflare_workers/plugin/index.ts >> cloudflare_workers/plugin/wrangler.toml

@riderx
Copy link
Contributor

riderx commented Dec 12, 2024

Why generating them while all the wrangler config is written in the config file?

@riderx
Copy link
Contributor

riderx commented Dec 13, 2024

Add also a log in stats about rate limiting, it's important for the user to be able to see it

@WcaleNieWolny
Copy link
Contributor Author

@riderx bc7c56c

In this commit I added a feature where when the device is rate-limited in /updates or /channel_self the backend will send a stat

@WcaleNieWolny
Copy link
Contributor Author

I will add rate limiting for the files worker

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
10.4% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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.

2 participants