Skip to content

add rate limiting for api/chat endpoint #513

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aboullaite
Copy link
Contributor

Some users abused the usage of the chat endpoint which blow up our infrastructure. We are adding a basic rate limiter to hopefully stop them from abusing it

Signed-off-by: Mohammed Aboullaite <[email protected]>
Copy link

netlify bot commented May 6, 2025

Deploy Preview for next-gb ready!

Name Link
🔨 Latest commit a15d187
🔍 Latest deploy log https://app.netlify.com/sites/next-gb/deploys/681a80c7f65b28000898a063
😎 Deploy Preview https://deploy-preview-513--next-gb.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@aboullaite aboullaite requested a review from yjose May 6, 2025 21:00
Signed-off-by: Mohammed Aboullaite <[email protected]>
}
} catch {
// Don't throw the error - we want the chat to work even if storage fails
// The rate limiter will handle invalid IDs appropriately
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're explicitely deciding not to handle the exception, might aswell remove the try/catch block no ? Unless it's mandated by the compiler

@aboullaite
Copy link
Contributor Author

@yjose dreb tlila meli rje3ti hahah

@yjose
Copy link
Member

yjose commented May 17, 2025

@aboullaite, is there a specific reason you chose to use fingerprinting instead of the user's IP address? At least this is what they recommend in the docs.

@aboullaite
Copy link
Contributor Author

@yjose Ip can be easily altered and changed. Fingerprinting is more resilient afaik

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.

3 participants