Repository navigation
fix: escape iterator pk/id values and remove sparse vector stdout dump - #622
Merged
Merged
Conversation
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: yhmo The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Contributor
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
yhmo
commented
Oct 23, 2026
yhmo
commented
Oct 23, 2026
yhmo
commented
Oct 23, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 2.6 #622 +/- ##
======================================
Coverage ? 86.77%
======================================
Files ? 321
Lines ? 12694
Branches ? 1315
======================================
Hits ? 11015
Misses ? 1679
Partials ? 0
🚀 New features to boost your workflow:
|
The query and search iterators interpolated VARCHAR primary-key and ID values into filter-expression string literals without escaping. A crafted value containing quotes or backslashes could break out of the literal and inject expression clauses that the server evaluates under the requesting user identity, bypassing client-side filters and enabling cross-scope data reads. Escape backslash, single/double quote, CR, LF and TAB per the Milvus expression grammar before interpolation, keeping benign values unchanged. Also stop printing raw sparse-vector JSON to stdout when parsing fails. Signed-off-by: yhmo <yihua.mo@zilliz.com>
|
New changes are detected. LGTM label has been removed. |
Merged
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.
Summary
Two security fixes for the 2.6 line:
Escape VARCHAR PK/ID values in iterator filter expressions (expression injection)
QueryIteratorImpl::setupNextFilterandSearchIteratorImpl::filteredDuplicatedResultFilterinterpolated VARCHAR primary-key / ID values into filter-expression string literals without escaping. Since Milvus VARCHAR PKs accept arbitrary UTF-8 (including quotes and backslashes) and the server's expression grammar terminates a string literal on an unescaped quote, a crafted PK value could break out of the literal and inject expression clauses (e.g.or 1==1) that are evaluated under the requesting user's identity — bypassing client-side filters and enabling cross-scope data reads.Fix: add
EscapeExprStringValue(escapes\\,",', CR, LF, TAB per the Milvus expression grammar) and apply it before interpolation. Benign values are byte-identical, so paging semantics are unchanged. The server parser unescapes these sequences back to the raw value (convertEscapeSingle+strconv.Unquote), so comparisons stay correct.Stop printing raw sparse-vector JSON to stdout on parse failure (
DmlUtils::ParseSparseFloatVector).Tests
DqlUtilsTest.EscapeExprStringValueTest— escaping unit coverage.MilvusMockedTest.QueryIteratorEscapesVarcharPkInPagingExpression— mocked test proving an injected PK produces the fully-escaped expression on subsequent pages.QueryIterator,SearchIteratorV1/V2, etc.) pass unchanged; fulltesting-utpasses (694/694).Signed-off-by: yhmo yihua.mo@zilliz.com