Skip to content

fix: match Sentry URLs by parsed hostname - #7397

Open
YusefSyed wants to merge 1 commit into
getsentry:masterfrom
YusefSyed:codex/sentry-7332-hostname-matching
Open

YusefSyed wants to merge 1 commit into
getsentry:masterfrom
YusefSyed:codex/sentry-7332-hostname-matching

Conversation

@YusefSyed

@YusefSyed YusefSyed commented Sep 4, 2026

Copy link
Copy Markdown

Description

Determine whether a destination is the configured Sentry endpoint by comparing
its parsed hostname with the DSN hostname instead of searching for the DSN
network-location text anywhere in the candidate string.

This prevents hostname suffixes, URL user-info, paths, and query strings from
being classified as SDK-internal. It preserves scheme-independent and raw-host
input, case-insensitive matching, IPv6 handling, and the agreed
same-host/different-port behavior. The exact contract was confirmed by the
maintainer in #7332.

Regression coverage includes the classifier and downstream trace-header
propagation decisions.

Issues

Validation

  • uv run tox -e py3.14-common: 2,431 total cases, 173 skipped, 0 failures/errors
  • uv run --group typing mypy sentry_sdk: no issues in 193 source files
  • full tests/test_utils.py: 224 passed, 2 skipped
  • full tests/tracing/test_misc.py: 43 passed
  • full tests/integrations/stdlib/test_httplib.py: 91 passed
  • uv run ruff check and uv run ruff format --check: passed
  • uv run pre-commit run --all-files: passed
  • git diff --check: passed

Review and tooling

AI tools assisted with repository navigation, implementation drafting, test
execution, and diff analysis. The account holder reviewed and approved the
final three-file diff and validation evidence before submission, understands
the hostname-matching contract, and accepts responsibility for the
contribution. The commands above were executed through Codex in the account
holder's local checkout; they are not presented as commands manually typed by
the account holder.

@YusefSyed
YusefSyed marked this pull request as ready for review September 4, 2026 15:59
@YusefSyed
YusefSyed requested a review from a team as a code owner September 4, 2026 15:59
@YusefSyed

Copy link
Copy Markdown
Author

Following up on the hostname-matching fix for #7332. The change compares parsed hostnames so suffixes, user-info, paths, and query strings do not classify a destination as SDK-internal, while retaining the existing same-host/different-port behavior. Could someone familiar with this area review the intended matching contract? Happy to make changes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DSN netloc substring matching misclassifies unrelated destinations as SDK-internal

1 participant