mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Add SPIFFE JWT-SVID support for workload identity authentication (#61207)
## What changed Allow Unix workloads to acquire assertions directly from the SPIFFE Workload API for the existing OpenAI token exchange. Select this source with `OPENAI_IDENTITY_TOKEN_SOURCE=spiffe`, alongside `OPENAI_FEDERATION_RULE_ID`, `SPIFFE_ENDPOINT_SOCKET`, and `OPENAI_SPIFFE_AUDIENCE`. Optionally select an identity with `OPENAI_SPIFFE_ID`. Fetch a JWT-SVID over a Unix socket for each exchange, reconnecting on refresh and bounding acquisition to ten seconds. Reject ambiguous responses and mismatched subject or audience claims, and retain only the gRPC status code from agent errors. Signature and lifetime verification remain the token endpoint's responsibility. Keep file acquisition as the default, reject conflicting source settings, and exclude the new OpenAI-specific settings from model-launched environments. Document configuration and deployment constraints. ## Testing Add local-socket tests for token exchange and refresh after agent restart, concurrent refreshes, JWT-SVIDs without key IDs, identity selection, error redaction, and timeouts. Add configuration tests for explicit source selection, invalid or conflicting settings, unsupported platforms, and session consistency. GitOrigin-RevId: 9d88438ff41cd8f0b7356c512ec451455ed7c399
This commit is contained in:
@@ -9,6 +9,10 @@ pub const CODEX_TOOL_CALL_ID_ENV_VAR: &str = "CODEX_TOOL_CALL_ID";
|
||||
pub const CODEX_EXEC_SERVER_NOISE_AUTH_TOKEN_ENV_VAR: &str = "CODEX_EXEC_SERVER_NOISE_AUTH_TOKEN";
|
||||
pub const OPENAI_FEDERATION_RULE_ID_ENV_VAR: &str = "OPENAI_FEDERATION_RULE_ID";
|
||||
pub const OPENAI_IDENTITY_TOKEN_FILE_ENV_VAR: &str = "OPENAI_IDENTITY_TOKEN_FILE";
|
||||
pub const OPENAI_IDENTITY_TOKEN_SOURCE_ENV_VAR: &str = "OPENAI_IDENTITY_TOKEN_SOURCE";
|
||||
pub const OPENAI_SPIFFE_AUDIENCE_ENV_VAR: &str = "OPENAI_SPIFFE_AUDIENCE";
|
||||
pub const OPENAI_SPIFFE_ID_ENV_VAR: &str = "OPENAI_SPIFFE_ID";
|
||||
pub const SPIFFE_ENDPOINT_SOCKET_ENV_VAR: &str = "SPIFFE_ENDPOINT_SOCKET";
|
||||
pub const OPENAI_WORKLOAD_IDENTITY_CONTEXT_ENV_VAR: &str = "OPENAI_WORKLOAD_IDENTITY_CONTEXT";
|
||||
|
||||
/// Environment variables that model-reachable child processes must not inherit.
|
||||
@@ -18,6 +22,9 @@ pub const NON_INHERITABLE_ENV_VARS: &[&str] = &[
|
||||
"CODEX_GUARDIAN_DECISIONS_API_KEY",
|
||||
OPENAI_FEDERATION_RULE_ID_ENV_VAR,
|
||||
OPENAI_IDENTITY_TOKEN_FILE_ENV_VAR,
|
||||
OPENAI_IDENTITY_TOKEN_SOURCE_ENV_VAR,
|
||||
OPENAI_SPIFFE_AUDIENCE_ENV_VAR,
|
||||
OPENAI_SPIFFE_ID_ENV_VAR,
|
||||
OPENAI_WORKLOAD_IDENTITY_CONTEXT_ENV_VAR,
|
||||
];
|
||||
|
||||
|
||||
@@ -62,6 +62,12 @@ fn non_inheritable_environment_is_removed_after_policy_overrides() {
|
||||
"synthetic-inherited-key".into(),
|
||||
),
|
||||
("node_repl_auth_token".into(), "inherited-token".into()),
|
||||
("OPENAI_IDENTITY_TOKEN_SOURCE".into(), "spiffe".into()),
|
||||
("openai_spiffe_audience".into(), "codex-test".into()),
|
||||
(
|
||||
"OpenAI_Spiffe_Id".into(),
|
||||
"spiffe://example.org/workload".into(),
|
||||
),
|
||||
(
|
||||
"openai_federation_rule_id".to_string(),
|
||||
"inherited-rule".to_string(),
|
||||
|
||||
Reference in New Issue
Block a user