Refactor RDCleanPath credential injection to reduce duplication and improve encapsulation #1618
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.
Addresses feedback on PR #1614 regarding code organization, duplication, and API surface of the credential injection implementation.
Changes
Reduce API surface: Changed
pub→pub(crate)for CredSSP functions (perform_credssp_with_server,perform_credssp_with_client,extract_tls_server_public_key,get_cached_gateway_public_key,GetPeerCert) to keep implementation details internalOptimize trait bounds: Removed unnecessary
'staticlifetime fromhandle()- onlyAsyncRead + AsyncWrite + Unpin + Send + SyncrequiredEliminate duplication: Removed redundant authorization, connection mode validation, and session ID recording in
handle_with_credential_injection()- now delegated toprocess_cleanpath()Extract CredSSP MITM orchestration: Created
perform_credssp_mitm()inrdp_proxymodule to encapsulate stream framing, parallel CredSSP execution, and leftover byte forwardingAvoid token re-extraction: Use
as_deref()instead of re-parsing token from PDUBefore/After
Before:
After:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.