feat: support Amazon Bedrock through the AWS SDK credential chain - #123
Open
kabigon-1015 wants to merge 1 commit into
Open
feat: support Amazon Bedrock through the AWS SDK credential chain#123kabigon-1015 wants to merge 1 commit into
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 <noreply@anthropic.com>
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
kabigon-1015
marked this pull request as ready for review
July 28, 2026 04:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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