Skip to content

Commit ab770f1

Browse files
committed
Fixes Bedrock ARN validation
Updates the Bedrock ARN regex to allow alphanumeric characters, dots, hyphens, and colons in the resource ID. This prevents validation errors when using ARNs containing those characters.
1 parent e9980bc commit ab770f1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/api/providers/bedrock.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
515515
* match[4] - The resource ID (e.g., "anthropic.claude-3-sonnet-20240229-v1:0")
516516
*/
517517

518-
const arnRegex = /^arn:aws:bedrock:([^:]+):([^:]*):(?:([^\/]+)\/(.+)|([^\/]+))$/
518+
const arnRegex = /^arn:aws:bedrock:([^:]+):([^:]*):(?:([^\/]+)\/([\w\.\-:]+)|([^\/]+))$/
519519
let match = arn.match(arnRegex)
520520

521521
if (match && match[1] && match[3] && match[4]) {

webview-ui/src/utils/validate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export function validateApiConfiguration(apiConfiguration?: ApiConfiguration): s
8989
*/
9090
export function validateBedrockArn(arn: string, region?: string) {
9191
// Validate ARN format
92-
const arnRegex = /^arn:aws:bedrock:([^:]+):(\d+):(foundation-model|provisioned-model|default-prompt-router)\/(.+)$/
92+
const arnRegex = /^arn:aws:bedrock:([^:]+):([^:]*):(?:([^/]+)\/([\w.\-:]+)|([^/]+))$/
9393
const match = arn.match(arnRegex)
9494

9595
if (!match) {

0 commit comments

Comments
 (0)