emilbayes / noise-peer

Simple end-to-end encrypted, secure channels using Noise Protocol Framework and libsodium secretstream
ISC License
147 stars 13 forks source link

FINISH tag error when ending from initiator (client) #7

Closed bcomnes closed 4 years ago

bcomnes commented 4 years ago

When you peer.end() from the initiator, the callback resolves without an error, but then the socket and the peer streams from that same peer will emit errors:

Error: Remote closed without sending a FINISH tag (possible MITM vector).

The server/non initiator resolves the session cleanly.

Possibly related to https://github.com/emilbayes/noise-peer/issues/6? I tried with half open streams on both sides but still getting the same issue. Example here: https://github.com/little-core-labs/secure-rpc-protocol/blob/5a154ae9da52b0bd1058b8df3fb770fba175343c/examples/forward-secret/client.js#L1

bcomnes commented 4 years ago

Also just realizing that the end() callback doesn't ever return an error. I'll clarify this.

bcomnes commented 4 years ago

Putting together a more specific example, bare with me.

bcomnes commented 4 years ago

Closing and remaking a new issue.