You are reading content from Scuttlebutt
@Dominic %wqxVOw3+VRs6c1wf8s8LQLWNiH60i8SglgC4mJPUvx8=.sha256
Re: %NeOkZhPNh

thankfully, something sensible here is happening here @regular and you did not just create a message that makes @aljoscha's spec more complicated ;)

hex dumping that message:

000000e0  0a 20 20 20 20 22 74 79  70 65 22 3a 20 22 5c 22  |.    "type": "\"|
000000f0  ef bf bd 5c 22 22 0a 20  20 7d 2c 0a 20 20 22 73  |...\"".  },.  "s|

5c 22 ef bf db 5c 22 22 which is \ " <a_now_valid_utf8> \ "

investigating:

//default is to convert to valid utf8
> Buffer.from(JSON.stringify('\x22\xff\x22'))
<Buffer 22 5c 22 c3 bf 5c 22 22> //becomes \uc3bf valid utf8

//turns out v8 does actually allow invalid chars, if you force read as ascii:
> Buffer.from(JSON.stringify('\x22\xff\x22'), 'ascii')
<Buffer 22 5c 22 c3 ff 22 22> //becomes \uc3bf valid utf8

packet-stream-codec converts json strings into buffers with the buffer default,
which is utf8, so this means that the reference implementation never sends invalid utf8 inside of json, and would not validate a signature of a message with invalid js.

So @aljoscha good news, reject such a message!

Join Scuttlebutt now