mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
## What changed - Accept the allowlisted `.onboarding_entrypoint=life_sciences` suffix on a valid OAuth state while continuing to reject unknown or malformed suffixes. - Return the parsed callback metadata from the login server without including the suffix in the token exchange redirect URI. - Add the optional `onboardingEntrypoint` field and `life_sciences` value to the v2 `account/login/completed` notification and generated protocol exports. ## Testing - Cover valid, invalid, and repeated OAuth state suffixes. - Verify the end-to-end login callback result, token redirect URI, and app-server notification payload. GitOrigin-RevId: c2ee146328ddd43c03a503260d5d492e186fa889
50 lines
1.3 KiB
Rust
50 lines
1.3 KiB
Rust
use super::*;
|
|
use pretty_assertions::assert_eq;
|
|
|
|
#[test]
|
|
fn accepts_the_original_oauth_state() {
|
|
assert_eq!(
|
|
login_callback_result_from_state("expected-state", "expected-state"),
|
|
Some(LoginCallbackResult::default())
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn accepts_the_allowlisted_life_sciences_suffix() {
|
|
assert_eq!(
|
|
login_callback_result_from_state(
|
|
"expected-state.onboarding_entrypoint=life_sciences",
|
|
"expected-state",
|
|
),
|
|
Some(LoginCallbackResult {
|
|
onboarding_entrypoint: Some(LoginOnboardingEntrypoint::LifeSciences),
|
|
})
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn rejects_a_suffix_when_the_nonce_does_not_match() {
|
|
assert_eq!(
|
|
login_callback_result_from_state(
|
|
"different-state.onboarding_entrypoint=life_sciences",
|
|
"expected-state",
|
|
),
|
|
None
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn rejects_unrecognized_or_repeated_suffixes() {
|
|
for callback_state in [
|
|
"expected-state.onboarding_entrypoint=unknown",
|
|
"expected-state.onboarding_entrypoint=life_sciences.onboarding_entrypoint=life_sciences",
|
|
"expected-state.extra=value.onboarding_entrypoint=life_sciences",
|
|
] {
|
|
assert_eq!(
|
|
login_callback_result_from_state(callback_state, "expected-state"),
|
|
None,
|
|
"unexpectedly accepted {callback_state}",
|
|
);
|
|
}
|
|
}
|