Skip to content

feature: Allow partial act messages to be received (discussion) #672

Closed
@julianknutsen

Description

@julianknutsen

The RFC mentions that any payloads smaller than the act sizes should result in an error. However, it specifically mentions network reads. Since developers of this library are implementing their own network stack, it is possible that the peer_handler code could receive partial sequential read() calls that result in a valid act.

Relevant RFC line:

https://github.com/lightningnetwork/lightning-rfc/blob/master/08-transport.md#handshake-exchange

Receiver Actions:

1. Read exactly 50 bytes from the network buffer.

Is it worth supporting users of the library that send the ACT messages in chunks?

from @ariard:

Can you point to me where the requirement is stated ? I fear that deviating from the spec would open you to some byte-counting fragmentation attack, where an infrastructure entity deliver cipher byte by byte to the decoder and such learn ciphertext boundaries. This kind of concern is really theoretical given deployment of authenticated/encrypted protocols above the standard IP stack. That said it would be nice to conserve this security property as this module minimizes assumptions on the underlying link/network layer and such could be deployed on wireless communications channels, less-prone to infrastructure manipulation.

Relevant patch:

feature: Allow partial act messages to be received

The previous implementation would error and subsequently cause
a disconnect if a partial act was sent to the state machine, even
if future calls could be added to the read buffer to create a
valid act.

The RFC mentions that an error should be generated if the act is the
incorrect size, but since this code doesn't directly read off the
network it is possible it receives a single act message over
multiple calls.

Implement this behavior and add the appropriate tests.

0001-feature-Allow-partial-act-messages-to-be-received.patch.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions