group-income icon indicating copy to clipboard operation
group-income copied to clipboard

Limit length on all user-provided strings/input into contracts

Open taoeffect opened this issue 4 years ago • 4 comments

Problem

Currently we do not place hard limit checks in the contracts on the length of strings, so this means things like usernames, profile summaries, bitcoin addresses, etc., are all technically allowed to be unlimited in size, presenting a DOS issue.

Solution

Replace all string validators in the contracts with a stringMax() function that takes a byte length and throws if the string is greater than that many bytes.

If it throws, make sure to ban the user from the group. Also place a limit on the maximum size of any single GIMessage, and make sure the server enforces it. Server-side ban users that exceed this limit.

taoeffect avatar Apr 19 '20 02:04 taoeffect

If it throws, make sure to ban the user from the group.

Why banning? Can't we just reject it?

sandrina-p avatar Apr 27 '20 14:04 sandrina-p

Why banning? Can't we just reject it?

Because in this case it would mean the frontend validators were purposefully bypassed, e.g. someone is hacking the app.

taoeffect avatar Apr 27 '20 14:04 taoeffect

Fair enough

sandrina-p avatar Apr 27 '20 14:04 sandrina-p

Most of the front end validators don't seem to work at all on my end. The first thing I did upon launching the app for the mode was typing a very long username and password, and they got accepted by both the client and server.

Is this because the app was not running in production mode?

snowteamer avatar Aug 08 '20 13:08 snowteamer