Add unsecure exchange initiation#385
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request provides the foundational components for initiating unsecured communication exchanges within the Matter protocol. It enables controllers to establish plain-text sessions with devices, which is a prerequisite for secure pairing mechanisms like PASE and CASE. The changes include new API methods for session and exchange creation, along with comprehensive testing to validate the functionality and ensure its reliability in various scenarios. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces the necessary components for initiating unsecured exchanges, a crucial step for PASE and CASE initiator flows, including Exchange::initiate_unsecured() and its supporting functions in TransportMgr, along with a new integration test, exchangetest. A critical security concern has been identified regarding the use of non-cryptographically secure randomness for initializing message counters in new unsecured sessions, which violates the Matter specification's requirement for unpredictable message counters. Furthermore, opportunities for improvement exist concerning error handling robustness and code clarity.
|
PR #385: Size comparison from 96b3d51 to 7395920 Full report (8 builds for (core), dimmable-light, onoff-light, onoff-light-bt, speaker)
|
|
PR #385: Size comparison from 96b3d51 to de999cd Full report (8 builds for (core), dimmable-light, onoff-light, onoff-light-bt, speaker)
|
de999cd to
a040c0c
Compare
|
PR #385: Size comparison from 96b3d51 to a040c0c Full report (8 builds for (core), dimmable-light, onoff-light, onoff-light-bt, speaker)
|
ivmarkov
left a comment
There was a problem hiding this comment.
I do have some smaller nits, like e.g. the names of the newly introduced methods in TransportMgr and Exchange, but these are not so important so I have not even noted them.
Most important is to clarify why we need exchangetest to be part of the xtask test suite in the first place.
Checking rs-matter v0.1.1
(/home/runner/work/rs-matter/rs-matter/rs-matter)
error: this `if` has identical blocks
--> rs-matter/src/dm/types/cluster.rs:466:26
|
466 | if index > 0 {
| __________________________^
467 | | defmt::write!(f, ", {}", attr);
468 | | } else {
| |_____________^
|
note: same as this
--> rs-matter/src/dm/types/cluster.rs:468:20
|
468 | } else {
| ____________________^
469 | | defmt::write!(f, "{}", attr);
470 | | }
| |_____________^
= help: for further information visit
https://rust-lang.github.io/rust-clippy/rust-1.94.0/index.html#if_same_then_else
= note: `-D clippy::if-same-then-else` implied by `-D warnings`
= help: to override `-D warnings` add
`#[allow(clippy::if_same_then_else)]`
error: this `if` has identical blocks
--> rs-matter/src/dm/types/cluster.rs:475:26
|
475 | if index > 0 {
| __________________________^
476 | | defmt::write!(f, ", {}", cmd);
477 | | } else {
| |_____________^
|
note: same as this
--> rs-matter/src/dm/types/cluster.rs:477:20
|
477 | } else {
| ____________________^
478 | | defmt::write!(f, "{}", cmd);
479 | | }
| |_____________^
= help: for further information visit
https://rust-lang.github.io/rust-clippy/rust-1.94.0/index.html#if_same_then_else
a040c0c to
b9b4d31
Compare
|
PR #385: Size comparison from e9314f9 to b9b4d31 Full report (8 builds for (core), dimmable-light, onoff-light, onoff-light-bt, speaker)
|
Thanks for the feedback! Additionally, I've pushed a lint fix in b9b4d31 (seems toolchain update made it visible now) this was done to unblock CI for this PR, if you prefer it fixed differently / outside this PR (since it is technically unrelated to the PR content) let me know so I can drop it. Thanks! |
This PR adds the building blocks to initiate an unsecured exchange, a prerequisite for PASE and CASE initiator flows (a part of #368).
Exchange::initiate_unsecured()is the public entry point for opening a new unsecured exchange.cargo xtask exchangetest) is added to verify the exchange, it: starts a Matter example device, opens an unsecured exchange, sends a PASE PBKDFParamRequest to the device, and asserts that the device responds.exchange-tests.yml)is added to run the integration test.