scuttlebutt-protocol-guide icon indicating copy to clipboard operation
scuttlebutt-protocol-guide copied to clipboard

Missing message size limit 8192 characters

Open staltz opened this issue 3 years ago • 2 comments

Context: https://github.com/ssbc/ssb-classic/pull/2

staltz avatar Oct 10 '22 07:10 staltz

For more context go-ssb performs a check which ensures that the message JSON (by definition stored as Unicode text) is no longer than 8192 code points. This is theoretically different than measuring bytes.

https://github.com/ssbc/go-ssb/blob/8bb04d96e053f4d00b8d9f6cadfeb5cbd9b87756/message/legacy/verify.go#L78

JSON syntax describes a sequence of Unicode code points.

  • ECMA 404 - The JSON Data Interchange Syntax https://www.ecma-international.org/wp-content/uploads/ECMA-404_2nd_edition_december_2017.pdf

Both measuring bytes and code points is valid but I don't know what was the original intention.

Measuring bytes theoretically requires another piece of knowledge: how the message is supposed to be encoded eg. UTF-8, UTF-16 etc so it is important to make that distinction. The JSON standard obviously doesn't define that but classic feed messages are encoded as UTF-16.

boreq avatar Oct 10 '22 11:10 boreq

You're right

staltz avatar Oct 10 '22 11:10 staltz