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

Handle TLS 1.3 closure alerts consistently #9566

Open
wants to merge 2 commits into
base: maint
Choose a base branch
from

Conversation

dotsimon
Copy link
Contributor

RFC 8446 section 6.2 states a pre-connection user_canceled alert should be followed by a close_notify alert. In these states, these alerts may be sent in the clear.

This PR fixes the handling of both alerts by:

  1. Ignoring the alert level which is unused in TLS 1.3
  2. Returning close_notify alert as well as user_canceled

This PR also lowers the logging level of the user_canceled alert since this is a perfectly valid client action which should not spam the server log.

Copy link
Contributor

github-actions bot commented Mar 10, 2025

CT Test Results

    2 files     66 suites   48m 7s ⏱️
  811 tests   766 ✅  45 💤 0 ❌
3 902 runs  3 107 ✅ 795 💤 0 ❌

Results for commit fe9e907.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@IngelaAndin IngelaAndin added the team:PS Assigned to OTP team PS label Mar 11, 2025
@IngelaAndin IngelaAndin self-assigned this Mar 11, 2025
{#ssl_tls{type = ?ALERT,
version = ?TLS_1_3, %% Internally use real version
fragment = <<?FATAL,?USER_CANCELED>>}, ConnectionStates0};
fragment = <<?WARNING,ClosureAlert>>}, ConnectionStates0};
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not agree with this change. This only happens when the handshake is canceled before the TLS-1.3 handshake encryption has come in to play, which means that this would require a server to wait for a close notify or handshake timeout, and that could be used to try to DoS-attack. I think we should only change that we should not care which level was sent as long as it is one of WARNING or FATAL (otherwise it is not a valid packet), and we should keep fatal here so that this is always ends up as immediate closure.

Copy link
Contributor

Choose a reason for hiding this comment

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

Note that although TLS-1.3 does not care about the level on protocol level we can use this legacy field to signal immediate closure here instead inventing a new mechanism to deal with this corner case.

Copy link
Contributor

@IngelaAndin IngelaAndin left a comment

Choose a reason for hiding this comment

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

Log level adjustment I think is ok, however I think we should do the other change differently se separate comment.

@IngelaAndin IngelaAndin added the waiting waiting for changes/input from author label Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team:PS Assigned to OTP team PS waiting waiting for changes/input from author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants