feat(types): Add organization ID parsing for DSNs#1202
Conversation
|
cbde4ff to
53bd774
Compare
53bd774 to
d8f38f3
Compare
d8f38f3 to
08f1a80
Compare
08f1a80 to
cb59fdf
Compare
a32eb15 to
ce74a79
Compare
cb59fdf to
28f70b6
Compare
ce74a79 to
221c434
Compare
f8efddc to
b72fb2d
Compare
221c434 to
17bead9
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b72fb2d. Configure here.
| #[test] | ||
| fn test_dsn_org_id_rejects_empty_first_label() { | ||
| assert_org_id("https://username@.ingest.sentry.io/42", None); | ||
| } |
There was a problem hiding this comment.
Broken empty-label org ID test
Medium Severity
test_dsn_org_id_rejects_empty_first_label builds a DSN from https://username@.ingest.sentry.io/42. That host has an empty DNS label, which the url crate rejects per the URL Standard, so Dsn::from_str(...).unwrap() panics before org_id() is exercised. The case is unreachable through a valid Dsn.
Reviewed by Cursor Bugbot for commit b72fb2d. Configure here.
| /// - `o{orgid}.ingest.sentry.io` | ||
| fn extract_org_id(host: &str) -> Option<&str> { | ||
| // First split on the dots, up to 6 segments. | ||
| let mut host_iter = host.splitn(6, '.'); |
There was a problem hiding this comment.
Just curious, are you splitting it into 6 segments to make sure the last one is always None?
| None, | ||
| ); | ||
| } | ||
|
|
There was a problem hiding this comment.
You might want to add a test for a hostname with a 6th part that is not None, e.g. https://username@o123.ingest.de.sentry.io.com/42
Expose `Dsn::org_id` so callers can derive the SDK organization ID needed for strict trace continuation. Parse only Sentry SaaS ingest DSN hosts, including regional hosts, and return `None` for self-hosted, Relay, malformed, and overflow cases. Closes [#1159](#1159) Closes [RUST-233](https://linear.app/getsentry/issue/RUST-233)
b72fb2d to
a53202a
Compare


Expose
Dsn::org_idso callers can derive the SDK organization ID needed for strict trace continuation. Parse only Sentry SaaS ingest DSN hosts, including regional hosts, and returnNonefor self-hosted, Relay, malformed, and overflow cases.Closes #1159
Closes RUST-233