test(dgw): cover credential injection reconnect hops - #1938
Open
irvingouj@Devolutions (irvingoujAtDevolution) wants to merge 9 commits into
Open
Conversation
Contributor
Author
|
Implementation notes:
Note LLM-assisted content (no human feedback). |
irvingouj@Devolutions (irvingoujAtDevolution)
requested a review
from Benoît Cortier (CBenoit)
August 20, 2026 19:57
Contributor
There was a problem hiding this comment.
Pull request overview
Adds process-level coverage for Gateway RDP credential injection.
Changes:
- Tests NTLM injection, reconnect attempts, expiration, and fail-closed routing.
- Adds mock KDC and CredSSP integration coverage.
- Extends test configuration and dependencies.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
Cargo.lock |
Locks new test dependencies. |
testsuite/Cargo.toml |
Adds Kerberos and IronRDP test dependencies. |
testsuite/src/dgw_config.rs |
Exposes Kerberos injection test configuration. |
testsuite/tests/cli/dgw/mod.rs |
Registers new test modules. |
testsuite/tests/cli/dgw/cred_injection.rs |
Adds credential injection lifecycle tests. |
testsuite/tests/cli/dgw/cred_injection_kdc.rs |
Adds mock KDC/CredSSP integration testing. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| target.wait_payloads(1).await?; | ||
| drop(first); | ||
|
|
||
| let _second = connect_rdp_client(gateway.config.tcp_port(), &token).await?; |
Comment on lines
+160
to
+175
| let Ok((mut stream, _)) = listener.accept().await else { | ||
| break; | ||
| }; | ||
| accepted_task.fetch_add(1, Ordering::SeqCst); | ||
| let payloads = Arc::clone(&payloads_task); | ||
| tokio::spawn(async move { | ||
| let mut buf = vec![0u8; 4096]; | ||
| // CredSSP cert generation can delay the rewritten X.224 CR. | ||
| if let Ok(Ok(n)) = tokio::time::timeout(Duration::from_secs(30), stream.read(&mut buf)).await | ||
| && n > 0 | ||
| { | ||
| payloads.lock().expect("payload mutex").push(buf[..n].to_vec()); | ||
| } | ||
| // Keep the accepted socket open so the proxy can finish writing the CR. | ||
| tokio::time::sleep(Duration::from_secs(30)).await; | ||
| }); |
Comment on lines
+569
to
+572
| let tls = connect_ntlm_client(gateway.config.tcp_port(), &token).await?; | ||
| complete_ntlm_credssp(tls) | ||
| .await | ||
| .context("Gateway-facing NTLM CredSSP")?; |
| Ok(()) | ||
| } | ||
|
|
||
| const CERT_PEM: &str = r#"-----BEGIN CERTIFICATE----- |
|
|
||
| [dev-dependencies] | ||
| base64 = "0.23" | ||
| ironrdp-acceptor = "0.10" |
Copilot started reviewing on behalf of
irvingouj@Devolutions (irvingoujAtDevolution)
August 20, 2026 23:39
View session
irvingouj@Devolutions (irvingoujAtDevolution)
force-pushed
the
test/cred-injection-reconnect-e2e
branch
from
August 21, 2026 18:01
db4a034 to
65099a9
Compare
Add process-level tests for DVLS-like preflight, first inject, jet_reuse reconnect, fail-closed missing mappings, and synthetic KDC generation reuse. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Clippy separated_literal_suffix failed CI lints on the stacked reconnect tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Drive CredSSP through a TCP kdc crate and IronRDP acceptor so target-leg Kerberos injection is proven, not just log-matched. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Prove both CredSSP hops against mock KDC/RDP, NTLM CredSSP both legs, and Kerberos fail-closed when the password, KDC, or krb_kdc is wrong. Token-cache jet_reuse still needs signed JWTs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Decode AS-REQ/TGS-REQ on the mock KDC (cname, realm, TERMSRV/localhost), record CredSSP Finished account names and X.224 cookies, and require /jet/KdcProxy AS-REP plus TGS-REP. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Routing tests now decode X.224 Cookie instead of raw-byte search. Client-leg Kerberos asserts synthetic-KDC AS-REQ cname. Fail-closed Kerberos paths require inject-started then no Finished identity. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Decode X.224 cookies, KdcProxy AS/TGS principals, and attribute KDC-down TCP to Gateway via a separate refusing listener. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Checkout-before-connect on the stack below lets the fail-closed path prove accepted==0. Issue: DGW-1900 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pin the public CLI release and complete NTLM and Kerberos target CredSSP over ws://127.0.0.1/jet/rdp. Issue: DGW-1900 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
irvingouj@Devolutions (irvingoujAtDevolution)
force-pushed
the
test/cred-injection-reconnect-e2e
branch
from
August 21, 2026 19:15
f3aa094 to
2865eda
Compare
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.
Add process-level Gateway tests for DVLS-like preflight, TCP and RDCleanPath injection, NTLM and Kerberos CredSSP, fail-closed missing mappings, and missing
krb_kdcwithout dialing the target.RDCleanPath cases drive the public
ironrdp-agent0.1.0 CLI overws://127.0.0.1/jet/rdp.Issue: DVLS-14697