Skip to content

Commit 2b29d62

Browse files
committed
fix(oauth): update DCR integration test for skip-invalid behavior
Commit b8b4acd changed validate_redirect_uris to skip invalid redirect URIs (only failing when zero valid URIs remain) and updated the inline unit tests in crates/mcpmux-gateway/src/oauth/dcr.rs, but missed the duplicate test in the integration crate. The stale test_mixed_valid_invalid_rejected asserted the old reject-the-whole-batch behavior and failed on all three rust-test platforms. Replace it with test_mixed_valid_invalid_passes (mix now succeeds) and add test_all_invalid_rejected (zero valid URIs still fails), matching the new semantics and the inline tests. Signed-off-by: Mohammod Al Amin Ashik <maa.ashik00@gmail.com>
1 parent 938e633 commit 2b29d62

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

tests/rust/tests/oauth/dcr.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,23 @@ fn test_external_https_rejected() {
7171
}
7272

7373
#[test]
74-
fn test_mixed_valid_invalid_rejected() {
75-
// One invalid URI should fail the whole validation
74+
fn test_mixed_valid_invalid_passes() {
75+
// Invalid URIs are skipped rather than failing the whole registration, as long as
76+
// at least one valid URI remains. Clients like Cursor send a mix of valid (custom
77+
// scheme + loopback) and invalid (non-loopback https) URIs in a single DCR request.
7678
let uris = vec![
7779
"http://127.0.0.1:8080/callback".to_string(),
78-
"https://evil.com/steal".to_string(), // invalid
80+
"https://evil.com/steal".to_string(), // invalid, skipped
81+
];
82+
assert!(validate_redirect_uris(&uris).is_ok());
83+
}
84+
85+
#[test]
86+
fn test_all_invalid_rejected() {
87+
// When every URI is invalid, zero valid URIs remain and registration must fail.
88+
let uris = vec![
89+
"https://evil.com/steal".to_string(),
90+
"http://example.com/callback".to_string(),
7991
];
8092
assert!(validate_redirect_uris(&uris).is_err());
8193
}

0 commit comments

Comments
 (0)