Subject: Re: [quicwg/base-drafts] Authenticate connection IDs (#3499)

From: Jana Iyengar <[email-masked]>
Date: Wed, 08 Apr 2020 18:11:40 -0700

@janaiyengar requested changes on this pull request.

A few comments. Most importantly, mention of ODCID field needs to be removed.

> +{{transport-parameters}}. This ensures that all connection IDs are authenticated
+by the cryptographic handshake.

```suggestion
{{transport-parameters}}. This ensures that all connection IDs used for the
handshake are also authenticated by the cryptographic handshake.
```

> +(original_connection_id, preferred_address, retry_connection_id, and
+stateless_reset_token). A server MUST treat receipt of any of these transport

```suggestion
original_connection_id, preferred_address, retry_connection_id, or
stateless_reset_token. A server MUST treat receipt of any of these transport
```

> @@ -4794,9 +4854,9 @@ immediately after opening.  If the transport parameter is absent, streams of
 that type start with a flow control limit of 0.
 
 A client MUST NOT include server-only transport parameters

```suggestion
A client MUST NOT include any server-only transport parameter:
```

> @@ -1475,6 +1475,49 @@ lifetime of a connection, especially in response to connection migration
 ({{migration}}); see {{issue-cid}} for details.

+## Authenticating Connection IDs {#cid-auth}
+
+The choice each endpoint makes about connection IDs during the handshake is
+authenticated by including all values in transport parameters; see
+{{transport-parameters}}. This ensures that all connection IDs are authenticated
+by the cryptographic handshake.
+
+Each endpoint includes the value of the Source Connection ID field from Initial
+packets it sends in the handshake_connection_id transport parameter; see
+{{transport-parameter-definitions}}. A server includes the Destination
+Connection ID field it receives in the original Initial packet from the client

```suggestion
Connection ID field it receives in original Initial packets from the client
- Initial packets received by the server prior to sending a Retry packet -
```

> +Each endpoint ensures that the values of the peer's transport parameters
+match the values the endpoint sent in its packet headers. The values

```suggestion
The values
```
This first sentence is unnecessary.

> +values that an endpoint used in the Destination Connection ID field of an
+Initial packet. Including connection ID values in transport parameters and

```suggestion
values that an endpoint used in the Destination Connection ID field of Initial
packets that it sent. Including connection ID values in transport parameters and
```

> +verifying them ensures that the choice of connection ID cannot be influenced by
+an attacker. An endpoint MUST treat any of the following as a connection error
+of type PROTOCOL_VIOLATION:

```suggestion
verifying them ensures that that an attacker cannot influence the choice of
connection ID for a successful connection by injecting packets carrying
attacker-chosen connection IDs during the handshake. An endpoint MUST
treat any of the following as a connection error of type PROTOCOL_VIOLATION:
```

> +{{transport-parameter-definitions}}.  If the server sends a Retry packet, the
+server adds a retry_connection_id transport parameter that contains the value of
+the Source Connection ID field from the Retry packet.

```suggestion
{{transport-parameter-definitions}}.  If it sends a Retry packet, the server
also subsequently includes the value of the Source Connection ID field from
the Retry packet in its retry_connection_id transport parameter.
```

> +A server always includes an original_connection_id transport parameter. If the
+server sends a Retry packet, it MUST include the Destination Connection ID field
+from the client's first Initial packet in the original_connection_id transport
+parameter; otherwise the original_connection_id transport parameter MUST be
+copied from the client Initial.

```suggestion
A server always includes an original_connection_id transport parameter. If it
sends a Retry packet, the server MUST subsequently include the Destination
Connection ID field from the client's original Initial packets - packets received
by the server prior to sending the Retry packet -  in the original_connection_id
transport parameter. If the server did not send a Retry packet, the value of the
original_connection_id transport parameter MUST be copied from the
Destination Connection ID field of the most recent client Initial packets.
```

> +  by a server.  This is the same value sent in the Original Destination
+  Connection ID field that is used to construct a Retry packet (see
+  {{packet-retry}}).

```suggestion
  by a server.  The value of this parameter depends on whether the server
  sent a Retry packet (see {{packet-retry}}).
```

> @@ -1475,6 +1475,48 @@ lifetime of a connection, especially in response to connection migration
 ({{migration}}); see {{issue-cid}} for details.

+## Authenticating Connection IDs {#cid-auth}
+
+The choice each endpoint makes about connection IDs during the handshake is
+authenticated by including all values in transport parameters; see
+{{transport-parameters}}. This ensures that all connection IDs are authenticated
+by the cryptographic handshake.
+
+Each endpoint includes the value of the Source Connection ID field from Initial
+packets it sends in the handshake_connection_id transport parameter; see

In keeping with retry_connection_id being the SCID that is used on Retry packets, I have a preference for initial_connection_id, since it is the SCID used on Initial packets. 

In the same vein, and this is a weaker preference, I would propose changing original_connection_id to original_initial_connection_id. I think this makes it clear that this might have been initial_connection_id had it not been for a Retry.

> +Each endpoint includes the value of the Source Connection ID field from Initial
+packets it sends in the handshake_connection_id transport parameter; see

```suggestion
Each endpoint includes the value of the Source Connection ID field from the 
most recent Initial packet it sent in the handshake_connection_id transport
parameter; see
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/quicwg/base-drafts/pull/3499#pullrequestreview-390408658

---

From: Martin Thomson <[email-masked]>
Date: Wed, 08 Apr 2020 18:18:32 -0700

@martinthomson pushed 1 commit.

c7a236086266f17ba091046840d6e3d1e58251fe  Jana's suggestion from review

-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/quicwg/base-drafts/pull/3499/files/f44f24e94b3eae910909cdcc76b738792a6a0105..c7a236086266f17ba091046840d6e3d1e58251fe

---

From: Martin Thomson <[email-masked]>
Date: Wed, 08 Apr 2020 18:23:31 -0700

6f5e5478139beb1f0d187c2ea58a7449098e7711  Reformat

-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/quicwg/base-drafts/pull/3499/files/c7a236086266f17ba091046840d6e3d1e58251fe..6f5e5478139beb1f0d187c2ea58a7449098e7711

---

From: Martin Thomson <[email-masked]>
Date: Wed, 08 Apr 2020 18:32:35 -0700

I changed to initial_connection_id.  I don't necessarily like that we are using "original" and "initial", but I think that's marginally better than creating the obviously redundant "original_initial_" variant of this.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/quicwg/base-drafts/pull/3499#issuecomment-611278169

---

From: Martin Thomson <[email-masked]>
Date: Wed, 08 Apr 2020 18:45:08 -0700

@martinthomson pushed 2 commits.

8cec1c293b280b20329837cf4528187480986ba3  Rename to initial_connection_id
b0ef978e1e2451acc6db7857698b141c4e7cad29  Merge branch 'master' into authenticate-hs-cid

-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/quicwg/base-drafts/pull/3499/files/6f5e5478139beb1f0d187c2ea58a7449098e7711..b0ef978e1e2451acc6db7857698b141c4e7cad29

---

From: Jana Iyengar <[email-masked]>
Date: Wed, 08 Apr 2020 18:55:44 -0700

@janaiyengar approved this pull request.

Thanks, @martinthomson !

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/quicwg/base-drafts/pull/3499#pullrequestreview-390442789

---

From: Mike Bishop <[email-masked]>
Date: Thu, 09 Apr 2020 08:52:43 -0700

@MikeBishop approved this pull request.

Looks good.

> @@ -1544,7 +1588,6 @@ that are smaller than the remembered value of the parameters.
 * initial_max_stream_data_uni
 * initial_max_streams_bidi
 * initial_max_streams_uni
-* active_connection_id_limit

Why was this removed in this PR?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/quicwg/base-drafts/pull/3499#pullrequestreview-390919074

---

From: Martin Thomson <[email-masked]>
Date: Mon, 13 Apr 2020 15:29:13 -0700

e2f2b33800cb09add5e185e09f1512ef71e86099  Restore active_connection_id_limit

-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/quicwg/base-drafts/pull/3499/files/b0ef978e1e2451acc6db7857698b141c4e7cad29..e2f2b33800cb09add5e185e09f1512ef71e86099

---

From: Martin Thomson <[email-masked]>
Date: Mon, 13 Apr 2020 16:02:08 -0700

@martinthomson commented on this pull request.

A rebasing error.  I added something to this list, sorted it, removed it, now fixed it.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/quicwg/base-drafts/pull/3499#discussion_r407768333

---

From: Mike Bishop <[email-masked]>
Date: Wed, 29 Apr 2020 09:18:26 -0700

> +treat any of the following as a connection error of type PROTOCOL_VIOLATION:
+
+* absence of the initial_connection_id transport parameter from either
+  endpoint,
+
+* absence of the original_connection_id transport parameter from the server,
+
+* absence of the retry_connection_id transport parameter from the server after
+  receiving a Retry packet,
+
+* presence of the retry_connection_id transport parameter when no Retry packet
+  was received, or
+
+* a mismatch between values received from a peer in these transport parameters
+  and the value sent in the corresponding Destination Connection ID fields of
+  Initial packets.

```suggestion
  Initial packets or the Source Connection ID field of a Retry packet.
```
...though perhaps this is fine, since the client will then use this value as its DCID for the next Initial packet.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/quicwg/base-drafts/pull/3499#pullrequestreview-402824434

---

From: Martin Thomson <[email-masked]>
Date: Wed, 29 Apr 2020 16:56:02 -0700

+

> the client will then use this value as its DCID for the next Initial

Yeah, that was my thought.  The Retry.SCID thing is a choice people are free to use, but that doesn't need to be written down.  This way is simpler.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/quicwg/base-drafts/pull/3499#discussion_r417679178