Skip to content

Commit

Permalink
rename iterator token to id to fix security check
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Weizhi Xu <[email protected]>
  • Loading branch information
PwzXxm committed Dec 2, 2024
1 parent b0ca03e commit 9df786b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/proxy/search_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func parseSearchIteratorV2Info(searchParamsPair []*commonpb.KeyValuePair, groupB
}

// parse token, generate if not exist
token, _ := funcutil.GetAttrByKeyFromRepeatedKV(SearchIterTokenKey, searchParamsPair)
token, _ := funcutil.GetAttrByKeyFromRepeatedKV(SearchIterIdKey, searchParamsPair)
if token == "" {
generatedToken, err := uuid.NewRandom()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/proxy/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const (
SearchIterV2Key = "search_iter_v2"
SearchIterBatchSizeKey = "search_iter_batch_size"
SearchIterLastBoundKey = "search_iter_last_bound"
SearchIterTokenKey = "search_iter_token"
SearchIterIdKey = "search_iter_id"

InsertTaskName = "InsertTask"
CreateCollectionTaskName = "CreateCollectionTask"
Expand Down
4 changes: 2 additions & 2 deletions internal/proxy/task_search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2780,7 +2780,7 @@ func TestTaskSearch_parseSearchInfo(t *testing.T) {
t.Run("iteratorV2 invalid token", func(t *testing.T) {
param := generateValidParamsForSearchIteratorV2()
param = append(param, &commonpb.KeyValuePair{
Key: SearchIterTokenKey,
Key: SearchIterIdKey,
Value: "invalid_token",
})
searchInfo := parseSearchInfo(param, nil, nil)
Expand All @@ -2793,7 +2793,7 @@ func TestTaskSearch_parseSearchInfo(t *testing.T) {
assert.NoError(t, err)
param := generateValidParamsForSearchIteratorV2()
param = append(param, &commonpb.KeyValuePair{
Key: SearchIterTokenKey,
Key: SearchIterIdKey,
Value: token.String(),
})
searchInfo := parseSearchInfo(param, nil, nil)
Expand Down

0 comments on commit 9df786b

Please sign in to comment.