Repository navigation
fix(gti-mcp): build URL ids with URL-safe base64 - #342
Merged
Merged
Conversation
get_url_report and get_entities_related_to_an_url encoded the URL with standard base64. The API expects the URL-safe alphabet (vt.url_id), so any URL whose encoding contains "/" or "+" was looked up under the wrong id, and a "/" also split the id into extra path segments. URLs with query strings hit this often, e.g. https://example.com/?a=1. Signed-off-by: KVR Vishnu <46535652+VISHNU0906@users.noreply.github.com>
dandye
approved these changes
Nov 9, 2026
dandye
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the contribution. LGTM, merging now.
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
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.
get_url_reportandget_entities_related_to_an_urlbuild the URL id with standard base64. The API wants URL-safe base64 without padding, which is whatvt.url_iddoes, so a URL whose encoding contains/or+is looked up under the wrong id. A/also splits the id into extra path segments. URLs with a query string hit this a lot. For example,https://example.com/?a=1encodes toaHR0cHM6Ly9leGFtcGxlLmNvbS8/YT0x, so the request goes to/urls/aHR0cHM6Ly9leGFtcGxlLmNvbS8/YT0xinstead of/urls/aHR0cHM6Ly9leGFtcGxlLmNvbS8_YT0x.The fix switches
url_to_base64tobase64.urlsafe_b64encode. URLs that never produced/or+get the same id as before.Tests:
test_get_reportsandtest_get_entities_relatedhave new URL cases whose standard encoding contains/and+. They go through the MCP client and the local HTTP server, so they check the exact path requested.test_url_to_base64_matches_vt_url_idcompares the helper withvt.url_id.With the old encoder, those 4 new cases fail. The full gti suite passes (67 passed).
cc @dandye