-
Notifications
You must be signed in to change notification settings - Fork 1k
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
fix: avoid blocking the request if it does not have an associated ip #1540
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Ignored Deployments
|
Thank you for following the naming conventions for pull request titles! 🙏 |
The PR removes the else block that sends a response when the IP address is not found. This could potentially lead to issues if the IP address is not found in the request headers. I suggest adding a response for the case when the IP address is not found. This will ensure that the server sends a response in all cases. Here is a code suggestion: if (ip) {
try {
if (request.nextUrl.pathname === "/api/auth/callback/credentials") {
await loginLimiter.check(ip);
} else if (request.nextUrl.pathname === "/api/v1/users") {
await signUpLimiter.check(ip);
}
return res;
} catch (_e) {
console.log("Rate Limiting IP: ", ip);
return NextResponse.json({ error: "Too many requests, Please try after a while!" }, { status: 429 });
}
} else {
console.log("IP address not found in the request headers");
return NextResponse.json({ error: "IP address not found, Please check your request!" }, { status: 400 });
} This code will log a message and send a response with a 400 status code when the IP address is not found. This will help in debugging and also inform the client that the request was malformed. |
c380c98
to
add3ed2
Compare
* main: (42 commits) chore: add revert to oss-friends (formbricks#745) fix: pass authOptions to getServerSession in authLayout (formbricks#1584) fix: fixed URL example for "Create Survey" API endpoint is wrong formbricks#1555 (formbricks#1586) fix(docs): default account info docs changes (formbricks#1583) chore: Add docker packages to Github Packages on release (formbricks#1585) feat: avatar upload (formbricks#1546) fix: editor crashing (formbricks#1582) fix: Add scroll to the setting navbar (formbricks#1398) are you sure modal missing fix:formbricks#1419 (formbricks#1485) fix: github linting issues (formbricks#1510) refactor: added authorization to airtable integration and create a common actions file (formbricks#1538) docs: add docs for airtable (formbricks#1541) fix: missing static generation store in revalidation due to pages dir (formbricks#1581) feat: Pagination for other values in multi choice (formbricks#1560) feat: $199 pricing model for unlimited plans (formbricks#1564) fix: make pricing pages consistent (formbricks#1567) fix: openText issue (formbricks#1579) fix: avoid blocking the request if it does not have an associated ip (formbricks#1540) feat: Add Unkey to OSS Friends (formbricks#1574) feat: FOR-683 Role Switch (formbricks#1450) ...
* main: (70 commits) chore: add revert to oss-friends (formbricks#745) fix: pass authOptions to getServerSession in authLayout (formbricks#1584) fix: fixed URL example for "Create Survey" API endpoint is wrong formbricks#1555 (formbricks#1586) fix(docs): default account info docs changes (formbricks#1583) chore: Add docker packages to Github Packages on release (formbricks#1585) feat: avatar upload (formbricks#1546) fix: editor crashing (formbricks#1582) fix: Add scroll to the setting navbar (formbricks#1398) are you sure modal missing fix:formbricks#1419 (formbricks#1485) fix: github linting issues (formbricks#1510) refactor: added authorization to airtable integration and create a common actions file (formbricks#1538) docs: add docs for airtable (formbricks#1541) fix: missing static generation store in revalidation due to pages dir (formbricks#1581) feat: Pagination for other values in multi choice (formbricks#1560) feat: $199 pricing model for unlimited plans (formbricks#1564) fix: make pricing pages consistent (formbricks#1567) fix: openText issue (formbricks#1579) fix: avoid blocking the request if it does not have an associated ip (formbricks#1540) feat: Add Unkey to OSS Friends (formbricks#1574) feat: FOR-683 Role Switch (formbricks#1450) ...
What does this PR do?
Disables the blocking of a request if it does not have an IP address associated with it. This is possible when running it in docker and accessing it from the same network
Fixes #1533
Type of change
How should this be tested?
Run
docker compose --env /dev/null up
to test it with a newly built imageChecklist
Required
pnpm build
console.logs
git pull origin main
Appreciated