Skip to content

fix(llm): align Bedrock GatewayProvider config keys with DB schema - #3732

Merged
crivetimihai merged 3 commits into
IBM:mainfrom
kimsehwan96:fix/bedrock-gateway-provider-config-keys
Mar 21, 2026
Merged

crivetimihai merged 3 commits into
IBM:mainfrom
kimsehwan96:fix/bedrock-gateway-provider-config-keys

Conversation

@kimsehwan96

@kimsehwan96 kimsehwan96 commented Mar 19, 2026 •

Copy link
Copy Markdown
Contributor

🔗 Related Issue

Close: #3761


📝 Summary

GatewayProvider.get_llm() reads Bedrock credentials using boto3-style key names (aws_access_key_id, aws_secret_access_key, region_name), but the Admin UI stores them via llm_provider_configs.AWSBedrockConfig which uses shorter key names (access_key_id, secret_access_key, region).

This mismatch causes config.get("aws_access_key_id") to always return None, silently falling back to the node IAM role instead of using the user-configured credentials.


🏷️ Type of Change

  • Bug fix
  • Feature / Enhancement
  • Documentation
  • Refactor
  • Chore (deps, CI, tooling)
  • Other (describe below)

🧪 Verification

Check Command Status
Lint suite make lint pass
Unit tests make test pass
Coverage ≥ 80% make coverage pass

✅ Checklist

  • Code formatted (make black isort pre-commit)
  • Tests added/updated for changes
  • Documentation updated (if applicable)
  • No secrets or credentials committed

📓 Notes (optional)

@crivetimihai crivetimihai added bug Something isn't working MUST P1: Non-negotiable, critical requirements without which the product is non-functional or unsafe security Improves security api REST API Related item labels Mar 20, 2026
@crivetimihai crivetimihai added this to the Release 1.0.0 milestone Mar 20, 2026
@crivetimihai

Copy link
Copy Markdown
Member

Thanks @kimsehwan96. Good catch — the key mismatch between AWSBedrockConfig and get_llm() means user-configured Bedrock credentials are silently ignored. This is both a correctness and security issue (requests use the node IAM role instead of the intended credentials). Fix is clean and correct. One suggestion: no linked issue — please file one for traceability. No tests added — a unit test mocking config.get() to verify the correct boto3 kwargs would be valuable.

kimsehwan96 and others added 3 commits March 21, 2026 19:48
The GatewayProvider bedrock branch reads aws_access_key_id,
aws_secret_access_key, and region_name from the provider config,
but llm_provider_configs.AWSBedrockConfig stores them as
access_key_id, secret_access_key, and region. This mismatch
causes credentials to silently fall back to the node IAM role.

Signed-off-by: kimsehwan96 <[email protected]>
Update existing tests to use DB schema key names (region,
access_key_id, secret_access_key, session_token) instead of boto3-style
names. Add assertions verifying credentials are correctly mapped to
boto3 kwargs, and add tests for no-credentials and default-region
edge cases.

Signed-off-by: Mihai Criveti <[email protected]>
The DB schema exposes profile_name via the Admin UI but
GatewayProvider never mapped it to the langchain-aws
credentials_profile_name kwarg, causing the same silent
IAM-fallback bug this PR fixes for access key credentials.

Signed-off-by: Mihai Criveti <[email protected]>
@crivetimihai

Copy link
Copy Markdown
Member

Review

The core fix is correct — GatewayProvider.get_llm() was reading boto3-style keys (aws_access_key_id, aws_secret_access_key, region_name) from the config dict, but the Admin UI stores them via llm_provider_configs.AWSBedrockConfig using shorter DB schema keys (access_key_id, secret_access_key, region). This mismatch caused credentials to silently fall back to the node IAM role.

Changes made during review

Test fixes (commit 2):

  • Updated 3 existing tests to use the correct DB schema key names (they were still using the old boto3-style keys and passing only because DummyLLM doesn't validate kwargs)
  • Added credential-forwarding assertions to test_gateway_provider_bedrock_completion
  • Added 3 new tests: credential forwarding (chat path), no-credentials IAM fallback, default region

profile_name fix (commit 3):

  • llm_provider_configs.AWSBedrockConfig exposes profile_name in the UI/DB schema, and langchain-aws supports it via credentials_profile_name, but GatewayProvider never mapped it — the same silent IAM-fallback bug. Added the mapping and a regression test.

Verified

  • Rebased cleanly onto main
  • All 163 tests pass (1 skipped)
  • langchain-aws ChatBedrock and BedrockLLM both accept credentials_profile_name
  • No security, performance, or consistency concerns

crivetimihai
crivetimihai previously approved these changes Mar 21, 2026

@crivetimihai crivetimihai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM — fix is correct, profile_name gap addressed, tests cover all credential mapping paths.

@crivetimihai
crivetimihai force-pushed the fix/bedrock-gateway-provider-config-keys branch from 8e5b729 to fb0ae7a Compare March 21, 2026 20:14
@crivetimihai
crivetimihai merged commit 2d5b7cd into IBM:main Mar 21, 2026
1 check failed
msureshkumar88 pushed a commit that referenced this pull request May 13, 2026
…3732)

* fix(llm): align Bedrock GatewayProvider config keys with DB schema

The GatewayProvider bedrock branch reads aws_access_key_id,
aws_secret_access_key, and region_name from the provider config,
but llm_provider_configs.AWSBedrockConfig stores them as
access_key_id, secret_access_key, and region. This mismatch
causes credentials to silently fall back to the node IAM role.

Signed-off-by: kimsehwan96 <[email protected]>

* test(llm): align Bedrock GatewayProvider tests with DB schema keys

Update existing tests to use DB schema key names (region,
access_key_id, secret_access_key, session_token) instead of boto3-style
names. Add assertions verifying credentials are correctly mapped to
boto3 kwargs, and add tests for no-credentials and default-region
edge cases.

Signed-off-by: Mihai Criveti <[email protected]>

* fix(llm): forward Bedrock profile_name to credentials_profile_name

The DB schema exposes profile_name via the Admin UI but
GatewayProvider never mapped it to the langchain-aws
credentials_profile_name kwarg, causing the same silent
IAM-fallback bug this PR fixes for access key credentials.

Signed-off-by: Mihai Criveti <[email protected]>

---------

Signed-off-by: kimsehwan96 <[email protected]>
Signed-off-by: Mihai Criveti <[email protected]>
Co-authored-by: Mihai Criveti <[email protected]>
kamath-a pushed a commit to kamath-a/mcp-context-forge that referenced this pull request Jun 26, 2026
…BM#3732)

* fix(llm): align Bedrock GatewayProvider config keys with DB schema

The GatewayProvider bedrock branch reads aws_access_key_id,
aws_secret_access_key, and region_name from the provider config,
but llm_provider_configs.AWSBedrockConfig stores them as
access_key_id, secret_access_key, and region. This mismatch
causes credentials to silently fall back to the node IAM role.

Signed-off-by: kimsehwan96 <[email protected]>

* test(llm): align Bedrock GatewayProvider tests with DB schema keys

Update existing tests to use DB schema key names (region,
access_key_id, secret_access_key, session_token) instead of boto3-style
names. Add assertions verifying credentials are correctly mapped to
boto3 kwargs, and add tests for no-credentials and default-region
edge cases.

Signed-off-by: Mihai Criveti <[email protected]>

* fix(llm): forward Bedrock profile_name to credentials_profile_name

The DB schema exposes profile_name via the Admin UI but
GatewayProvider never mapped it to the langchain-aws
credentials_profile_name kwarg, causing the same silent
IAM-fallback bug this PR fixes for access key credentials.

Signed-off-by: Mihai Criveti <[email protected]>

---------

Signed-off-by: kimsehwan96 <[email protected]>
Signed-off-by: Mihai Criveti <[email protected]>
Co-authored-by: Mihai Criveti <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api REST API Related item bug Something isn't working MUST P1: Non-negotiable, critical requirements without which the product is non-functional or unsafe security Improves security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Bedrock provider credentials silently ignored due to config key mismatch.

2 participants