Skip to content

fix: allow backticks in tool descriptions for Markdown formatting#2615

Merged
crivetimihai merged 1 commit intoIBM:mainfrom
jonathan-fulton:fix/allow-backticks-in-descriptions
Jan 31, 2026
Merged

fix: allow backticks in tool descriptions for Markdown formatting#2615
crivetimihai merged 1 commit intoIBM:mainfrom
jonathan-fulton:fix/allow-backticks-in-descriptions

Conversation

@jonathan-fulton
Copy link
Copy Markdown
Contributor

Summary

Removes backtick from the forbidden patterns in tool description validation. Backticks are commonly used in Markdown for inline code examples and pose no security risk in descriptions.

Problem

The gateway rejects tools with backticks in their descriptions (Issue #2576), blocking legitimate tools like Grafana's Loki query tools that use standard Markdown formatting:

  • Code examples: {app="foo"}
  • JSON examples: {"streams": 5}
  • Parameter references: labelName

Solution

Allow backticks in descriptions while maintaining other security patterns that prevent command injection (&&, ;, ||, $(, etc.).

Testing

The existing validation tests still pass, and tools with Markdown-formatted descriptions can now be registered.

Fixes #2576

@jonathan-fulton jonathan-fulton force-pushed the fix/allow-backticks-in-descriptions branch from 278f00b to 80c8859 Compare January 31, 2026 18:38
@crivetimihai crivetimihai self-assigned this Jan 31, 2026
@crivetimihai crivetimihai added this to the Release 1.0.0-RC1 milestone Jan 31, 2026
@crivetimihai
Copy link
Copy Markdown
Member

Thanks @jonathan-fulton! Good fix. I verified that tool descriptions are never passed to shell execution, and the remaining forbidden patterns ($(, &&, etc.) still block actual shell injection. The XSS layer (sanitize_display_text) also remains intact. Backticks for Markdown inline code is a legitimate use case. I'll start merging and rebasing.

Backticks are commonly used in tool descriptions for:
- Inline code examples: `{app="foo"}`
- JSON examples: `{"streams": 5}`
- Parameter references: `labelName`

This is standard Markdown/documentation formatting and poses no security risk.
The remaining forbidden patterns still protect against command injection.

Fixes IBM#2576

Signed-off-by: Jonathan Fulton <jonathan@jonathanfulton.com>
@crivetimihai crivetimihai force-pushed the fix/allow-backticks-in-descriptions branch from 80c8859 to 5ced8a4 Compare January 31, 2026 20:06
@crivetimihai crivetimihai merged commit a7bb268 into IBM:main Jan 31, 2026
51 checks passed
@ajaysingh-sc30
Copy link
Copy Markdown

Thank you @jonathan-fulton for the fix. Many thanks!

hughhennelly pushed a commit to hughhennelly/mcp-context-forge that referenced this pull request Feb 8, 2026
…M#2615)

Backticks are commonly used in tool descriptions for:
- Inline code examples: `{app="foo"}`
- JSON examples: `{"streams": 5}`
- Parameter references: `labelName`

This is standard Markdown/documentation formatting and poses no security risk.
The remaining forbidden patterns still protect against command injection.

Fixes IBM#2576

Signed-off-by: Jonathan Fulton <jonathan@jonathanfulton.com>
Signed-off-by: hughhennnelly <hughhennelly06@gmail.com>
kcostell06 pushed a commit to kcostell06/mcp-context-forge that referenced this pull request Feb 24, 2026
…M#2615)

Backticks are commonly used in tool descriptions for:
- Inline code examples: `{app="foo"}`
- JSON examples: `{"streams": 5}`
- Parameter references: `labelName`

This is standard Markdown/documentation formatting and poses no security risk.
The remaining forbidden patterns still protect against command injection.

Fixes IBM#2576

Signed-off-by: Jonathan Fulton <jonathan@jonathanfulton.com>
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.

[BUG]: Gateway Rejects Loki Query Tools Due to Backtick Validation

3 participants