Skip to content

LLM Provider API Key Delete Warning and MCP Server Edit UI fixes - #2908

Merged
npamudika merged 5 commits into
wso2:mainfrom
npamudika:ui-fixes
Jul 28, 2026
Merged

LLM Provider API Key Delete Warning and MCP Server Edit UI fixes#2908
npamudika merged 5 commits into
wso2:mainfrom
npamudika:ui-fixes

Conversation

@npamudika

Copy link
Copy Markdown
Contributor

Purpose

Fixes #2806 and #2810

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Naduni Pamudika seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@npamudika, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 23 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1b87b301-5bce-4d54-9bcc-ed7086a6e950

📥 Commits

Reviewing files that changed from the base of the PR and between 270f53e and 846dcb0.

📒 Files selected for processing (1)
  • platform-api/internal/service/mcp.go
📝 Walkthrough

Walkthrough

The PR adds an MCP proxy Backend Connection tab with editable upstream settings, masked credentials, refetch validation, secret-safe persistence, and Cypress coverage. It also resolves stored secrets during validation, adjusts URL reachability handling, and warns before API key deletion.

Changes

MCP backend connection

Layer / File(s) Summary
Backend connection form and state
portals/ai-workspace/src/pages/appShell/appShellPages/externalServers/ExternalServersOverview.tsx
Adds backend fields, credential masking, unsaved-change handling, cancellation, and refetch controls.
Backend connection persistence and refetch
portals/ai-workspace/src/pages/appShell/.../ExternalServersOverview.tsx, portals/ai-workspace/src/utils/types.ts
Persists upstream settings, rotates changed credentials through secret placeholders, and supports proxyId or edited-auth validation requests.
Secret-backed validation and reachability
platform-api/internal/service/mcp.go, platform-api/internal/utils/common.go
Decrypts stored secret handles for refetches and disables connection reuse while draining reachability responses.
Backend connection flow coverage
portals/ai-workspace/cypress/e2e/002-mcp-proxies/005-mcp-backend-connection-refetch.cy.js
Tests unchanged and edited refetches, secret-safe saves, URL-only edits, post-save refetches, and cleanup.

API key deletion warnings

Layer / File(s) Summary
API key deletion confirmation warnings
portals/ai-workspace/src/pages/appShell/.../ServiceProviderDeploymentsCard.tsx, portals/ai-workspace/src/pages/appShell/.../ServiceProviderOverviewTab.tsx
Adds warning alerts explaining that deleting an API key can cause configured LLM Proxies to fail.

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

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant BackendConnectionTab
  participant MCPServerValidationAPI
  participant SecretAPI
  participant MCPProxyUpdateAPI
  User->>BackendConnectionTab: Edit connection or click Refetch
  BackendConnectionTab->>MCPServerValidationAPI: Validate with proxyId or edited auth
  MCPServerValidationAPI-->>BackendConnectionTab: Return validation result
  User->>BackendConnectionTab: Save edited credential
  BackendConnectionTab->>SecretAPI: Create replacement secret
  SecretAPI-->>BackendConnectionTab: Return secret placeholder
  BackendConnectionTab->>MCPProxyUpdateAPI: Update upstream configuration
  MCPProxyUpdateAPI-->>BackendConnectionTab: Return saved proxy
Loading

Possibly related PRs

  • wso2/api-platform#2797: Adds related end-to-end coverage for secret-backed MCP proxy upstream authentication.

Suggested reviewers: thushani-jayasekera, thivindu, pasant9, hiranyakavishani

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description only includes Purpose and is missing the required Goals, Approach, tests, security, and other template sections. Fill out the remaining template sections, especially Goals, Approach, Automation tests, Security checks, and Test environment.
Out of Scope Changes check ⚠️ Warning The MCP server edit UI/backend changes and related tests are unrelated to the only linked issue, which asks only for the delete warning. Move the MCP editor/refetch work to a separate PR or add the corresponding linked issue so the scope matches the issue list.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the main warning UI change plus the MCP edit fixes.
Linked Issues check ✅ Passed The PR adds the requested provider API key delete warning for linked issue #2806.
✨ 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.

@npamudika npamudika changed the title UI fixes LLM Provider API Key Delete Warning and MCP Server Edit UI fixes Jul 27, 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.

Actionable comments posted: 3

🧹 Nitpick comments (2)
portals/ai-workspace/cypress/e2e/002-mcp-proxies/005-mcp-backend-connection-refetch.cy.js (1)

164-183: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

afterEach doesn't clean up secrets created during setup/rotation.

Each test creates at least one secret (setup) and TC-100 creates a second one via rotation, but only createdServerId/createdProjectId are deleted here. Unless deleting the MCP proxy cascades to its secrets, these accumulate in the test environment across runs.

🤖 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/ai-workspace/cypress/e2e/002-mcp-proxies/005-mcp-backend-connection-refetch.cy.js`
around lines 164 - 183, Extend the afterEach cleanup alongside createdServerId
and createdProjectId to track and delete every secret created during setup and
TC-100 rotation. Reuse the existing secret identifier and authenticated DELETE
API pattern, clear each identifier after cleanup, and ensure cleanup runs for
all created secrets even when multiple secrets exist.
portals/ai-workspace/src/pages/appShell/appShellPages/externalServers/ExternalServersOverview.tsx (1)

1119-1167: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

onFocus clears the masked sentinel even without any edit.

Merely tabbing/clicking into the Value field unmasks and clears it (Lines 1128-1132), leaving a blank field until the user explicitly cancels — even if they back out without typing anything. Consider only clearing on first keystroke, or restoring the sentinel on blur if hasCredentialChanged is still false.

🤖 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/ai-workspace/src/pages/appShell/appShellPages/externalServers/ExternalServersOverview.tsx`
around lines 1119 - 1167, The auth value field’s onFocus handler in the
ExternalServersOverview component clears the masked credential without an edit.
Move sentinel clearing to the first user change, or restore the masked sentinel
on blur when hasCredentialChanged remains false, while preserving normal editing
behavior and avoiding blank values when the user only focuses and leaves the
field.
🤖 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/ai-workspace/src/pages/appShell/appShellPages/externalServers/ExternalServersOverview.tsx`:
- Around line 546-610: Track the newly created secret handle from the rotation
flow around createSecret and, when updateMCPServer fails, attempt to delete that
secret before showing the save-failure snackbar. Keep cleanup limited to the
newly created handle, tolerate deletion errors, and preserve the existing
successful-update cleanup of the old secret.
- Around line 538-583: Preserve the existing upstream authentication
configuration in the hasBackendConnectionChanges update path when
isRotatingCredential is false, instead of relying on the unavailable
server.upstream.main.auth.value or sending auth: undefined. Only replace or
clear auth when the credential is actively rotated, and retain the existing auth
object for URL-only or header-only edits. Add coverage for saving without
changing the credential if the surrounding test suite supports it.

In
`@portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderDeploymentsCard.tsx`:
- Around line 825-828: The deletion warning in
ServiceProviderDeploymentsCard.tsx at lines 825-828 must use the existing
FormattedMessage localization pattern instead of raw text. Reuse the same
localized message ID and text in ServiceProviderOverviewTab.tsx at lines
1141-1144 so both warnings share one translation entry.

---

Nitpick comments:
In
`@portals/ai-workspace/cypress/e2e/002-mcp-proxies/005-mcp-backend-connection-refetch.cy.js`:
- Around line 164-183: Extend the afterEach cleanup alongside createdServerId
and createdProjectId to track and delete every secret created during setup and
TC-100 rotation. Reuse the existing secret identifier and authenticated DELETE
API pattern, clear each identifier after cleanup, and ensure cleanup runs for
all created secrets even when multiple secrets exist.

In
`@portals/ai-workspace/src/pages/appShell/appShellPages/externalServers/ExternalServersOverview.tsx`:
- Around line 1119-1167: The auth value field’s onFocus handler in the
ExternalServersOverview component clears the masked credential without an edit.
Move sentinel clearing to the first user change, or restore the masked sentinel
on blur when hasCredentialChanged remains false, while preserving normal editing
behavior and avoiding blank values when the user only focuses and leaves the
field.
🪄 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: 48f7f8b6-bed3-4dfb-8fb8-7df39ad380f6

📥 Commits

Reviewing files that changed from the base of the PR and between d8bce70 and 1e08819.

📒 Files selected for processing (4)
  • portals/ai-workspace/cypress/e2e/002-mcp-proxies/005-mcp-backend-connection-refetch.cy.js
  • portals/ai-workspace/src/pages/appShell/appShellPages/externalServers/ExternalServersOverview.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderDeploymentsCard.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderOverviewTab.tsx

@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.

🧹 Nitpick comments (1)
portals/ai-workspace/cypress/e2e/002-mcp-proxies/005-mcp-backend-connection-refetch.cy.js (1)

308-342: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Verify persisted credential usability, not only the PUT shape.

This test confirms that the client sends auth without value, but a backend regression that drops the stored secret would still pass. After saving, assert the persisted proxy or perform an un-stubbed proxyId refetch and verify the connection still succeeds.

🤖 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/ai-workspace/cypress/e2e/002-mcp-proxies/005-mcp-backend-connection-refetch.cy.js`
around lines 308 - 342, Extend TC-101 beyond validating the PUT payload by
verifying the persisted credential remains usable after the URL-only save. After
the update completes, refetch the proxy through the real proxyId endpoint or
assert the persisted proxy state, then verify the connection succeeds using the
retained auth credential; keep the existing assertions that no new secret is
created and the auth metadata is preserved.
🤖 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.

Nitpick comments:
In
`@portals/ai-workspace/cypress/e2e/002-mcp-proxies/005-mcp-backend-connection-refetch.cy.js`:
- Around line 308-342: Extend TC-101 beyond validating the PUT payload by
verifying the persisted credential remains usable after the URL-only save. After
the update completes, refetch the proxy through the real proxyId endpoint or
assert the persisted proxy state, then verify the connection succeeds using the
retained auth credential; keep the existing assertions that no new secret is
created and the auth metadata is preserved.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 860576f0-6db8-4b79-8f66-5c4db2bd7e0f

📥 Commits

Reviewing files that changed from the base of the PR and between 1e08819 and 4edc773.

📒 Files selected for processing (5)
  • portals/ai-workspace/cypress/e2e/002-mcp-proxies/005-mcp-backend-connection-refetch.cy.js
  • portals/ai-workspace/src/pages/appShell/appShellPages/externalServers/ExternalServersOverview.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderDeploymentsCard.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderOverviewTab.tsx
  • portals/ai-workspace/src/utils/types.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderOverviewTab.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderDeploymentsCard.tsx
  • portals/ai-workspace/src/pages/appShell/appShellPages/externalServers/ExternalServersOverview.tsx

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 27, 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.

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)
platform-api/internal/utils/common.go (1)

441-456: 🔒 Security & Privacy | 🔴 Critical | 🏗️ Heavy lift

Validate every redirect destination before dialing it.

This follows redirects solely by count. A public, user-configured upstream can redirect the probe to a private or cloud-metadata address, and this transport will dial it. Use the shared SSRF-safe transport with dial-time resolved-IP checks, and explicitly follow only redirects whose targets pass the same validation.

As per coding guidelines, redirects must be revalidated and destination checks must occur at dial time.

🤖 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 `@platform-api/internal/utils/common.go` around lines 441 - 456, Update the
HTTP client configuration around CheckRedirect to use the shared SSRF-safe
transport with dial-time resolved-IP validation instead of a standalone
http.Transport. Ensure CheckRedirect validates each redirect target using the
same SSRF rules before allowing it, while preserving the existing redirect-count
limit and disabled keep-alive behavior.

Source: Coding guidelines

🤖 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 `@platform-api/internal/service/mcp.go`:
- Around line 535-539: Update the Decrypt error handling in the
secret-resolution flow around extractSecretHandle so the returned client error
is generic and contains no secret handle or underlying error details. Preserve
restricted audit logging if available, but ensure any reference is redacted or
hash-based and never expose the handle in client responses or standard
internal-error logs.

---

Outside diff comments:
In `@platform-api/internal/utils/common.go`:
- Around line 441-456: Update the HTTP client configuration around CheckRedirect
to use the shared SSRF-safe transport with dial-time resolved-IP validation
instead of a standalone http.Transport. Ensure CheckRedirect validates each
redirect target using the same SSRF rules before allowing it, while preserving
the existing redirect-count limit and disabled keep-alive 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: 1020fd45-38bf-4dcc-8060-26ea30c082b4

📥 Commits

Reviewing files that changed from the base of the PR and between 4edc773 and 270f53e.

📒 Files selected for processing (3)
  • platform-api/internal/service/mcp.go
  • platform-api/internal/utils/common.go
  • portals/ai-workspace/src/pages/appShell/appShellPages/externalServers/ExternalServersOverview.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • portals/ai-workspace/src/pages/appShell/appShellPages/externalServers/ExternalServersOverview.tsx

Comment thread platform-api/internal/service/mcp.go

@Induwara04 Induwara04 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.

UI LGTM

@npamudika
npamudika merged commit 24f2475 into wso2:main Jul 28, 2026
9 of 10 checks passed
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.

[Improvement]: Improve Provider API Key Deletion warning message

4 participants