-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
crypto/tls: usage of QUICResumeSession in Go 1.23rc1 breaks backwards compatibility #68124
Comments
cc @neild |
Oops. Thanks for the report. Will fix. Renaming |
Hm. So, perhaps this is something we should change, but the oversight is one in documenting the original 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 But the |
Change https://go.dev/cl/594475 mentions this issue: |
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 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 1.23 adds two new events to QUICConns: QUICStoreSessionEvent and QUICResumeSessionEvent. We added a QUICConfig.EnableStoreSessionEvent flag to control whether the store-session event is provided or not, because receiving this event requires additional action from the caller: the session must be explicitly stored with QUICConn.StoreSession. We did not add a control for whether the resume-session event is provided, because this event requires no action and the caller is expected to ignore unknown events. However, we never documented the expectation that callers ignore unknown events, and quic-go produces an error when receiving an unexpected event. So change the EnableStoreSessionEvent flag to apply to both new events. Fixes golang#68124 For golang#63691 Change-Id: I84af487e52b3815f7b648e09884608f8915cd645 Reviewed-on: https://go-review.googlesource.com/c/go/+/594475 Reviewed-by: Marten Seemann <martenseemann@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Roland Shoemaker <roland@golang.org>
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: quic-go/quic-go#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.
#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
The text was updated successfully, but these errors were encountered: