Repository navigation
Sign Claude on Bedrock with an AWS profile or the current AWS login - #202
Open
Itay Kalfon (Itaykal) wants to merge 1 commit into
Open
Itay Kalfon (Itaykal) wants to merge 1 commit into
Itay Kalfon (Itaykal) wants to merge 1 commit into
Conversation
A new bedrock-aws service (auth "aws") signs requests with SigV4 through the Anthropic SDK's Bedrock client instead of a Bedrock API key. Credentials come from boto3 (new optional extra freehand-ai[bedrock]): the named aws_profile, or the AWS CLI's default chain (AWS_PROFILE, SSO, env vars) when none is set. A 403 re-reads the sign-in once, so a renewed `aws sso login` is picked up. Available from `freehand login bedrock-aws [--region R] [--aws-profile NAME]`, the terminal /login menu, and the web Settings page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Itay Kalfon (Itaykal)
requested a review
from Zezi Zeng (ClarenceStark)
as a code owner
December 6, 2026 11:59
|
Thanks for the pull request! A few friendly reminders based on the files changed:
(This comment updates automatically when you edit the PR description or push new commits.) |
Author
@microsoft-github-policy-service agree |
This branch has not been deployed
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.
Linked issue
No prior issue. Some orgs don't issue Bedrock API keys and only allow access through AWS IAM / SSO, so today Freehand can't reach Claude on Bedrock for them.
What changed (Before / After)
AWS_BEARER_TOKEN_BEDROCK).bedrock-awsservice signs Claude-on-Bedrock requests with the person's AWS sign-in, either a named profile or whatever the AWS CLI uses now (AWS_PROFILE,aws sso login, env vars, assume-role,credential_process). Freehand saves no secret.This follows the existing Vertex pattern (
auth: "google"):freehand login bedrock-aws [--region R] [--aws-profile NAME], the terminal/loginmenu, and the web Settings page (tile, region, profile field, "AWS sign-in" in Advanced). Only Claude (the Anthropic Messages route) is covered;bedrock-openaistays key-only.Visual proof (UI / TUI / Web / Desktop / export changes)
Web: the "Amazon Bedrock (AWS sign-in)" tile ("AWS profile or current login, no key") asks for the region and profile, and shows no key field. A browser e2e test covers this (below).
How you verified it
tests/test_bedrock_aws.py(new) runs the real SDK signing path against a fake Bedrock that streams AWS event-stream frames (FakeAnthropic(bedrock=True)):AWS4-HMAC-SHA256 Credential=<profile's key>/…/bedrock/aws4_request, with nox-api-key, even whenAWS_BEARER_TOKEN_BEDROCKis setNeedLoginthat says to runaws sso login --profile …auth: "aws"anywhere but Claude on abedrock-runtimehosttests/test_web_e2e.py::test_web_e2e_bedrock_is_added_with_an_aws_profile_and_no_key(real browser)tests/conftest.pynow hides the machine's~/.awsand AWS variables from every test, so a developer's own AWS login can't change resultsglobal.anthropic.claude-opus-5-5on Bedrock.Merge danger
Door: two-way. A new opt-in service and auth mode. Existing
bedrock/bedrock-openaiconnections and every other provider are unchanged.Blast radius: small. Shared code touched:
connections.identity()gainsaws_profile(so two profiles are two connections),USER_SETTINGS/PROVIDER_SETTINGSgainaws_profile, and boto3 is added to thedevextra so CI runs the real SigV4 path.src/freehand/runtime/stays stdlib-only: boto3 is imported lazily, only whenauthisaws.AI disclosure & checklist
uv run pyflakes src tests .github/scriptsprints nothing and relevant tests pass locally (full suite runs in CI)CHANGELOG.mduntouched (maintainers update it at release time)src/freehand/runtime/still uses only the standard library and imports on Python 3.9🤖 Generated with Claude Code