ssbc / ssb-server

The gossip and replication server for Secure Scuttlebutt - a distributed social network
1.68k stars 164 forks source link

Fix caps being interpreted as a Buffer #727

Closed christianbundy closed 3 years ago

christianbundy commented 4 years ago

Problem: The SSB-Server configures caps as a buffer, which breaks all connections because it's supposed to be a base64 string.

Solution: Use the base64 string just like we're doing in SSB-Config.

arj03 commented 4 years ago

Strange, when I was testing caps 3 months ago I didn't run into this problem. How did you find this?

christianbundy commented 4 years ago

I just ran it from Node, bin.js worked fine but not when I used require().

staltz commented 4 years ago

Strange, this is secret-stack's responsibility, it should work either way because secret-stack converts it always to Buffer. See these lines:

https://github.com/ssbc/secret-stack/blob/5a4767a817f6615a5bc256b8406e1460ce9ee9aa/plugins/shs.js#L47

and

https://github.com/ssbc/secret-stack/blob/5a4767a817f6615a5bc256b8406e1460ce9ee9aa/plugins/shs.js#L12-L16

I don't doubt you experienced an issue, but I'm really curious why it broke with a buffer but not with a string.

stale[bot] commented 3 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

clehner commented 3 years ago

Tests pass locally. Thanks @christianbundy