mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:22:05 +00:00
Add enterprise IdP identity resolution for MCP OAuth (#40739)
## What changed - Resolve stored enterprise IdP sessions against discovered authorization metadata, requiring the configured issuer, public-client authentication, and supported ID-JAG token exchange capabilities. - Bind OIDC identity claims and MCP resource indicators to their configured issuer, client, and server, and require reauthentication when pinned keyring credentials are removed or replaced. - Hold the credential lock while rereading refresh tokens, and isolate enterprise credentials by reserved namespace and Codex home. ## Testing - Cover metadata and claim validation, resource binding, credential replacement and keyring failures, refresh locking, expired ID tokens, and credential namespace isolation. GitOrigin-RevId: edce3c6159f7d6831edf72e9608b3fc3f5823c83
This commit is contained in:
1 parent
75cb7c903d
commit
9b4a0f8a0a
12 files changed
+932
-14
No files matched your search
@@ -19,6 +19,7 @@ use wiremock::matchers::method;
|
||||
use wiremock::matchers::path;
|
||||
|
||||
use super::*;
|
||||
use crate::ema_claims::validate_oidc_identity_assertion;
|
||||
|
||||
fn http_client() -> Arc<dyn HttpClient> {
|
||||
Arc::new(RouteAwareHttpClient::new(HttpClientFactory::new(
|
||||
@@ -348,6 +349,40 @@ fn signed_claims_and_resource_tokens_cannot_widen_authority() -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn identity_and_credential_destinations_are_bound() {
|
||||
for endpoint in [
|
||||
"http://idp.example/token",
|
||||
"https://user:pass@idp.example/token",
|
||||
"https://idp.example/token#fragment",
|
||||
] {
|
||||
assert!(
|
||||
validate_ema_oauth_endpoint(endpoint, "IdP").is_err(),
|
||||
"accepted {endpoint}"
|
||||
);
|
||||
}
|
||||
let original = claims("https://idp.example", "idp-client", "https://mcp.example");
|
||||
assert!(
|
||||
validate_oidc_identity_assertion(&jwt(&original), "https://idp.example", "idp-client")
|
||||
.is_ok()
|
||||
);
|
||||
for (field, value) in [
|
||||
("iss", json!("https://other.example")),
|
||||
("aud", json!(["idp-client", "other"])),
|
||||
("azp", json!("other")),
|
||||
("exp", json!(0)),
|
||||
("sub", json!("")),
|
||||
] {
|
||||
let mut changed = original.clone();
|
||||
changed[field] = value;
|
||||
assert!(
|
||||
validate_oidc_identity_assertion(&jwt(&changed), "https://idp.example", "idp-client")
|
||||
.is_err(),
|
||||
"accepted changed {field}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn provider_errors_cannot_reflect_credentials() {
|
||||
const SENTINEL: &str = "secret-assertion-sentinel";
|
||||
|
||||
Reference in new issue
Block a user