Repository navigation
fix(server): bound the query of a remote document search - #1778
Merged
Merged
Conversation
POST /doc/search and uteke_doc_search took a query of any length and embedded it under a slot. The query is now at most 2000 characters in every mode (the bound of a remote skill search), refused before the slot is taken. Closes #1777
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A remote document search (
POST /doc/search, MCPuteke_doc_search) now refuses a query longer than 2000 characters, in every mode, with a 400 (an MCP tool error) before an embedding slot is taken. The bound is the one of a remote skill search (MAX_QUERY_CHARS). NewEmbedNeed::for_doc_search(query, mode)inremote_guardreturns the bound check and the embed need together; the router and the MCP tool use it. CHANGELOG[Unreleased]entry.Why
Found in the v0.24.0 release review: the query had no length bound, so a client could send up to the 10 MB request limit and have it embedded under a slot.
POST /doc/searchis LAB, so there is no contract change; the CLI is unchanged.Testing
remote_guard(at the bound and one over infts,hybridandsemantic, multibyte characters count once, exact error text), HTTPPOST /doc/search(400 with the exact message in all three modes, 200 at the bound) and MCPuteke_doc_search(same).uteke-serveranduteke-mcptest suites pass locally, andcargo clippy -p uteke-core -p uteke-server -p uteke-mcp --all-targets -- -D warningsandcargo fmtare clean.Closes #1777