Repository navigation
Stop logging pairing secrets; fix frame splitting in LengthPrefixedByteArrayProcessor - #204
Merged
Merged
Conversation
Remove DEBUG log statements that printed the SRP shared secret K, the HKDF-derived encryption key and the raw M5 auth tag / message data. No logic changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Read the length of each frame at the current position instead of always at the start of the read, so several frames of different length in one read are split correctly. - Clear the stored first length byte once it has been used, and do not take the fast path while such a byte is pending, so a read that ends after the first length byte is handled by step(). Adds tests that lock in the existing behaviour (single frame, several frames in one read, a frame split across two reads) plus regression tests for the two cases above. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Two small fixes, one commit each. They don't change behavior for setups that already work.
1. Stop logging pairing secrets (
ExchangeHandler)Removes the four DEBUG log statements that printed the SRP shared secret K, the HKDF-derived encryption key and the raw M5 auth tag and message data. No logic changes.
2. Fix frame splitting (
LengthPrefixedByteArrayProcessor)The change is three lines:
data[0]/data[1]instead ofdata[pos]/data[pos + 1]. When several frames of different lengths arrive in one read, every frame was split using the length of the first one.firstLengthByteBuffer) was never cleared, and the fast path could run while it was pending. It is now cleared once used, and the fast path is skipped while it is set, so the stored byte always goes throughstep().New tests in
LengthPrefixedByteArrayProcessorTest:[21,21,21,21,21,21][21,116][21][21,56]mvn -B packageon JDK 11: 21 tests, 0 failures.Not addressed here
bufferempty. The next read can then take the fast path and read the first two payload bytes as a length. With encrypted data this is rare.PairSetupRequeststill DEBUG-logs the encrypted M5 data and auth tag.Before release
Not yet tested with a real device. Smoke-test with a real iPhone or Home hub: pair, control an accessory, check that events arrive, and reconnect.
🤖 Generated with Claude Code