Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

noise: introduce an extension registry #453

Merged
merged 5 commits into from
Sep 23, 2022
Merged

Conversation

marten-seemann
Copy link
Contributor

@marten-seemann marten-seemann commented Sep 14, 2022

Fixes #450.

This PR removes the data field from the NoiseHandshakePayload protobuf, and adds an extensions field. extensions is NoiseExtensions protobuf, modeled after the extension registries that TLS and QUIC use.
By using a new ID (data was 3, extensions is 4), this change won’t break implementations that used early data (I’m not aware of any, but just in case).

I’ve added code points for WebTransport, WebRTC and Early Muxer Negotiation to this PR, mostly to demonstrate how this would look like. Given that none of the specs for these are merged yet, it might make sense to define an empty NoiseExtensions protobuf here, and have the respective PRs add their code point (we’ll have to deal with merge conflicts then). Let me know if I should make that change.

noise/README.md Outdated Show resolved Hide resolved
noise/README.md Outdated Show resolved Hide resolved
noise/README.md Outdated Show resolved Hide resolved
noise/README.md Outdated Show resolved Hide resolved
Comment on lines +311 to +301
Code points above 1024 MAY be used for experimentation. Code points up to
this value MUST be registered in this document before deployment.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand we tried to use multicodec for all magic numbers in the libp2p ecosystem thus far. If I understand this proposal correctly, it runs somewhat against this convention.

I am not opposed to that, I just think it is worth pointing out in the specification. E.g. a short paragraph of why we are not using multicodec for this.

What do you think @marten-seemann?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I'm not super familiar with the design philosophy behind multicoded. @Stebalien and @lidel, could you help us out here?

Copy link
Contributor

@MarcoPolo MarcoPolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's discuss the first message payload changes first.

noise/README.md Outdated Show resolved Hide resolved
noise/README.md Outdated Show resolved Hide resolved
noise/README.md Show resolved Hide resolved
noise/README.md Outdated Show resolved Hide resolved
noise/README.md Outdated Show resolved Hide resolved
noise/README.md Show resolved Hide resolved
responder sends theirs in message 2 (their only message). It should be stressed,
that while the second message of the handshake pattern has forward secrecy,
the sender has not authenticated the responder yet, so this payload might be
sent to any party, including an active attacker.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a security precaution is it helpful to specify that the "early data" should not be processed before the handshake is fully finished? thus gives us more confidence on the data, what are your thoughts on this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In WebTransport, we process it immediately, and fail the handshake if the certificate hash doesn't match.
Maybe we should point out that consumers of early data need to be careful, and that delaying the processing / acting upon the early data can be one strategy to deal with this.

Copy link
Contributor

@julian88110 julian88110 Sep 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, document that is a good point.
Processing early data before authentication runs the risk of opening an attack surface for flooding / DOS attack.

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me once updated to #456 and multicodec comment is addressed.

Thanks @marten-seemann for driving this.

noise/README.md Outdated Show resolved Hide resolved
@marten-seemann
Copy link
Contributor Author

I rebased this PR on top of master, bumped the version number and added a Changelog.

This should be good to merge now.

@marten-seemann marten-seemann dismissed MarcoPolo’s stale review September 23, 2022 09:45

all comments were addressed

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one question. Otherwise this looks good to me.

message NoiseHandshakePayload {
optional bytes identity_key = 1;
optional bytes identity_sig = 2;
optional bytes data = 3;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record, rust-libp2p does not make use of data. @marten-seemann do any of the other implementations?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go-libp2p doesn't, and js-libp2p doesn't either (as far as I know).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about nim-libp2p cpp-libp2p jvm-libp2p @marten-seemann?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not familiar with their code bases. This PR was open for more than a week, that should’ve been plenty of time to chime in. Also note that this is backwards-compatible change since we didn’t reuse field 3 in the protobuf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

proposal: Noise extension registry
4 participants