Repository navigation
feat: support Amazon Bedrock through the AWS SDK credential chain - #123
kabigon-1015 wants to merge 1 commit into
Conversation
Add a provider input ('openai' | 'amazon-bedrock') to run Codex against
OpenAI models on Amazon Bedrock without the Responses API proxy.
- Authentication is delegated entirely to the AWS SDK credential chain
(e.g. short-lived OIDC credentials from
aws-actions/configure-aws-credentials), so no key input or credential
forwarding is added.
- Skip proxy installation and the 'Read server info' step when the
provider is 'amazon-bedrock'; without this, a keyless run with a
prompt fails after polling for a server info file that no proxy ever
writes.
- Keep the drop-sudo hardening and user-namespace setup active for the
Bedrock path.
- Fail fast on conflicting inputs (openai-api-key with amazon-bedrock)
and on a missing AWS region.
- Document the OIDC setup in the README and the credential-exposure
trade-off in docs/security.md.
Co-Authored-By: Claude Fable 5 <[email protected]>
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
Thanks for this — we'd use it as soon as it lands. We run Codex as a PR reviewer on Amazon Bedrock with OIDC-only credentials, and today we drive the Codex CLI ourselves because the action can't run without an OpenAI key. The 1. Support the
Our role grants 2. Allow 3. Keep the AWS credentials out of the model's shell commands. Happy to test a branch end to end against |
Summary
Adds a
providerinput (openai(default) |amazon-bedrock) so Codex can run against OpenAI models on Amazon Bedrock, authenticating through the AWS SDK credential chain — e.g. short-lived OIDC credentials fromaws-actions/configure-aws-credentials— with no long-lived keys stored in the repository.Addresses #107.
Design notes
AWS_BEARER_TOKEN_BEDROCK), andrunCodexExecspawnscodexwith the inherited environment. The action only selects the provider (--config model_provider="amazon-bedrock") and validates inputs. This keeps the action-side surface minimal and supports every auth method the CLI supports, including enterprise setups where long-lived keys are prohibited.Read server infois skipped for Bedrock. Its current condition (openai-api-key != '' || prompt != '') makes any keyless run with a prompt poll for a server-info file that no proxy ever writes, then fail. This gating fix is required for any proxy-less provider to work.drop-sudo, its verification, and the user-namespace setup for the sandbox now also run for the Bedrock path.openai-api-keycombined withprovider: amazon-bedrockis rejected (the proxy and the credential chain are mutually exclusive by design), as is a missingAWS_REGION/AWS_DEFAULT_REGION.codex-argsstill wins. The provider config is pushed beforeextraArgs, so callers can layer provider settings such asmodel_providers.amazon-bedrock.aws.profile.Relationship to #111
#111 pioneered the
providerinput (thank you @Suto-Michimasa!). This PR takes a different approach to authentication — delegating entirely to the AWS SDK credential chain instead of validating/forwarding specific credential env vars — and additionally fixes theRead server infogating that otherwise fails a keyless run. Happy to converge the two PRs in whichever direction the maintainers prefer.Known limitations (documented)
safety-strategy: unprivileged-useris not supported with Bedrock:sudoresets the environment, so chain-resolved credentials do not reach the Codex process. The README directs users todrop-sudo/read-only.docs/security.mdnow recommends short-lived OIDC credentials scoped to Bedrock inference only.Verification
pnpm run check/pnpm run build/pnpm test(4 new unit tests covering the provider flag, default behavior,codex-argsordering, and invalid-provider rejection)End-to-end run on GitHub Actions (
ubuntu-latest), pinned to this branch's head SHA: OIDC →aws-actions/configure-aws-credentials(no long-lived keys, noAWS_BEARER_TOKEN_BEDROCK) →provider: amazon-bedrock/model: openai.gpt-5.6-luna/sandbox: read-only. The job succeeded end to end; sanitized log excerpt:This confirms the credential chain path works with OIDC-issued temporary credentials only, the proxy steps are cleanly skipped, and the
drop-sudohardening still runs for the Bedrock path.🤖 Generated with Claude Code