krishvishal opened a new pull request, #2887:
URL: https://github.com/apache/iggy/pull/2887

   Closes #2878
   
   ## Rationale
   
   Consensus headers previously stored `Command2` and `Operation` enum values 
directly in repr(C) structs. This is unsound for consensus header  structs: 
arbitrary bytes from the network are reinterpreted as enum discriminants 
without validation, which is undefined behavior in Rust.
   
   ## What changed?
   
     - Change `command` and `operation` fields in all consensus headers from 
enum types (`Command2`, `Operation`) to raw `u8` to prevent UB when 
interpreting untrusted bytes from the network as Rust enum discriminants.
     - Add `TryFrom<u8>` impls for `Command2` and `Operation` with proper error 
variants (`InvalidCommandByte`, `InvalidOperationByte`) in `ConsensusError`.
     - Fix `dispatch_request` to return `Result<Receiver<R>, ConsensusError>` 
instead of silently dropping unrecognized messages.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to