Add AWS credential export commands for Amazon Bedrock (#44028)

## 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
This commit is contained in:
alexsong-oai authored and copyberry committed 2026-09-09 03:17:48 +00:00
1 parent 2ce38ae6d8
commit fe52d795c9
26 files changed
+1790 -89

No files matched your search

+37
View File
@@ -419,6 +419,35 @@
],
"type": "object"
},
"AwsCredentialExportConfig": {
"additionalProperties": false,
"description": "Command used to export AWS signing credentials for a model provider.",
"properties": {
"args": {
"default": [],
"description": "Arguments passed to the credential export command.",
"items": {
"type": "string"
},
"type": "array"
},
"command": {
"description": "Executable to invoke directly, without a shell.",
"type": "string"
},
"timeout_ms": {
"default": 30000,
"description": "Maximum time to wait for the credential export command to complete.",
"format": "uint64",
"minimum": 1.0,
"type": "integer"
}
},
"required": [
"command"
],
"type": "object"
},
"BrowserUseConfigToml": {
"additionalProperties": false,
"properties": {
@@ -2215,6 +2244,14 @@
],
"description": "Optional command used to reauthenticate after a refreshable AWS auth failure."
},
"credential_export": {
"allOf": [
{
"$ref": "#/definitions/AwsCredentialExportConfig"
}
],
"description": "Optional command whose exported credentials replace the AWS SDK credential chain."
},
"profile": {
"description": "AWS profile name to use. When unset, the AWS SDK default chain decides.",
"type": "string"