-
Notifications
You must be signed in to change notification settings - Fork 71
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
Issue Description
The regex pattern for validating connection strings in the MCP client form component has incorrect anchoring that allows invalid URLs to pass validation.
Location
File: ui/components/config/mcp-client-form.tsx
Lines: 107-111
Problem
The current regex pattern /^(http:\/\/|https:\/\/|env\.[A-Z_]+$)/
only anchors the third alternative (env\.[A-Z_]+$
). The first two alternatives (http:\/\/
and https:\/\/
) are not properly anchored, allowing trailing characters to be accepted.
This means URLs like http://garbage
or https://anythingelse
would incorrectly pass validation.
Current Code
Validator.pattern(
form.connection_string || '',
/^(http:\/\/|https:\/\/|env\.[A-Z_]+$)/,
'Connection URL must start with http://, https://, or be an environment variable (env.VAR_NAME)',
),
Suggested Fix
Validator.pattern(
form.connection_string || '',
/^(?:http:\/\/|https:\/\/|env\.[A-Z_]+)$/,
'Connection URL must start with http://, https://, or be an environment variable (env.VAR_NAME)',
),
Changes Made
- Convert capturing group to non-capturing group:
(?:...)
- Move the end-of-string anchor
$
outside the group to apply to all alternatives
References
- Original PR: feat: add streaming support for chat completions #162
- Comment: feat: add streaming support for chat completions #162 (comment)
Impact
This is a validation bug that could allow malformed URLs to be accepted during MCP client configuration.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Type
Projects
Status
Backlog