Skip to content

Commit dc4a7d7

Browse files
committed
Fix proxy_rebuild_adds_and_removes_params test after tstoken validation
Test was constructing a tsclick URL without a signature. Now that handle_first_party_proxy_rebuild validates the tstoken via reconstruct_and_validate_signed_target, the test must supply a properly signed click URL. Compute the token with compute_encrypted_sha256_token over tsurl + original params before building tsclick.
1 parent 4e51206 commit dc4a7d7

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

crates/trusted-server-core/src/proxy.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,8 +1801,15 @@ mod tests {
18011801
#[tokio::test]
18021802
async fn proxy_rebuild_adds_and_removes_params() {
18031803
let settings = create_test_settings();
1804-
// Original canonical (no token)
1805-
let tsclick = "/first-party/click?tsurl=https%3A%2F%2Fcdn.example%2Flanding.html&x=1";
1804+
// Build a properly signed click URL — rebuild validates tstoken before mutating.
1805+
let tsurl = "https://cdn.example/landing.html";
1806+
let full_for_token = format!("{}?x=1", tsurl);
1807+
let token = crate::http_util::compute_encrypted_sha256_token(&settings, &full_for_token);
1808+
let tsclick = format!(
1809+
"/first-party/click?tsurl={}&x=1&tstoken={}",
1810+
url::form_urlencoded::byte_serialize(tsurl.as_bytes()).collect::<String>(),
1811+
token,
1812+
);
18061813
let body = serde_json::json!({
18071814
"tsclick": tsclick,
18081815
"add": {"y": "2"},

0 commit comments

Comments
 (0)