mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-21 00:21:49 +00:00
fix(ui): treat MCP allowed clients with an empty alias or value as malformed
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
c32309fb2d
commit
e2141da81e
2 changed files with 12 additions and 1 deletions
|
|
@ -211,6 +211,17 @@ describe("MCPNetworkSettings", () => {
|
|||
await waitFor(() => expect(screen.queryByText(/stored allowlist is not a list/)).not.toBeInTheDocument());
|
||||
});
|
||||
|
||||
it("treats a stored entry with an empty alias or value as denying every client, like the gateway does", async () => {
|
||||
vi.mocked(getGeneralSettingsCall).mockResolvedValue([
|
||||
{ field_name: "mcp_allowed_clients", field_value: [ANTIGRAVITY, { alias: "", value: "claude-code" }] },
|
||||
]);
|
||||
|
||||
renderSettings();
|
||||
|
||||
expect(await screen.findByText(/stored allowlist is not a list of alias and value pairs/)).toBeVisible();
|
||||
expect(screen.queryByRole("button", { name: /^Antigravity CLI/ })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("adds clients as alias and value pairs and saves them under mcp_allowed_clients", async () => {
|
||||
renderSettings();
|
||||
await screen.findByText("Allowed Clients");
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ interface ClientDraft extends AllowedClient {
|
|||
const isAllowedClient = (entry: unknown): entry is AllowedClient => {
|
||||
if (typeof entry !== "object" || entry === null) return false;
|
||||
const { alias, value } = entry as Partial<Record<keyof AllowedClient, unknown>>;
|
||||
return typeof alias === "string" && typeof value === "string";
|
||||
return typeof alias === "string" && typeof value === "string" && !isIncomplete({ alias, value });
|
||||
};
|
||||
|
||||
type StoredAllowlist =
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue