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

Raise a TLS alert if parsing a message causes a BufferReadError #436

Merged
merged 1 commit into from
Dec 28, 2023

Conversation

jlaine
Copy link
Contributor

@jlaine jlaine commented Dec 28, 2023

While parsing TLS messages, if a BufferReadError occurs, it is a sign we are unable to parse the message because it is malformed. In such an event raise a AlertDecodeError exception so that the connection gets shut down with a TLS error.

@jlaine jlaine requested a review from rthalley December 28, 2023 16:40
Copy link

codecov bot commented Dec 28, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5772246) 100.00% compared to head (9616e13) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #436   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           25        25           
  Lines         4864      4868    +4     
=========================================
+ Hits          4864      4868    +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jlaine
Copy link
Contributor Author

jlaine commented Dec 28, 2023

If tls.Context.handle_message raises any subclass of tls.Alert, the connection gets shut down properly:

except tls.Alert as exc:

While parsing TLS messages, if a `BufferReadError` occurs, it is a sign
we are unable to parse the message because it is malformed. In such an
event raise a `AlertDecodeError` exception so that the connection gets
shut down with a TLS error.
@jlaine jlaine merged commit ac18ff6 into aiortc:main Dec 28, 2023
29 checks passed
@jlaine jlaine deleted the tls-decode-error branch December 28, 2023 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant