CI Fix: fix flaky ECH test#10519
Open
sebastian-carpenter wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses flakiness in the TLS 1.3 ECH API test test_wolfSSL_Tls13_ECH_ch2_decrypt_error by replacing a raw byte-pattern scan for 0xFE0D with structured parsing of the ClientHello extensions list to locate TLSXT_ECH deterministically.
Changes:
- Added
ech_seek_extensions()/ech_find_extension()helpers to parse a ClientHello and locate a specific extension by type. - Updated
test_wolfSSL_Tls13_ECH_ch2_decrypt_error()to corrupt the ECH ciphertext by first finding the actual ECH extension in the parsed extensions list. - Deduplicated ECH tamper helpers by reusing the new extension-finding logic.
Comments suppressed due to low confidence (1)
tests/api.c:16190
idxis initialized asRECORD_HEADER_SZ + HANDSHAKE_HEADER_SZand passed toech_find_extension()under the assumption thats_buffstarts with a single Handshake record containing CH2. In the memio harness, a single write can contain multiple TLS records (e.g., TLS 1.3 middlebox-compat ChangeCipherSpec followed by ClientHello), which would make this offset point into the wrong record and cause the extension parser to read incorrect data (potentially reintroducing flakiness or even out-of-bounds reads). Consider locating the ClientHello handshake message by iterating the TLS record(s) ins_buff(skipping non-handshake records like CCS) before callingech_find_extension().
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
test_wolfSSL_Tls13_ECH_ch2_decrypt_errorflakes out after a couple thousand iterations. Previously this test was seeking the first0xFE0Dbytes (TLSXT_ECH) and would then tamper with the 14th byte after that marker. Every couple thousand iterations0xFE0Dwould show up before the extension marker and cause an incorrect failure.Updated the test to iterate along the extensions list and find TLSXT_ECH.
Testing
Reproduced the error three times within 10000 iterations. Tested the fix with 20000 iterations.
Checklist