Skip to content

Add AWS STS AssumeRole configuration UI for AWS Bedrock endpoints - #1397

Open
e19166 wants to merge 4 commits into
wso2:mainfrom
e19166:main
Open

Add AWS STS AssumeRole configuration UI for AWS Bedrock endpoints#1397
e19166 wants to merge 4 commits into
wso2:mainfrom
e19166:main

Conversation

@e19166

@e19166 e19166 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Related issue: wso2/api-manager#5154

Purpose

Extends the AWS Bedrock (AWS SigV4) AI endpoint configuration in the Publisher with two
additional ways to authenticate to AWS, on top of the existing static access/secret keys:

  1. STS AssumeRole — sign requests using temporary credentials obtained by assuming an
    IAM role.
  2. Environment credentials — resolve credentials from the gateway's runtime
    (EC2 instance profile / EKS IRSA) instead of storing any keys.

Both are the UI counterpart of the gateway/backend support (see related PRs).

What changed

AddEditAIEndpoint.jsx (AWS SigV4 auth section):

1. STS AssumeRole

  • New "Enable STS AssumeRole" checkbox that reveals Role ARN, Role Region, and
    External ID fields.
  • roleArn / roleRegion are required when the toggle is on; the role config is persisted
    and hydrated on edit.
  • Secret handling hardened: toggling AssumeRole off without re-entering the secret no longer
    overwrites the stored secret with the masked ******** placeholder.

2. Environment credentials

  • New "Use environment credentials (EC2 instance profile / EKS IRSA)" checkbox, backed by
    an authType field (stored | environment).
  • In environment mode the Access Key / Secret Key fields are hidden and their
    validation is skipped (no keys are needed).
  • authType is included in the saved endpoint-security payload and hydrated on edit.
  • Assume Role can be layered on top of environment mode.

Region and Service remain required in all modes.

site/public/locales/en.json

  • Added labels for the AssumeRole fields and the useEnvironmentCredentials option.

Behaviour

Credential source Access/Secret keys Assume Role
Stored keys (existing default) shown & required optional
Environment credentials (new) hidden & not required optional

Backward compatible: when authType is absent and no role is configured (existing
endpoints), the UI behaves exactly as before (stored keys, no role).

Related PRs (feature spans three repos)

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b4e8fa0f-c109-48a9-9d69-a4486aaab2b7

📥 Commits

Reviewing files that changed from the base of the PR and between 0cc7eee and 4df49e5.

📒 Files selected for processing (1)
  • portals/publisher/src/main/webapp/site/public/locales/en.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • portals/publisher/src/main/webapp/site/public/locales/en.json

📝 Walkthrough

Walkthrough

Adds stored and environment AWS credentials, optional STS AssumeRole fields, conditional validation, shared persistence, SigV4 reachability handling, localized labels, and Cypress coverage for Bedrock endpoints.

Changes

AWS AI endpoint authentication

Layer / File(s) Summary
Security state and reachability
portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/AIEndpoints/AddEditAIEndpoint.jsx
The editor hydrates AWS security state, protects masked secrets, and treats AWS SigV4 HTTP 403 responses as reachable.
Validation and security persistence
portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/AIEndpoints/AddEditAIEndpoint.jsx
Validation and persistence support environment credentials and conditional STS AssumeRole fields.
Credential controls and localized labels
portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/AIEndpoints/AddEditAIEndpoint.jsx, portals/publisher/src/main/webapp/site/public/locales/en.json, portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/AWSLambda/Credentials.jsx
The UI renders credential-source radios and collapsible AssumeRole fields. English labels, validation messages, confirmation text, and IAM-role guidance are updated.
Bedrock authentication coverage
tests/cypress/e2e/publisher/023-ai-api-create/01-aws-bedrock-endpoint-auth.cy.js
Cypress coverage verifies stored credentials, environment credentials, AssumeRole visibility, and combined authentication settings.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AddEditAIEndpoint
  participant EndpointSecurityState
  participant AWS_SigV4_Endpoint
  AddEditAIEndpoint->>EndpointSecurityState: Hydrate AWS credentials and AssumeRole settings
  EndpointSecurityState-->>AddEditAIEndpoint: Return masked security values
  AddEditAIEndpoint->>AWS_SigV4_Endpoint: Test endpoint
  AWS_SigV4_Endpoint-->>AddEditAIEndpoint: Return reachability status
Loading

Suggested reviewers: tharikagithub, heshansudarshana, krishanx92

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding AWS STS AssumeRole configuration for AWS Bedrock endpoints.
Description check ✅ Passed The description directly explains the STS AssumeRole, environment credentials, validation, persistence, and compatibility changes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/AIEndpoints/AddEditAIEndpoint.jsx`:
- Around line 303-331: Reset all endpoint security state to its default values
at the start of hydrateEndpointSecurityState before applying values from
securityConfig, including assumeRole, authType, roleArn, roleRegion,
roleExternalId, accessKey, secretKey, and region. Ensure both dispatched-config
and fetched-endpoint load paths use this reset-and-override behavior so missing
fields cannot retain values from the previously edited endpoint.
- Around line 1320-1410: Update the Role ARN and Role Region TextFields in the
assumeRole section to bind their validation state to the existing
roleArn/roleRegion errors, using error and helperText props consistent with the
form’s other validated fields. Ensure empty required values visibly show the
corresponding validation message while preserving the existing formHasErrors
Save behavior.

In
`@tests/cypress/e2e/publisher/023-ai-api-create/01-aws-bedrock-endpoint-auth.cy.js`:
- Around line 19-26: Add an explicit conditional skip to the Bedrock provider
setup before `createBedrockAPI` or `selectAutocompleteOption` attempts to choose
a matching option. Detect whether a registered provider matches `/bedrock/i`;
skip the spec when none exists, while preserving the existing form assertions
when a provider is available. Update the header comment only if needed to
accurately describe the implemented behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c1e546e2-ebd7-43bc-b0eb-1982d2d5733a

📥 Commits

Reviewing files that changed from the base of the PR and between 935e773 and e4f0fbf.

📒 Files selected for processing (3)
  • portals/publisher/src/main/webapp/site/public/locales/en.json
  • portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/AIEndpoints/AddEditAIEndpoint.jsx
  • tests/cypress/e2e/publisher/023-ai-api-create/01-aws-bedrock-endpoint-auth.cy.js

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
portals/publisher/src/main/webapp/site/public/locales/en.json (1)

1085-1085: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use one stable message ID for the access URL label.

The call sites split between two formatted IDs that only differ in trailing newline/indentation, while the locale contains both malformed entries. Use the same normalized ID, Apis.Details.Environments.Environments.select.vhost, for both call sites and the locale entry.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@portals/publisher/src/main/webapp/site/public/locales/en.json` at line 1085,
Normalize the access URL localization key to
`Apis.Details.Environments.Environments.select.vhost` everywhere: update both
call sites and replace the malformed locale entry in the translations. Remove
the variants containing trailing newline or indentation so all references use
one stable message ID.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@portals/publisher/src/main/webapp/site/public/locales/en.json`:
- Line 891: Restore the missing spaces in the IAM-role tooltip text: update the
locale value in portals/publisher/src/main/webapp/site/public/locales/en.json at
lines 891-891 to use “securely manage temporary credentials”, and update the
concatenated tooltip fragments in
portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/AWSLambda/Credentials.jsx
at lines 173-175 to include the same spaces.

---

Outside diff comments:
In `@portals/publisher/src/main/webapp/site/public/locales/en.json`:
- Line 1085: Normalize the access URL localization key to
`Apis.Details.Environments.Environments.select.vhost` everywhere: update both
call sites and replace the malformed locale entry in the translations. Remove
the variants containing trailing newline or indentation so all references use
one stable message ID.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ede2af80-9faa-4127-874e-4fe07051fe8c

📥 Commits

Reviewing files that changed from the base of the PR and between e4f0fbf and 939d38e.

📒 Files selected for processing (7)
  • portals/admin/src/main/webapp/site/public/locales/en.json
  • portals/admin/src/main/webapp/site/public/locales/fr.json
  • portals/devportal/src/main/webapp/site/public/locales/en.json
  • portals/publisher/src/main/webapp/site/public/locales/en.json
  • portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/AIEndpoints/AddEditAIEndpoint.jsx
  • portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/AWSLambda/Credentials.jsx
  • tests/cypress/e2e/publisher/023-ai-api-create/01-aws-bedrock-endpoint-auth.cy.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/cypress/e2e/publisher/023-ai-api-create/01-aws-bedrock-endpoint-auth.cy.js

Comment thread portals/publisher/src/main/webapp/site/public/locales/en.json Outdated
@e19166
e19166 force-pushed the main branch 2 times, most recently from 4c4d35b to d9cd463 Compare August 3, 2026 09:05
coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 3, 2026
ashera96
ashera96 previously approved these changes Aug 3, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/AIEndpoints/AddEditAIEndpoint.jsx (1)

1370-1441: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Surface validation errors when Save is disabled.

The button disables on formHasErrors(true), but rendered field errors use validating. validating becomes true only in formSave. On an initially invalid form, the disabled button prevents formSave from activating validation feedback.

The Access Key, Secret Key, and Region fields also have no error or helperText bindings. Use one active validation state for the button and all field-level validators. The Role ARN and Role Region controls already have the required bindings.

Also applies to: 1584-1587

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/AIEndpoints/AddEditAIEndpoint.jsx`
around lines 1370 - 1441, Unify the validation state used by the Save button’s
formHasErrors check and field-level rendering so initially invalid forms display
feedback even while Save is disabled. Bind the Access Key, Secret Key, and
Region TextFields to that same state with error and helperText, matching the
existing Role ARN and Role Region bindings. Update validating/formSave usage so
validation activates consistently without changing the existing validation
rules.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In
`@portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/AIEndpoints/AddEditAIEndpoint.jsx`:
- Around line 1370-1441: Unify the validation state used by the Save button’s
formHasErrors check and field-level rendering so initially invalid forms display
feedback even while Save is disabled. Bind the Access Key, Secret Key, and
Region TextFields to that same state with error and helperText, matching the
existing Role ARN and Role Region bindings. Update validating/formSave usage so
validation activates consistently without changing the existing validation
rules.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 629a9763-944a-4e12-911a-e39d810aa30b

📥 Commits

Reviewing files that changed from the base of the PR and between 939d38e and 0cc7eee.

📒 Files selected for processing (4)
  • portals/publisher/src/main/webapp/site/public/locales/en.json
  • portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/AIEndpoints/AddEditAIEndpoint.jsx
  • portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/AWSLambda/Credentials.jsx
  • tests/cypress/e2e/publisher/023-ai-api-create/01-aws-bedrock-endpoint-auth.cy.js
🚧 Files skipped from review as they are similar to previous changes (2)
  • portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/AWSLambda/Credentials.jsx
  • portals/publisher/src/main/webapp/site/public/locales/en.json

@sonarqubecloud

sonarqubecloud Bot commented Aug 6, 2026

Copy link
Copy Markdown

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.

2 participants