Skip to content

Forbid empty search queries over MCP#946

Merged
jviotti merged 2 commits into
mainfrom
search-min-length
May 25, 2026
Merged

Forbid empty search queries over MCP#946
jviotti merged 2 commits into
mainfrom
search-min-length

Conversation

@jviotti
Copy link
Copy Markdown
Member

@jviotti jviotti commented May 25, 2026

Signed-off-by: Juan Cruz Viotti jv@jviotti.com

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 25, 2026

🤖 Augment PR Summary

Summary: This PR tightens validation for schema search queries sent via MCP to prevent empty searches.

Changes:

  • Updated the search/rpc input JSON Schema to require a non-empty q string (minLength: 1).
  • Added an E2E MCP test that calls tools/call with q: "" and asserts a JSON-RPC -32602 “Invalid params” error.
  • Validated the returned MCP response against the described-by schema in the test.
  • Updated resource schema size assertions to reflect the schema change.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

"type": "string",
"maxLength": 256
"maxLength": 256,
"minLength": 1
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minLength: 1 blocks the empty string, but it still allows whitespace-only queries (e.g. " ") which are often effectively empty after trimming; if the intent is to forbid "empty" queries in that broader sense, schema validation alone may not fully enforce it.

Severity: low

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Re-trigger cubic

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark Index (community)

Details
Benchmark suite Current: 2c8f0a9 Previous: c35fa5c Ratio
Add one schema (0 existing) 279 ms 282 ms 0.99
Add one schema (100 existing) 26 ms 27 ms 0.96
Add one schema (1000 existing) 84 ms 84 ms 1
Add one schema (10000 existing) 718 ms 924 ms 0.78
Update one schema (1 existing) 18 ms 19 ms 0.95
Update one schema (101 existing) 27 ms 27 ms 1
Update one schema (1001 existing) 84 ms 87 ms 0.97
Update one schema (10001 existing) 834 ms 711 ms 1.17
Cached rebuild (1 existing) 5 ms 6 ms 0.83
Cached rebuild (101 existing) 8 ms 8 ms 1
Cached rebuild (1001 existing) 30 ms 31 ms 0.97
Cached rebuild (10001 existing) 303 ms 272 ms 1.11
Index 100 schemas 111 ms 114 ms 0.97
Index 1000 schemas 876 ms 887 ms 0.99
Index 10000 schemas 13006 ms 13978 ms 0.93

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark Index (enterprise)

Details
Benchmark suite Current: 2c8f0a9 Previous: c35fa5c Ratio
Add one schema (0 existing) 291 ms 292 ms 1.00
Add one schema (100 existing) 28 ms 29 ms 0.97
Add one schema (1000 existing) 80 ms 86 ms 0.93
Add one schema (10000 existing) 654 ms 844 ms 0.77
Update one schema (1 existing) 20 ms 21 ms 0.95
Update one schema (101 existing) 27 ms 28 ms 0.96
Update one schema (1001 existing) 80 ms 87 ms 0.92
Update one schema (10001 existing) 679 ms 710 ms 0.96
Cached rebuild (1 existing) 6 ms 7 ms 0.86
Cached rebuild (101 existing) 9 ms 9 ms 1
Cached rebuild (1001 existing) 29 ms 32 ms 0.91
Cached rebuild (10001 existing) 245 ms 277 ms 0.88
Index 100 schemas 121 ms 119 ms 1.02
Index 1000 schemas 1140 ms 1075 ms 1.06
Index 10000 schemas 13594 ms 14093 ms 0.96

This comment was automatically generated by workflow using github-action-benchmark.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
@jviotti jviotti merged commit 90f0040 into main May 25, 2026
5 checks passed
@jviotti jviotti deleted the search-min-length branch May 25, 2026 19:15
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.

1 participant