Skip to content

Commit

Permalink
Fix code scanning alert no. 2: Incomplete URL substring sanitization
Browse files Browse the repository at this point in the history
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
  • Loading branch information
dsp-ant and github-advanced-security[bot] authored Nov 24, 2024
1 parent da12f5f commit d20b245
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sentry/src/mcp_server_sentry/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def extract_issue_id(issue_id_or_url: str) -> str:

if issue_id_or_url.startswith(("http://", "https://")):
parsed_url = urlparse(issue_id_or_url)
if not parsed_url.netloc.endswith("sentry.io"):
raise SentryError("Invalid Sentry URL. Must be a URL ending with sentry.io")
if not parsed_url.hostname or not parsed_url.hostname.endswith(".sentry.io"):
raise SentryError("Invalid Sentry URL. Must be a URL ending with .sentry.io")

path_parts = parsed_url.path.strip("/").split("/")
if len(path_parts) < 2 or path_parts[0] != "issues":
Expand Down

0 comments on commit d20b245

Please sign in to comment.