feat(providers): server-side credential hiding for Azure and Bedrock#3884
Conversation
Remove hard requirement for explicit AWS credentials in Bedrock provider. When access key and secret key are not provided, the AWS SDK automatically falls back to its default credential chain (env vars, instance profile, ECS task role, EKS IRSA, SSO). Closes #3694 Signed-off-by: majiayu000 <1835304752@qq.com>
Reject configurations where only one of bedrockAccessKeyId or bedrockSecretKey is provided, preventing silent fallback to the default credential chain with a potentially different identity. Add tests covering all credential configuration scenarios. Signed-off-by: majiayu000 <1835304752@qq.com>
Remove unused config parameter and dead _lastConfig assignment from mock factory. Break long mockReturnValue chain to satisfy biome line-length rule. Signed-off-by: majiayu000 <1835304752@qq.com>
Use BedrockRuntimeClientConfig from SDK instead of inline type. Add default return value for prepareToolsWithUsageControl mock. Signed-off-by: majiayu000 <1835304752@qq.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview Refactors the Agent block to use shared Updates provider execution and key plumbing: Bedrock now supports AWS default credential chain (with validation that access key + secret must be provided together) and adds tests; Azure OpenAI/Anthropic providers and the BYOK key resolver now allow API keys/endpoints to come from server env ( Written by Cursor Bugbot for commit 2ee6cba. Configure here. |
…ginal placeholders
Greptile SummaryThis PR adds server-side credential hiding for Azure OpenAI, Azure Anthropic, and AWS Bedrock deployments, letting operators pre-configure credentials via env vars so users only need to pick a model. Key changes:
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Agent Block - model selected] --> B{Provider type?}
B -->|Ollama / vLLM| C[Return empty / vLLM key]
B -->|Fireworks| D[Check BYOK DB → env var → throw]
B -->|bedrock / bedrock/*| E[Return PROVIDER_PLACEHOLDER_KEY]
B -->|azure-openai| F{userProvidedKey set?}
B -->|azure-anthropic| G{userProvidedKey set?}
B -->|openai / anthropic / google / mistral| H{isHosted + workspace?}
E --> E1[BedrockProvider: credentials in request?]
E1 -->|both present| E2[Use explicit key pair]
E1 -->|neither present| E3[Fall back to AWS default chain]
E1 -->|only one present| E4[Throw: must provide both or neither]
F -->|yes| F1[Use user key]
F -->|no| F2[env.AZURE_OPENAI_API_KEY or empty string]
F2 --> F3[AzureOpenAIProvider: throw if empty]
G -->|yes| G1[Use user key]
G -->|no| G2[env.AZURE_ANTHROPIC_API_KEY or empty string]
G2 --> G3[AzureAnthropicProvider: throw if empty]
H -->|yes| I[Check BYOK DB]
I -->|found| J[Use BYOK key]
I -->|not found| K[Use rotating hosted key]
H -->|no| L[Use userProvidedKey or throw]
subgraph UI Visibility
M[NEXT_PUBLIC_BEDROCK_DEFAULT_CREDENTIALS=true] --> N[Hide bedrockAccessKeyId + bedrockSecretKey]
O[NEXT_PUBLIC_AZURE_CONFIGURED=true] --> P[Hide azureEndpoint + azureApiVersion + apiKey for Azure models]
end
Reviews (6): Last reviewed commit: "fix(blocks): add canonicalParamId to ver..." | Re-trigger Greptile |
… Azure and Bedrock
|
Fixed in 5232efc. Added |
|
@greptile |
|
@cursor review |
…ng credential subblocks
|
@greptile |
|
@cursor review |
…asic/advanced mode
|
@greptile |
|
@cursor review |
…dential subblocks
|
@greptile |
|
@cursor review |
…ed workflow state
…to complete the swap pair
|
@greptile |
|
@cursor review |
…3884) * fix: allow Bedrock provider to use AWS SDK default credential chain Remove hard requirement for explicit AWS credentials in Bedrock provider. When access key and secret key are not provided, the AWS SDK automatically falls back to its default credential chain (env vars, instance profile, ECS task role, EKS IRSA, SSO). Closes #3694 Signed-off-by: majiayu000 <1835304752@qq.com> * fix: add partial credential guard for Bedrock provider Reject configurations where only one of bedrockAccessKeyId or bedrockSecretKey is provided, preventing silent fallback to the default credential chain with a potentially different identity. Add tests covering all credential configuration scenarios. Signed-off-by: majiayu000 <1835304752@qq.com> * fix: clean up bedrock test lint and dead code Remove unused config parameter and dead _lastConfig assignment from mock factory. Break long mockReturnValue chain to satisfy biome line-length rule. Signed-off-by: majiayu000 <1835304752@qq.com> * fix: address greptile review feedback on PR #3708 Use BedrockRuntimeClientConfig from SDK instead of inline type. Add default return value for prepareToolsWithUsageControl mock. Signed-off-by: majiayu000 <1835304752@qq.com> * feat(providers): server-side credential hiding for Azure and Bedrock * fix(providers): revert Bedrock credential fields to required with original placeholders * fix(blocks): add hideWhenEnvSet to getProviderCredentialSubBlocks for Azure and Bedrock * fix(agent): use getProviderCredentialSubBlocks() instead of duplicating credential subblocks * fix(blocks): consolidate Vertex credential into shared factory with basic/advanced mode * fix(types): resolve pre-existing TypeScript errors across auth, secrets, and copilot * lint * improvement(blocks): make Vertex AI project ID a password field * fix(blocks): preserve vertexCredential subblock ID for backwards compatibility * fix(blocks): follow canonicalParamId pattern correctly for vertex credential subblocks * fix(blocks): keep vertexCredential subblock ID stable to preserve saved workflow state * fix(blocks): add canonicalParamId to vertexCredential basic subblock to complete the swap pair * fix types * more types --------- Signed-off-by: majiayu000 <1835304752@qq.com> Co-authored-by: majiayu000 <1835304752@qq.com> Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>
Summary
NEXT_PUBLIC_BEDROCK_DEFAULT_CREDENTIALSflag — when set, hides the AWS access key/secret fields in the Agent block UI and lets the deployment use the default AWS credential chain (IAM roles, IRSA, ECS task roles, etc.)NEXT_PUBLIC_AZURE_CONFIGUREDflag — when set, hides the Azure endpoint, API version, and API key fields so users just pick a model and run; credentials are resolved from server-side env vars (AZURE_OPENAI_*/AZURE_ANTHROPIC_*)isSubBlockHiddenByHostedKey+isSubBlockHiddenByEnvVarinto singleisSubBlockHidden()— also fixes two call sites (workflow-block.tsx,copilot/vfs/serializers.ts) that were missing the env var checkrequiresFeature→showWhenEnvSetonSubBlockConfigfor symmetry withhideWhenEnvSet'bedrock-uses-own-credentials'magic string with exportedPROVIDER_PLACEHOLDER_KEYconstantVERTEX_MODELS,BEDROCK_MODELS,AZURE_MODELSas single source of truth inblocks/utils.tsvalues.yaml,values-azure.yaml,values-aws.yaml) and.env.examplewith all new env varsType of Change
Testing
Tested manually
Checklist