-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GetCandidates is prone to Denial of Service #2683
Comments
A lot of issues are caused by this |
We should limit the return to the first X candidates |
Isn't the point of this method that you can get ALL candidates. Perhaps we need a Alternatively, change the way registration works so you can limit the max stored candidates. E.g. You can register as candidate, you then have |
If we can limit the maximum size of toarray(), then problems caused with toarray will be solved and prevented. If we just do |
|
I guess it comes down to being able to update native contracts to begin with. |
Updating GetCandidates to return an iterator would not solve the problem entirely. RpcServer only returns the first More info in neo-project/neo-modules#629 and neo-project/neo-devpack-dotnet#647 |
I made a possible solution for it, please check it #2686 |
I think returning an iterator is the best solution. |
Agree 100%, as long as we provide a mechanism for RpcClient to iterator to access the full iterated collection, not just first |
|
New syscall? |
Not by the caller |
For the new syscall is ok, but for the previous one, just limit? |
Both are fine for me, limit it, or wait until it exceeds 2048 items to automatically throw an exception. |
If there are 1024 or more candidates registered and the smart contract call
GetCandidates
a denial of service will occur.neo/src/neo/SmartContract/Native/NeoToken.cs
Line 340 in 2a64c1c
The text was updated successfully, but these errors were encountered: