Skip to content

Conversation

@andreswebs
Copy link
Contributor

@andreswebs andreswebs commented Jan 27, 2026

Summary

Add support for bearer token authentication in the AWS Bedrock provider via the AWS_BEARER_TOKEN_BEDROCK environment variable.

This change allows users to authenticate with Amazon Bedrock using a bearer token as an alternative to standard AWS credentials (IAM/SSO). When AWS_BEARER_TOKEN_BEDROCK is set, the provider uses bearer token authentication; otherwise, it falls back to the existing credential-based authentication flow.

Changes:

  • Add AWS_BEARER_TOKEN_BEDROCK as a new optional secret config key
  • Refactor client creation into create_client_with_credentials helper method
  • Make AWS_PROFILE optional (since bearer token auth doesn't require it)
  • Make AWS_REGION required at runtime when AWS_BEARER_TOKEN_BEDROCK is used
  • Update provider metadata description to document the new authentication option

Type of Change

  • Feature
  • Bug fix
  • Refactor / Code quality
  • Performance improvement
  • Documentation
  • Tests
  • Security fix
  • Build / Release
  • Other (specify below)

AI Assistance

  • This PR was created or reviewed with AI assistance

Testing

  • Added unit tests for metadata configuration:
    • Config keys count validation
    • Bearer token config key presence
    • Bearer token marked as secret and optional
    • AWS_PROFILE marked as optional
    • Provider description mentions bearer token auth
    • Added integration test test_bedrock_provider_bearer_token that validates authentication flow with bearer token (requires - AWS_BEARER_TOKEN_BEDROCK and AWS_REGION env vars)

Related Issues

Relates to #6577

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds bearer token authentication support for the Amazon Bedrock provider via AWS_BEARER_TOKEN_BEDROCK, with a fallback to the existing AWS credentials flow when the token is not set.

Changes:

  • Add bearer-token-based Bedrock client construction and runtime region validation when a bearer token is used.
  • Update Bedrock provider metadata/config keys to include AWS_BEARER_TOKEN_BEDROCK (secret) and make AWS_PROFILE/AWS_REGION optional in metadata.
  • Update provider integration tests to improve env handling and add a bearer-token Bedrock test case.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
crates/goose/src/providers/bedrock.rs Implements bearer token auth path, conditional region validation, updates provider metadata, and adds metadata-focused unit tests.
crates/goose/tests/providers.rs Refines env handling in the shared provider test helper and adds an integration test for bearer-token Bedrock auth.

@michaelneale
Copy link
Collaborator

thanks @andreswebs - just wanted to confirm as a little hard to look at just diffs, but this will be fine for non bearer token cases as before - and the new stuff only kick in when there is a bearer token variable configured? is that right?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Copy link
Collaborator

@michaelneale michaelneale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - the one copilot comment on potentially filtering out AWS_BEARER_TOKEN_BEDROCK is a nice to have I think @andreswebs if you wanted to include that and test it, but otherwise LGTM

@andreswebs
Copy link
Contributor Author

Awesome, thanks @michaelneale
I'll include that and re-test in a bit

@michaelneale
Copy link
Collaborator

thanks for seeing this through @andreswebs and appreciate all the permutation testing and patience!

@michaelneale michaelneale merged commit 5290f61 into block:main Jan 29, 2026
18 checks passed
zanesq added a commit that referenced this pull request Jan 29, 2026
* 'main' of github.com:block/goose: (62 commits)
  Swap canonical model from openrouter to models.dev (#6625)
  Hook thinking status (#6815)
  Fetch new skills hourly (#6814)
  copilot instructions: Update "No prerelease docs" instruction (#6795)
  refactor: centralize audience filtering before providers receive messages (#6728)
  update doc to remind contributors to activate hermit and document minimal npm and node version (#6727)
  nit: don't spit out compaction when in term mode as it fills up the screen (#6799)
  fix: correct tool support detection in Tetrate provider model fetching (#6808)
  Session manager fixes (#6809)
  fix(desktop): handle quoted paths with spaces in extension commands (#6430)
  fix: we can default gooseignore without writing it out (#6802)
  fix broken link (#6810)
  docs: add Beads MCP extension tutorial (#6792)
  feat(goose): add support for AWS_BEARER_TOKEN_BEDROCK environment variable (#6739)
  [docs] Add OSS Skills Marketplace (#6752)
  feat: make skills available in codemode (#6763)
  Fix: Recipe Extensions Not Loading in Desktop (#6777)
  Different approach to determining final confidence level of prompt injection evaluation outcomes (#6729)
  fix: read_resource_tool deadlock causing test_compaction to hang (#6737)
  Upgrade error handling (#6747)
  ...
zanesq added a commit that referenced this pull request Jan 29, 2026
…sion-session

* 'main' of github.com:block/goose: (78 commits)
  copilot instructions: Update "No prerelease docs" instruction (#6795)
  refactor: centralize audience filtering before providers receive messages (#6728)
  update doc to remind contributors to activate hermit and document minimal npm and node version (#6727)
  nit: don't spit out compaction when in term mode as it fills up the screen (#6799)
  fix: correct tool support detection in Tetrate provider model fetching (#6808)
  Session manager fixes (#6809)
  fix(desktop): handle quoted paths with spaces in extension commands (#6430)
  fix: we can default gooseignore without writing it out (#6802)
  fix broken link (#6810)
  docs: add Beads MCP extension tutorial (#6792)
  feat(goose): add support for AWS_BEARER_TOKEN_BEDROCK environment variable (#6739)
  [docs] Add OSS Skills Marketplace (#6752)
  feat: make skills available in codemode (#6763)
  Fix: Recipe Extensions Not Loading in Desktop (#6777)
  Different approach to determining final confidence level of prompt injection evaluation outcomes (#6729)
  fix: read_resource_tool deadlock causing test_compaction to hang (#6737)
  Upgrade error handling (#6747)
  Fix/filter audience 6703 local (#6773)
  chore: re-sync package-lock.json (#6783)
  upgrade electron to 39.3.0 (#6779)
  ...
lifeizhou-ap added a commit that referenced this pull request Jan 29, 2026
* main:
  docs: usage data collection (#6822)
  feat: platform extension migrator + code mode rename (#6611)
  feat: CLI flag to skip loading profile extensions (#6780)
  Swap canonical model from openrouter to models.dev (#6625)
  Hook thinking status (#6815)
  Fetch new skills hourly (#6814)
  copilot instructions: Update "No prerelease docs" instruction (#6795)
  refactor: centralize audience filtering before providers receive messages (#6728)
  update doc to remind contributors to activate hermit and document minimal npm and node version (#6727)
  nit: don't spit out compaction when in term mode as it fills up the screen (#6799)
  fix: correct tool support detection in Tetrate provider model fetching (#6808)
  Session manager fixes (#6809)
  fix(desktop): handle quoted paths with spaces in extension commands (#6430)
  fix: we can default gooseignore without writing it out (#6802)
  fix broken link (#6810)
  docs: add Beads MCP extension tutorial (#6792)
  feat(goose): add support for AWS_BEARER_TOKEN_BEDROCK environment variable (#6739)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants