-
Notifications
You must be signed in to change notification settings - Fork 416
Duplicate Gateway Registration with Equivalent URLs Bypasses Uniqueness Check #712
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Collaborator
Signed-off-by: RAKHI DUTTA <[email protected]>
Signed-off-by: Mihai Criveti <[email protected]>
2 tasks
crivetimihai
added a commit
that referenced
this pull request
Aug 14, 2025
The normalize_url method was resolving domain names to IP addresses, which breaks for services behind CDNs, load balancers, or reverse proxies. Removed DNS resolution to preserve original domain names. This issue was introduced in PR #712. - Removed socket.gethostbyname() DNS resolution - Updated normalize_url to preserve original domains - Added regression test to verify domains are preserved - Removed unused socket import Signed-off-by: Mihai Criveti <[email protected]>
crivetimihai
added a commit
that referenced
this pull request
Aug 14, 2025
The normalize_url method was resolving ALL domain names to IP addresses, which breaks for services behind CDNs, load balancers, or reverse proxies. This fix: - Preserves domain names for external services (CDN/load balancer support) - Only normalizes 127.0.0.1 to localhost to prevent local duplicates - Maintains fix for issue #649 for localhost/127.0.0.1 duplicates - Keeps compatibility with PR #712's duplicate prevention for local services Changes: - Removed socket.gethostbyname() for external domains - Added special case to convert 127.0.0.1 to localhost - Updated tests to verify both behaviors - Added regression test for duplicate prevention This balances the needs of both issues: - #649: Prevent localhost/127.0.0.1 duplicates (still fixed) - #744: Support services behind CDNs/load balancers (now fixed) Signed-off-by: Mihai Criveti <[email protected]>
crivetimihai
added a commit
that referenced
this pull request
Aug 14, 2025
* Fix #744: Preserve domain names while preventing localhost duplicates The normalize_url method was resolving ALL domain names to IP addresses, which breaks for services behind CDNs, load balancers, or reverse proxies. This fix: - Preserves domain names for external services (CDN/load balancer support) - Only normalizes 127.0.0.1 to localhost to prevent local duplicates - Maintains fix for issue #649 for localhost/127.0.0.1 duplicates - Keeps compatibility with PR #712's duplicate prevention for local services Changes: - Removed socket.gethostbyname() for external domains - Added special case to convert 127.0.0.1 to localhost - Updated tests to verify both behaviors - Added regression test for duplicate prevention This balances the needs of both issues: - #649: Prevent localhost/127.0.0.1 duplicates (still fixed) - #744: Support services behind CDNs/load balancers (now fixed) Signed-off-by: Mihai Criveti <[email protected]> * Fix localhost resolution Signed-off-by: Mihai Criveti <[email protected]> * fix pylint Signed-off-by: RAKHI DUTTA <[email protected]> --------- Signed-off-by: Mihai Criveti <[email protected]> Signed-off-by: RAKHI DUTTA <[email protected]> Co-authored-by: RAKHI DUTTA <[email protected]>
vk-playground
pushed a commit
to vk-playground/mcp-context-forge
that referenced
this pull request
Sep 14, 2025
…ss Check (IBM#712) * issue 649 Signed-off-by: RAKHI DUTTA <[email protected]> * Rebased and linted Signed-off-by: Mihai Criveti <[email protected]> --------- Signed-off-by: RAKHI DUTTA <[email protected]> Signed-off-by: Mihai Criveti <[email protected]> Co-authored-by: RAKHI DUTTA <[email protected]> Co-authored-by: Mihai Criveti <[email protected]>
vk-playground
pushed a commit
to vk-playground/mcp-context-forge
that referenced
this pull request
Sep 14, 2025
* Fix IBM#744: Preserve domain names while preventing localhost duplicates The normalize_url method was resolving ALL domain names to IP addresses, which breaks for services behind CDNs, load balancers, or reverse proxies. This fix: - Preserves domain names for external services (CDN/load balancer support) - Only normalizes 127.0.0.1 to localhost to prevent local duplicates - Maintains fix for issue IBM#649 for localhost/127.0.0.1 duplicates - Keeps compatibility with PR IBM#712's duplicate prevention for local services Changes: - Removed socket.gethostbyname() for external domains - Added special case to convert 127.0.0.1 to localhost - Updated tests to verify both behaviors - Added regression test for duplicate prevention This balances the needs of both issues: - IBM#649: Prevent localhost/127.0.0.1 duplicates (still fixed) - IBM#744: Support services behind CDNs/load balancers (now fixed) Signed-off-by: Mihai Criveti <[email protected]> * Fix localhost resolution Signed-off-by: Mihai Criveti <[email protected]> * fix pylint Signed-off-by: RAKHI DUTTA <[email protected]> --------- Signed-off-by: Mihai Criveti <[email protected]> Signed-off-by: RAKHI DUTTA <[email protected]> Co-authored-by: RAKHI DUTTA <[email protected]>
vk-playground
pushed a commit
to vk-playground/mcp-context-forge
that referenced
this pull request
Sep 14, 2025
…ss Check (IBM#712) * issue 649 Signed-off-by: RAKHI DUTTA <[email protected]> * Rebased and linted Signed-off-by: Mihai Criveti <[email protected]> --------- Signed-off-by: RAKHI DUTTA <[email protected]> Signed-off-by: Mihai Criveti <[email protected]> Co-authored-by: RAKHI DUTTA <[email protected]> Co-authored-by: Mihai Criveti <[email protected]>
vk-playground
pushed a commit
to vk-playground/mcp-context-forge
that referenced
this pull request
Sep 14, 2025
* Fix IBM#744: Preserve domain names while preventing localhost duplicates The normalize_url method was resolving ALL domain names to IP addresses, which breaks for services behind CDNs, load balancers, or reverse proxies. This fix: - Preserves domain names for external services (CDN/load balancer support) - Only normalizes 127.0.0.1 to localhost to prevent local duplicates - Maintains fix for issue IBM#649 for localhost/127.0.0.1 duplicates - Keeps compatibility with PR IBM#712's duplicate prevention for local services Changes: - Removed socket.gethostbyname() for external domains - Added special case to convert 127.0.0.1 to localhost - Updated tests to verify both behaviors - Added regression test for duplicate prevention This balances the needs of both issues: - IBM#649: Prevent localhost/127.0.0.1 duplicates (still fixed) - IBM#744: Support services behind CDNs/load balancers (now fixed) Signed-off-by: Mihai Criveti <[email protected]> * Fix localhost resolution Signed-off-by: Mihai Criveti <[email protected]> * fix pylint Signed-off-by: RAKHI DUTTA <[email protected]> --------- Signed-off-by: Mihai Criveti <[email protected]> Signed-off-by: RAKHI DUTTA <[email protected]> Co-authored-by: RAKHI DUTTA <[email protected]>
vk-playground
pushed a commit
to vk-playground/mcp-context-forge
that referenced
this pull request
Sep 16, 2025
…ss Check (IBM#712) * issue 649 Signed-off-by: RAKHI DUTTA <[email protected]> * Rebased and linted Signed-off-by: Mihai Criveti <[email protected]> --------- Signed-off-by: RAKHI DUTTA <[email protected]> Signed-off-by: Mihai Criveti <[email protected]> Co-authored-by: RAKHI DUTTA <[email protected]> Co-authored-by: Mihai Criveti <[email protected]>
vk-playground
pushed a commit
to vk-playground/mcp-context-forge
that referenced
this pull request
Sep 16, 2025
* Fix IBM#744: Preserve domain names while preventing localhost duplicates The normalize_url method was resolving ALL domain names to IP addresses, which breaks for services behind CDNs, load balancers, or reverse proxies. This fix: - Preserves domain names for external services (CDN/load balancer support) - Only normalizes 127.0.0.1 to localhost to prevent local duplicates - Maintains fix for issue IBM#649 for localhost/127.0.0.1 duplicates - Keeps compatibility with PR IBM#712's duplicate prevention for local services Changes: - Removed socket.gethostbyname() for external domains - Added special case to convert 127.0.0.1 to localhost - Updated tests to verify both behaviors - Added regression test for duplicate prevention This balances the needs of both issues: - IBM#649: Prevent localhost/127.0.0.1 duplicates (still fixed) - IBM#744: Support services behind CDNs/load balancers (now fixed) Signed-off-by: Mihai Criveti <[email protected]> * Fix localhost resolution Signed-off-by: Mihai Criveti <[email protected]> * fix pylint Signed-off-by: RAKHI DUTTA <[email protected]> --------- Signed-off-by: Mihai Criveti <[email protected]> Signed-off-by: RAKHI DUTTA <[email protected]> Co-authored-by: RAKHI DUTTA <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Fix issue #649
This pull request introduces a new function to normalize gateway URLs by resolving hostnames to their corresponding IP addresses. The main goal is to ensure that gateway URLs referencing the same endpoint—whether by hostname or IP—are treated as identical rather than distinct.
Key changes:
These changes help prevent duplicate gateway registrations and updates caused by different URL representations, improving consistency and reliability.
Test Steps:
Added a new gateway server with name
mcp-serverand URLhttp://localhost:8080/sse, verified that the URL was normalized tohttp://127.0.0.1:8080/sseand reflected correctly in both the database and UI.Added a new gateway server with name
mcp-server1and URLhttp://localhost:8000/sse, verified that the URL was normalized tohttp://127.0.0.1:8000/sseand reflected correctly in both the database and UI.Attempted to add a new gateway server with name mcp-server2 and URL http://127.0.0.1:8080/sse (or http://localhost:8080/sse), blocked with the message "A gateway with this URL already exists".
Attempted to update the URL for mcp-server1 to http://127.0.0.1:8080/sse (or http://localhost:8080/sse), blocked with the message "A gateway with this URL already exists".
DB Output Screenshot: Attached below is the database view showing the
gatewaystable entries corresponding to the above test cases, confirming storedid,name, and normalizedurlvalues.UI Output Screenshot: Attached below is the UI view showing the gateway entries for the above test cases, confirming correct display of names, normalized URLs, and statuses.