Skip to content

Conversation

KingVibhor
Copy link

FIxes : #165

Summary

This PR fixes the regex pattern for validating connection strings in the MCP client form component has incorrect anchoring that allows invalid URLs to pass validation.

Changes

Made changes in the bifrost\ui\app\config\views\mcpClientForm.tsx file
In the line 116, changed : /^(http://|https://|env.[A-Z_]+$)/ to /^(?:http://|https://|env.[A-Z_]+)$/ so that the URL is properly anchored.

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (Next.js)
  • Docs

How to test

  1. Open the MCP Client Form in your application UI.
  2. Try entering various values in the "Connection URL" field:

Valid examples:

Invalid examples (should show a validation error):

  • ftp://example.com
  • http://garbageEXTRA
  • env.my_env_var (lowercase letters)
  • example.com
  • http:// (with nothing after)
  1. Submit the form and confirm:
  • Valid values are accepted.
  • Invalid values show the error:
  • "Connection URL must start with http://, https://, or be an environment variable (env.VAR_NAME)"
# Core/Transports
go version
go test ./...

# UI
cd ui
pnpm i || npm i
pnpm test || npm test
pnpm build || npm run build

Breaking changes

  • Yes
  • No

If yes, describe impact and migration instructions.

Related issues

Closes #165

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

Copy link
Contributor

coderabbitai bot commented Oct 10, 2025

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved Connection URL validation in the MCP Client form to require a complete, valid entry.
    • Ensures both http and https URLs are accepted.
    • Supports environment variable inputs in the env.VAR_NAME format.
    • Prevents partial matches, reducing false positives and delivering clearer validation feedback.

Walkthrough

Replaced the connection URL validation regex in ui/app/config/views/mcpClientForm.tsx with a non-capturing group and moved the end anchor so the entire input must match either an http:///https:// URL or an env.VAR_NAME pattern (full-string match).

Changes

Cohort / File(s) Summary
Validation regex fix
ui/app/config/views/mcpClientForm.tsx
Replaced `/^(http://

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant User
  participant Form
  participant Validator
  participant App

  User->>Form: Enter connection string
  Form->>Validator: validate(input)
  note right of Validator #DFF7E0: Regex enforces full-string match\n(?:http://|https://|env.VAR)
  Validator-->>Form: valid / invalid
  Form-->>App: submit if valid
  App-->>User: success / show error
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

I twitched my nose at dangling ends,
Brought anchors close like tidy friends,
HTTP or env so true,
No more stray bits slipping through,
Hop, the form is whole again. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title Check ✅ Passed The title concisely and accurately describes the primary change by indicating a fix to the regex validation for the connection string in the MCP client form, matching the main focus of the diff and following conventional commit style.
Linked Issues Check ✅ Passed The change precisely implements the suggested fix from issue #165 by updating the regex to use a non-capturing group with the end-of-string anchor applied to all alternatives and retains the original error message, fully satisfying the linked issue requirements.
Out of Scope Changes Check ✅ Passed All modifications are confined to the regex validation in the specified MCP client form component, with no unrelated or out-of-scope changes introduced.
Description Check ✅ Passed The PR description follows the repository template by providing a clear summary, detailed changes, type of change, affected areas, testing instructions, breaking change declaration, related issues, and a completed checklist; while the screenshots/recordings and security considerations sections are not present, their absence does not impede understanding of the change.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 70c7d8c and a2ffd06.

📒 Files selected for processing (1)
  • ui/app/config/views/mcpClientForm.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • ui/app/config/views/mcpClientForm.tsx

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 and usage tips.

@akshaydeo
Copy link
Contributor

thanks for the PR @KingVibhor - once checks pass; ill merge it

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e33f4f4 and 9d5412c.

📒 Files selected for processing (1)
  • ui/app/config/views/mcpClientForm.tsx (1 hunks)

Validator.pattern(
form.connection_string || "",
/^(http:\/\/|https:\/\/|env\.[A-Z_]+$)/,
/^(?:http:?\/\/.+|env\.[A-Z_]+)$/,
Copy link
Contributor

Choose a reason for hiding this comment

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

Image

this fails for https

@KingVibhor please add test cases as well and re-submit

@KingVibhor KingVibhor requested a review from akshaydeo October 11, 2025 07:07
@KingVibhor
Copy link
Author

KingVibhor commented Oct 13, 2025 via email

@KingVibhor
Copy link
Author

KingVibhor commented Oct 13, 2025 via email

@akshaydeo akshaydeo closed this Oct 14, 2025
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.

Fix regex validation for connection string in MCP client form

2 participants