Skip to content

fix(relay): preserve query strings during URL normalization - #7450

Open
cuishuang wants to merge 1 commit into
block:mainfrom
cuishuang:main
Open

fix(relay): preserve query strings during URL normalization#7450
cuishuang wants to merge 1 commit into
block:mainfrom
cuishuang:main

Conversation

@cuishuang

Copy link
Copy Markdown

Summary

Fix relay URL normalization so query parameters are not modified accidentally.

The previous implementations used string-wide trim_end_matches('/') and replace() calls. These operations could alter query values or nested URLs, for example:

wss://relay.example/?next=/

could become:

wss://relay.example?next=

and:

wss://relay.example/path?redirect=wss://other.example/

could have its nested query URL rewritten.

The updated code parses URLs with url::Url, changes only the URL scheme and intended path component, and preserves query strings.

Related issue

Fixes #

Testing

  • cargo test -p buzz-core relay::tests --lib
  • cargo test -p buzz-cli client::tests --lib
  • cargo test -p buzz-acp relay::tests --lib
  • cargo clippy -p buzz-core -p buzz-cli -p buzz-acp --all-targets -- -D warnings

Regression coverage includes:

wss://relay.example/?next=/
wss://relay.example/?next=/foo/
wss://relay.example/?url=wss://other.example/

Signed-off-by: cuishuang <imcusg@gmail.com>
@cuishuang
cuishuang requested a review from a team as a code owner September 7, 2026 12:42
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

🔐 Codex Security Review

Status: review required for the current range.

The current range is 3c7f288c60d67df78577b237e27c3dfc8831aaa1...8a5e8c1d21de0971a4598dd1542ea8a099f5c0ce.
A new review must complete for this exact range. When manual authorization
is required, a Block organization member must comment exactly
@buzz-security-review 8a5e8c1d21de0971a4598dd1542ea8a099f5c0ce to authorize a new review.
Any previous review applies only to its recorded range.

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.

1 participant