ssbc / scuttlebutt-protocol-guide

Protocol documentation for Secure Scuttlebutt
https://ssbc.github.io/scuttlebutt-protocol-guide/
241 stars 31 forks source link

Missing message size limit 8192 characters #69

Open staltz opened 1 year ago

staltz commented 1 year ago

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

boreq commented 1 year ago

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.

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.

staltz commented 1 year ago

You're right