SearchV2 DOS protection #1357

Open
opened 2025-12-28 17:22:41 +00:00 by sami · 4 comments
Owner

Originally created by @roman-khimov on GitHub (Feb 24, 2025).

I'm always frustrated when I realize that specifically crafted SearchV2 requests can make the node spend a lot of CPU cycles for nothing. Normal requests that want to quickly find something are no longer a problem, but some other can be.

Describe the solution you'd like

Add an iteration limit to the SearchV2 implementation. If we're making like 10K iterations with no results we're done, internal error is returned. The parameter is node-specific with this 10K default.

Describe alternatives you've considered

Time limits, but they're harder to check.

Additional context

#3058

Originally created by @roman-khimov on GitHub (Feb 24, 2025). ## Is your feature request related to a problem? Please describe. I'm always frustrated when I realize that specifically crafted SearchV2 requests can make the node spend a lot of CPU cycles for nothing. Normal requests that want to quickly find something are no longer a problem, but some other can be. ## Describe the solution you'd like Add an iteration limit to the SearchV2 implementation. If we're making like 10K iterations with no results we're done, internal error is returned. The parameter is node-specific with this 10K default. ## Describe alternatives you've considered Time limits, but they're harder to check. ## Additional context #3058
Author
Owner

@carpawell commented on GitHub (Feb 24, 2025):

What "iterations" means here?

@carpawell commented on GitHub (Feb 24, 2025): What "iterations" means here?
Author
Owner

@roman-khimov commented on GitHub (Feb 24, 2025):

Keys evaluated as per primary index.

@roman-khimov commented on GitHub (Feb 24, 2025): Keys evaluated as per primary index.
Author
Owner

@carpawell commented on GitHub (Feb 24, 2025):

So your suggestion does not allow to find (10K+1)th element ever?

@carpawell commented on GitHub (Feb 24, 2025): So your suggestion does not allow to find (10K+1)th element ever?
Author
Owner

@roman-khimov commented on GitHub (Feb 24, 2025):

SV2 works with 1000 items returned along with the continuation token normally and this will still work for regular uses since there is just 1000 iterations per request. But if you have 6M objects in a container you can create a query for non-existing object and I don't want to scan 6M (or whatever per-node share of it) of entries to answer that.

@roman-khimov commented on GitHub (Feb 24, 2025): SV2 works with 1000 items returned along with the continuation token normally and this will still work for regular uses since there is just 1000 iterations per request. But if you have 6M objects in a container you can create a query for non-existing object and I don't want to scan 6M (or whatever per-node share of it) of entries to answer that.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nspcc-dev/neofs-node#1357
No description provided.