mirror of
https://github.com/openai/codex.git
synced 2026-11-07 20:30:33 +00:00
## What changed Support `model_providers.amazon-bedrock.aws.credential_export` with `command`, `args`, and `timeout_ms` to supply SigV4 signing credentials from a command's JSON output. Accept both flat credential-process output and nested STS `Credentials` objects. Cache credentials in memory, refresh before expiration, and share exports across sessions with matching AWS configuration. On recoverable authentication failures, run the optional `aws.auth_refresh` command before exporting fresh credentials, coalescing concurrent recovery attempts. Bound command execution time and output size, and keep credential values out of errors. Reject combining `aws.credential_export` with `aws.profile`. Bedrock setup and login reject changes while an exporter is configured, preserving configuration and saved credentials. ## Testing Add coverage for output formats, expiration, credential precedence, caching, concurrent recovery, command failures, and secret redaction. Integration tests verify request signing with rotated credentials, bounded recovery attempts, and setup/login rejection across configuration layers. GitOrigin-RevId: 4ef799f88ab5e3b2578f8f41a5e56e4f30e2cd81
32 lines
865 B
Rust
32 lines
865 B
Rust
use codex_aws_auth::AwsAuthConfig;
|
|
use codex_model_provider_info::ModelProviderAwsAuthInfo;
|
|
use pretty_assertions::assert_eq;
|
|
|
|
use super::aws_auth_config;
|
|
use super::base_url;
|
|
|
|
#[test]
|
|
fn base_url_uses_regional_runtime_endpoint() {
|
|
assert_eq!(
|
|
base_url("us-west-2"),
|
|
"https://bedrock-runtime.us-west-2.amazonaws.com/openai/v1"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn aws_auth_config_uses_bedrock_service() {
|
|
assert_eq!(
|
|
aws_auth_config(&ModelProviderAwsAuthInfo {
|
|
profile: Some("runtime-profile".to_string()),
|
|
region: Some(" eu-west-1 ".to_string()),
|
|
credential_export: None,
|
|
auth_refresh: None,
|
|
}),
|
|
AwsAuthConfig {
|
|
profile: Some("runtime-profile".to_string()),
|
|
region: Some("eu-west-1".to_string()),
|
|
service: "bedrock".to_string(),
|
|
}
|
|
);
|
|
}
|