Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(filter): more tests for SchemeDomainPort #4015

Merged
merged 4 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- Remove the OTEL spans endpoint in favor of Envelopes. ([#3973](https://github.com/getsentry/relay/pull/3973))
- Remove the `generate-schema` tool. Relay no longer exposes JSON schema for the event protocol. Consult the Rust type documentation of the `relay-event-schema` crate instead. ([#3974](https://github.com/getsentry/relay/pull/3974))
- Allow creation of `SqliteEnvelopeBuffer` from config, and load existing stacks from db on startup. ([#3967](https://github.com/getsentry/relay/pull/3967))
- Add tests for `SchemeDomainPort`. ([#4015](https://github.com/getsentry/relay/pull/4015))
aldy505 marked this conversation as resolved.
Show resolved Hide resolved

## 24.8.0

Expand Down
40 changes: 40 additions & 0 deletions relay-filter/src/csp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ mod tests {
("abc.com/something]:", None, Some("abc.com"), None),
("abc.co]m/[something:", None, Some("abc.co]m"), None),
("]abc.com:9000", None, Some("]abc.com"), Some("9000")),
(
"https://api.example.com/foo/00000000-0000-0000-0000-000000000000?includes[]=user&includes[]=image&includes[]=author&includes[]=tag",
Some("https"),
Some("api.example.com"),
None,
)
];

for (url, scheme, domain, port) in examples {
Expand Down Expand Up @@ -265,6 +271,40 @@ mod tests {
Some("[1fff:0:a88:85a3::ac1f]"),
Some("8001"),
),
// invalid IPv6 for localhost since it's not inside brackets
("::1", None, Some(":"), Some("1")),
("[::1]", None, Some("[::1]"), None),
(
"http://[fe80::862a:fdff:fe78:a2bf%13]",
Some("http"),
Some("[fe80::862a:fdff:fe78:a2bf%13]"),
None,
),
// invalid addresses. although these results don't represent correct results,
// they are here to make sure the application won't crash.
("192.168.1.1.1", None, Some("192.168.1.1.1"), None),
("192.168.1.300", None, Some("192.168.1.300"), None),
(
"[2001:0db8:85a3:::8a2e:0370:7334]",
None,
Some("[2001:0db8:85a3:::8a2e:0370:7334]"),
None,
),
("[fe80::1::]", None, Some("[fe80::1::]"), None),
("fe80::1::", None, Some("fe80::1:"), Some("")),
(
"[2001:0db8:85a3:xyz::8a2e:0370:7334]",
None,
Some("[2001:0db8:85a3:xyz::8a2e:0370:7334]"),
None,
),
(
"2001:0db8:85a3:xyz::8a2e:0370:7334",
None,
Some("2001:0db8:85a3:xyz::8a2e:0370"),
Some("7334"),
),
("192.168.0.1/24", None, Some("192.168.0.1"), None),
];

for (url, scheme, domain, port) in examples {
Expand Down
Loading