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

fix: Ignore local/loopback traffic in IP connection limiter #2335

Merged
merged 1 commit into from
Sep 26, 2024
Merged

Conversation

sds
Copy link
Member

@sds sds commented Sep 26, 2024

Why is this change needed?

This allows the use of reverse proxies.

Merge Checklist


PR-Codex overview

This PR focuses on enhancing the connection limiting functionality by ignoring local loopback IP traffic and modifying a test case.

Detailed summary

  • Updated rateLimits.ts to ignore both 127.0.0.1 and ::1 for local loopback traffic.
  • Changed the connection limit check in server.ts to exclude local IPs from the limit enforcement.
  • Modified the test in eventService.test.ts to skip the test case for excessive subscriptions.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

vercel bot commented Sep 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hub-monorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 26, 2024 5:07pm

Copy link

changeset-bot bot commented Sep 26, 2024

🦋 Changeset detected

Latest commit: fd19441

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@farcaster/hubble Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@sds sds added the t-bug A fix for a bug with the current system label Sep 26, 2024
@sds sds enabled auto-merge (squash) September 26, 2024 16:54
@@ -319,7 +319,7 @@ class IpConnectionLimiter {
const ip = extractIPAddress(peerString) ?? "unknown";

const connections = this.ipConnections.get(ip) ?? 0;
if (connections >= this.perIpLimit) {
if (ip !== "127.0.0.1" && connections >= this.perIpLimit) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What about ipv6?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a fair point, I just don't think people are using IPV6 for loopback communication. I'll follow up however.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added IPv6 loopback IP to the list.

This allows the use of reverse proxies.
@sds sds disabled auto-merge September 26, 2024 17:19
@sds sds merged commit fff8d7b into main Sep 26, 2024
7 of 8 checks passed
@sds sds deleted the sds/ignore branch September 26, 2024 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t-bug A fix for a bug with the current system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants