refactor(rdpeusb): seperate raw and validated InternalIoControl#1403
Merged
Benoît Cortier (CBenoit) merged 1 commit intoJul 2, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors RDPEUSB INTERNAL_IO_CONTROL handling to keep the wire PDU (InternalIoControl) as a lossless representation (decoding unknown IOCTL codes and variable buffers), and to centralize semantic validation at the state-machine boundary via conversion into a backend-facing request type.
Changes:
- Relax
InternalIoControlPDU decode/encode to preserve rawioctl_code,input_buffer, andoutput_buffer_sizewithout rejecting unknown values. - Replace backend-facing
InternalIoControlPacketfrom a raw-parameter struct to a validated enum, and move validation intoTryFrom<InternalIoControl>. - Remove server-side validation of internal IO control request buffers/sizes and rely on the validated packet->PDU conversion.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| crates/ironrdp-rdpeusb/src/server.rs | Removes local INTERNAL_IO_CONTROL validation and uses PDU output size for pending-IO bookkeeping. |
| crates/ironrdp-rdpeusb/src/pdu/usb_dev/mod.rs | Makes InternalIoControl wire type lossless (raw IOCTL + variable buffer) and adjusts size checks/encoding. |
| crates/ironrdp-rdpeusb/src/io/mod.rs | Introduces validated InternalIoControlPacket enum and conversion/validation from raw PDU. |
| crates/ironrdp-rdpeusb/src/client.rs | Converts incoming InternalIoControl PDUs to validated backend packets via try_into(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Keep INTERNAL_IO_CONTROL as a lossless wire representation so unknown IOCTL codes and buffer fields remain decodable. Convert raw PDUs into supported backend requests at the state-machine boundary. This centralizes semantic validation and makes invalid outbound requests unrepresentable. Signed-off-by: uchouT <i@uchout.moe>
56eff67 to
2af5d70
Compare
Benoît Cortier (CBenoit)
approved these changes
Jul 2, 2026
Benoît Cortier (CBenoit)
left a comment
Member
There was a problem hiding this comment.
LGTM! Thank you!
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.
Keep INTERNAL_IO_CONTROL as a lossless wire representation so unknown IOCTL codes and buffer fields remain decodable.
Convert raw PDUs into supported backend requests at the state-machine boundary. This centralizes semantic validation and makes invalid outbound requests unrepresentable.