mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-13 19:40:28 -07:00
fix(core): sanitize and length-check MCP tool qualified names (#20987)
This commit is contained in:
@@ -260,8 +260,10 @@ export function isValidToolName(
|
||||
return !!options.allowWildcards;
|
||||
}
|
||||
|
||||
// Basic slug validation for server and tool names
|
||||
const slugRegex = /^[a-z0-9-_]+$/i;
|
||||
// Basic slug validation for server and tool names.
|
||||
// We allow dots (.) and colons (:) as they are valid in function names and
|
||||
// used for truncation markers.
|
||||
const slugRegex = /^[a-z0-9_.:-]+$/i;
|
||||
return slugRegex.test(server) && slugRegex.test(tool);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user