LiskArchive / lisk-elements

⚙️ Library for sending Lisk transactions from the client or server
https://lisk.io/
GNU General Public License v3.0
250 stars 64 forks source link

Validate null character - Closes #1108 #1109

Closed shuse2 closed 5 years ago

shuse2 commented 5 years ago

What was the problem?

By protocol, Transfer Transaction and Dapp transaction should not allow null character in string field.

How did I fix it?

Add the same check done as https://github.com/LiskHQ/lisk/commit/5c7e2944383bf369f1343fba62c71e84de6f9664. Also, added test to check schema validation works.

How to test it?

npm t

Review checklist

webmaster128 commented 5 years ago

The term noNullByte is highly misleading as you are checking JavaScript strings, which is a list of unicode characters. There is no byte in a string. A string can be converted to a list of bytes by encoding it but a string itself is independent of any binary representation.

So this should be called noNullCharacter.