Skip to content

Commit 121b776

Browse files
Potential fix for code scanning alert no. 4: Incomplete URL substring sanitization (#74)
* Potential fix for code scanning alert no. 4: Incomplete URL substring sanitization Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Potential fix for code scanning alert no. 5: Incomplete URL substring sanitization Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 7bb482b commit 121b776

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/test_load_from_plex.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import types
33

44
import httpx
5-
5+
from urllib.parse import urlparse
66
from mcp_plex import loader
77
from mcp_plex.types import TMDBShow
88

@@ -60,7 +60,8 @@ def fetchItems(keys):
6060

6161
async def handler(request):
6262
url = str(request.url)
63-
if "themoviedb.org" in url:
63+
hostname = urlparse(url).hostname
64+
if hostname and (hostname == "themoviedb.org" or hostname.endswith(".themoviedb.org")):
6465
assert request.headers.get("Authorization") == "Bearer key"
6566
if "titles:batchGet" in url:
6667
ids = request.url.params.get_list("titleIds")

0 commit comments

Comments
 (0)