-
Notifications
You must be signed in to change notification settings - Fork 71
fix: Fix regex validation for connection string in MCP client form #587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Fix regex validation for connection string in MCP client form #587
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughReplaced the connection URL validation regex in Changes
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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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. Comment |
thanks for the PR @KingVibhor - once checks pass; ill merge it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validator.pattern( | ||
form.connection_string || "", | ||
/^(http:\/\/|https:\/\/|env\.[A-Z_]+$)/, | ||
/^(?:http:?\/\/.+|env\.[A-Z_]+)$/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey can you please the review the changes that i made to the PR
…On Fri, 10 Oct 2025 at 14:20, Akshay Deo ***@***.***> wrote:
***@***.**** requested changes on this pull request.
------------------------------
In ui/app/config/views/mcpClientForm.tsx
<#587 (comment)>:
> @@ -113,7 +113,7 @@ const ClientForm: React.FC<ClientFormProps> = ({ client, open, onClose, onSaved
Validator.required(form.connection_string?.trim(), "Connection URL is required"),
Validator.pattern(
form.connection_string || "",
- /^(http:\/\/|https:\/\/|env\.[A-Z_]+$)/,
+ /^(?:http:?\/\/.+|env\.[A-Z_]+)$/,
***@***.*** (view on web)
<https://github.com/user-attachments/assets/bcfe1003-d13c-4fb3-9287-19c4f338ba0b>
this fails for https
@KingVibhor <https://github.com/KingVibhor> please add test cases as well
and re-submit
—
Reply to this email directly, view it on GitHub
<#587 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A5A5QYZJXBNNJ3DOZIUU6Y33W5XNPAVCNFSM6AAAAACIZ7LQDCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTGMRSGA3DCMJRGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hey can you please review the changes I made to the PR
…On Fri, 10 Oct 2025 at 14:20, Akshay Deo ***@***.***> wrote:
***@***.**** requested changes on this pull request.
------------------------------
In ui/app/config/views/mcpClientForm.tsx
<#587 (comment)>:
> @@ -113,7 +113,7 @@ const ClientForm: React.FC<ClientFormProps> = ({ client, open, onClose, onSaved
Validator.required(form.connection_string?.trim(), "Connection URL is required"),
Validator.pattern(
form.connection_string || "",
- /^(http:\/\/|https:\/\/|env\.[A-Z_]+$)/,
+ /^(?:http:?\/\/.+|env\.[A-Z_]+)$/,
***@***.*** (view on web)
<https://github.com/user-attachments/assets/bcfe1003-d13c-4fb3-9287-19c4f338ba0b>
this fails for https
@KingVibhor <https://github.com/KingVibhor> please add test cases as well
and re-submit
—
Reply to this email directly, view it on GitHub
<#587 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A5A5QYZJXBNNJ3DOZIUU6Y33W5XNPAVCNFSM6AAAAACIZ7LQDCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTGMRSGA3DCMJRGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
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
Affected areas
How to test
Breaking changes
If yes, describe impact and migration instructions.
Related issues
Closes #165
Checklist
docs/contributing/README.md
and followed the guidelines