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

Allow TLS 1.2 servers to report client versions from the supported versions extension #4249

Merged
merged 6 commits into from
Oct 24, 2023

Conversation

goatgoose
Copy link
Contributor

@goatgoose goatgoose commented Oct 17, 2023

Resolved issues:

Resolves #4158

Description of changes:

Currently, TLS 1.2 servers ignore the supported versions extension if it exists in the client hello. This means that the client protocol version is always determined by the client hello version rather than a version in the supported versions extension. This can lead to incorrect reporting of the client protocol version from the s2n_connection_get_client_protocol_version() API on TLS 1.2 servers. For example, a TLS 1.3 client that sends a supported versions extension containing TLS 1.3 would be reported as TLS 1.2 on TLS 1.2 servers, and TLS 1.3 on TLS 1.3 servers.

This PR allows the supported versions extension to be processed on TLS 1.2 servers before returning a value from the client protocol version getter to ensure that the correct client protocol version is reported.

Call-outs:

An alternative to this PR would be to update the client_protocol_version field on the connection based on the supported versions extension and use this value for protocol version selection, similar to TLS 1.3 servers. However, this could result in a behavior change, so it was decided to not make this change for now. This is discussed in #4240.

Testing:

New unit tests to test the new behavior of s2n_connection_get_client_protocol_version(). Also, there weren't any tests for the other protocol version getters so I added tests for those as well.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions github-actions bot added the s2n-core team label Oct 17, 2023
@goatgoose goatgoose force-pushed the supported-versions-fix-3 branch 2 times, most recently from ec4d8e2 to 2b3c9b2 Compare October 17, 2023 20:54
…rsions extension

Squashed commit of the following:

commit 2b3c9b2
Author: Sam Clark <3758302+goatgoose@users.noreply.github.com>
Date:   Tue Oct 17 16:01:14 2023 -0400

    fixes

commit 3e27ec8
Author: Sam Clark <3758302+goatgoose@users.noreply.github.com>
Date:   Tue Oct 17 15:31:45 2023 -0400

    update integ test to expect TLS 1.3

commit b66a361
Author: Sam Clark <3758302+goatgoose@users.noreply.github.com>
Date:   Tue Oct 17 11:44:41 2023 -0400

    fixes

commit c3b120b
Author: Sam Clark <3758302+goatgoose@users.noreply.github.com>
Date:   Tue Oct 17 11:38:17 2023 -0400

    TLS 1.2 fallback tests

commit 4245e3e
Author: Sam Clark <3758302+goatgoose@users.noreply.github.com>
Date:   Mon Oct 16 16:54:54 2023 -0400

    add test for client getters

commit 7e8e734
Author: Sam Clark <3758302+goatgoose@users.noreply.github.com>
Date:   Mon Oct 16 14:35:05 2023 -0400

    add test for server getters with no supported versions extension

commit 9f63693
Author: Sam Clark <3758302+goatgoose@users.noreply.github.com>
Date:   Mon Oct 16 14:09:27 2023 -0400

    test for protocol getters on server with a received supported versions extension

commit 08d3d78
Author: Sam Clark <3758302+goatgoose@users.noreply.github.com>
Date:   Mon Oct 16 10:29:51 2023 -0400

    add supported versions RFC exception for legacy client hello version

commit 4026318
Author: Sam Clark <3758302+goatgoose@users.noreply.github.com>
Date:   Fri Oct 13 11:37:45 2023 -0400

    parse supported versions extension in getter

commit 4ee56eb
Author: Sam Clark <3758302+goatgoose@users.noreply.github.com>
Date:   Fri Oct 13 10:17:13 2023 -0400

    refactor supported versions process
@goatgoose goatgoose force-pushed the supported-versions-fix-3 branch from 2b3c9b2 to 78bd1a7 Compare October 17, 2023 20:58
@goatgoose goatgoose marked this pull request as ready for review October 17, 2023 22:19
tests/unit/s2n_protocol_version_getter_test.c Outdated Show resolved Hide resolved
tests/unit/s2n_protocol_version_getter_test.c Outdated Show resolved Hide resolved
tests/unit/s2n_protocol_version_getter_test.c Outdated Show resolved Hide resolved
tests/unit/s2n_protocol_version_getter_test.c Outdated Show resolved Hide resolved
@goatgoose goatgoose requested a review from maddeleine October 18, 2023 20:01
tls/extensions/s2n_client_supported_versions.c Outdated Show resolved Hide resolved
tests/unit/s2n_get_protocol_version_test.c Outdated Show resolved Hide resolved
tests/unit/s2n_get_protocol_version_test.c Outdated Show resolved Hide resolved
tests/unit/s2n_get_protocol_version_test.c Outdated Show resolved Hide resolved
@goatgoose goatgoose force-pushed the supported-versions-fix-3 branch from 407470c to 949cd55 Compare October 20, 2023 22:18
@goatgoose goatgoose requested a review from lrstewart October 20, 2023 22:23
@goatgoose goatgoose requested a review from lrstewart October 24, 2023 16:50
@goatgoose goatgoose enabled auto-merge (squash) October 24, 2023 16:58
@goatgoose goatgoose merged commit e9d48da into aws:main Oct 24, 2023
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Different return value from s2n_connection_get_client_protocol_version depending on security_policy configured
3 participants