Skip to content

fix: inject fallback profileArn for Builder-ID/OIDC accounts - #7

Open
marktantongco wants to merge 1 commit into
cybha22:mainfrom
marktantongco:fix/profile-arn-injection-for-builder-id
Open

fix: inject fallback profileArn for Builder-ID/OIDC accounts#7
marktantongco wants to merge 1 commit into
cybha22:mainfrom
marktantongco:fix/profile-arn-injection-for-builder-id

Conversation

@marktantongco

Copy link
Copy Markdown

Problem

Builder-ID/OIDC accounts fail with ValidationException: profileArn is required for this request when using Cybx-GateawayQue. The ListAvailableProfiles API returns AccessDeniedException because the OIDC token only has data-plane scopes (completions/analysis/conversations), not the control-plane scope needed for profile discovery.

Root Cause

ResolveProfileArn() in proxy/kiro_api.go calls ListAvailableProfiles which fails for Builder-ID tokens. When resolution fails, the code logs a warning but leaves profileArn empty. The downstream GenerateAssistantResponse request then fails because AWS requires the profileArn field in the data-plane request body.

Fix

When ResolveProfileArn fails, inject the kiro-cli hardcoded fallback ARN:
arn:aws:codewhisperer:{region}:638616132270:profile/AAAACCCCXXXX

This ARN is baked into the kiro binary's fig_api_client crate (profile_resolver.rs:70) and is accepted by the AWS CodeWhisperer control- and data-plane.

Changes

  • Backend/proxy/kiro_api.go: Added fallbackProfileArn() and isValidRegion() helpers
  • Backend/proxy/kiro.go: Inject fallback ARN after ResolveProfileArn fails (line ~488)

Verification

  • go build ./... — compiles successfully
  • Existing ResolveProfileArn tests pass
  • Verified equivalent fix works in the kiro-cli-pool-proxy project (chat returns responses with Credits tracking)

ListAvailableProfiles returns AccessDeniedException for OIDC tokens
that only have data-plane scopes (completions/analysis/conversations).
When profileArn resolution fails, inject the kiro-cli hardcoded fallback
ARN (baked into the binary at crates/fig_api_client/src/profile_resolver.rs)
so the data-plane GenerateAssistantResponse request succeeds.

This enables Builder-ID accounts to work without explicit profileArn.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant