Closed marten-seemann closed 5 months ago
Similar Issues
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
cc @neild
Oops. Thanks for the report. Will fix.
Renaming EnableStoreSessionEvent
seems reasonable.
Hm. So, perhaps this is something we should change, but the oversight is one in documenting the original QUICConn.NextEvent
API.
My intent was that implementations ignore events they don't recognize, precisely to permit us to add more events in the future. This probably should have been greased with the implementation providing a random event.
The reason we only have EnableStoreSessionEvent
is that this event requires a response from the QUIC layer--when the event is enabled, the caller needs to call QUICConn.StoreSession
to store the session, possibly after modifying it. In contrast, QUICResumeSessionEvent
doesn't require a response.
But the QUICConn
documentation doesn't actually say that implementations need to ignore unknown events, so maybe we should change the control to apply to resumption events as well. I think quic-go should switch to ignoring unknown events, though.
Change https://go.dev/cl/594475 mentions this issue: crypto/tls: apply QUIC session event flag to QUICResumeSession events
My intent was that implementations ignore events they don't recognize, precisely to permit us to add more events in the future. This probably should have been greased with the implementation providing a random event.
I tried to find any record of this, but I can't seem to find anything. As a QUIC implementation, it seems dangerous to ignore events coming from the TLS stack.
Of course, crypto/tls could guarantee that it's safe to do ignore a particular event, but I'm not sure if that's practical either: Some events definitely can't be ignored, and it's unclear how the combinatorial explosion could be dealt with.
There are three options for APIs like this
Sounds like the API was meant to be (2) and was interpreted as (1).
(1) hamstrings crypto/tls and will cause a bunch of new Config options to show up.
I disagree that (2) is dangerous: it is the job of crypto/tls to make sure that new events are backwards compatible, which includes being safe to ignore. Having to ensure they are safe to ignore is still much better than not being able to add them at all!
I think (3) doesn't make much sense here, because adding a new critical event without opt-in would break backwards compatibility, so we can never do it, bringing us back to (2) effectively.
I think it's early enough that we should clarify the API as (2), and add grease. Restricting ourselves to (1) would be a pain in the long term.
Thanks for weighing in here @FiloSottile! I'm happy to change quic-go to (2), and I can do that in the next release. Should we document though that all the events defined in Go 1.22 are critical and must not be ignored?
With https://go-review.googlesource.com/c/go/+/594475, Go 1.23 won't break backwards compatibility with existing quic-go version. I assume that once we decide to add more events, current quic-go versions will have been phased out to a degree such that they won't cause any major problems.
I don't think there's anything dangerous about ignoring unknown events here. In general, the failure mode of misusing this API is the handshake failing to complete. If we add new events that can't be ignored (such as QUICStoreSession
), then we need to gate them behind an opt-in to avoid breaking backwards compatibility, so an implementation can safely assume that anything it doesn't recognize is unimportant (to it).
I also don't think we need to document that the current events are critical; a QUIC implementation which ignores any just isn't going to function.
I think that we should:
I don't have any anticipation that we'll be making any more changes to this API in the foreseeable future, but that should keep the door open for the unforeseen.
Go version
go version go1.23rc1 (all platforms)
Output of
go env
in your module/workspace:What did you do?
I ran quic-go's test suite using Go 1.23: https://github.com/quic-go/quic-go/pull/4571.
What did you see happen?
Multiple tests related to QUIC session resumption are failing.
What did you expect to see?
As the QUIC API in crypto/tls is covered by Go's backwards compatibility guarantee, I expected the tests to pass.
https://github.com/golang/go/issues/63691 introduced two new QUIC events:
QUICResumeSession
andQUICStoreSession
. The usage ofQUICStoreSession
is gated by theQUICConfig.EnableStoreSessionEvent
config option, but the usage ofQUICResumeSession
isn't.This means that crypto/tls passes
QUICResumeSession
to quic-go, which doesn't know how to handle this event, and therefore aborts the handshake.I believe this is an oversight, and that both events should have been gated by the config option. We might also want to rename the config flag to
EnableSessionEvents
to make it clear that it covers bothQUICStoreSession
andQUICResumeSession
.cc @neild @FiloSottile