XGameRuntime: match intermediate and issuing CA pins across certificate chains #1503

Open
github-bot wants to merge 2 commits from github-bot/gh-1503 into main AGit
Owner

@⁠hajduzsolt on GitHub · 2026-11-24 17:02 UTC · original
hajduzsolt:fix/xnetworking-issuer-pin-chain → main · +114 −1 · 1 files · 2 commits · open

Runtime fix verified with unit tests and RX 9070 XT smoke run.

What is in it

  • crates/xcl/src/hle/xgameruntime/networking.rs: in check_thumbprints, search chain_sha1s.get(1..) for thumbprint_type: 1 (XNetworkingThumbprintType::Issuer) so pins against any intermediate CA or issuing certificate in the chain match.
  • crates/xcl/src/hle/xgameruntime/networking.rs: add unit test issuer_pin_matches_any_intermediate_or_issuing_cert_in_chain verifying multi-intermediate certificate chains (depth 4) with leaf, multiple intermediate CAs, and root pins.

Tested

  • hardware (GPU + driver, CPU), Windows build, Rust version, debug / release: AMD Radeon RX 9070 XT (driver 24.12.1), AMD Ryzen 7 9800X3D, Windows 11 10.0.26100, Rust 1.85.0 (stable-x86_64-pc-windows-msvc), debug (cargo test)
  • cargo test --workspace -- --test-threads=2: 744 passed, 0 failed, 12 ignored
  • cargo test -p xcl --lib hle::xgameruntime::networking::tests: 8 passed, 0 failed

Regression run

main:

xcl-smoke v1
commit: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0
gpu: AMD Radeon RX 9070 XT
title: A newer retail game
seconds: 60
exit: 0x0
frames shown: 1594 (PresentX 1594)
presents per 2 s (last 3): 49 48 14
device removals: 0
crashes: 0
peak commit: 20195 MB

PR:

xcl-smoke v1
commit: 739a6c64b1cd8e25824fa35b3c5aaf3fdc04a688
gpu: AMD Radeon RX 9070 XT
title: A newer retail game
seconds: 60
exit: 0x0
frames shown: 1680 (PresentX 1680)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14836 MB

Not tested

  • Physical Xbox Live console services (offline clean-room stub test environment)

AI use

  • Antigravity (Gemini 4 Hydrogen, low): static analysis of certificate chain verification, implementation of intermediate issuer pin matching in networking.rs, synthetic unit test authoring, and workspace test validation.
**@⁠hajduzsolt** on GitHub · 2026-11-24 17:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/1503) `hajduzsolt:fix/xnetworking-issuer-pin-chain` → `main` · +114 −1 · 1 files · 2 commits · open Runtime fix verified with unit tests and RX 9070 XT smoke run. **What is in it** - `crates/xcl/src/hle/xgameruntime/networking.rs`: in `check_thumbprints`, search `chain_sha1s.get(1..)` for `thumbprint_type: 1` (`XNetworkingThumbprintType::Issuer`) so pins against any intermediate CA or issuing certificate in the chain match. - `crates/xcl/src/hle/xgameruntime/networking.rs`: add unit test `issuer_pin_matches_any_intermediate_or_issuing_cert_in_chain` verifying multi-intermediate certificate chains (depth 4) with leaf, multiple intermediate CAs, and root pins. **Tested** - hardware (GPU + driver, CPU), Windows build, Rust version, debug / release: AMD Radeon RX 9070 XT (driver 24.12.1), AMD Ryzen 7 9800X3D, Windows 11 10.0.26100, Rust 1.85.0 (stable-x86_64-pc-windows-msvc), debug (`cargo test`) - `cargo test --workspace -- --test-threads=2`: 744 passed, 0 failed, 12 ignored - `cargo test -p xcl --lib hle::xgameruntime::networking::tests`: 8 passed, 0 failed **Regression run** main: ``` xcl-smoke v1 commit: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0 gpu: AMD Radeon RX 9070 XT title: A newer retail game seconds: 60 exit: 0x0 frames shown: 1594 (PresentX 1594) presents per 2 s (last 3): 49 48 14 device removals: 0 crashes: 0 peak commit: 20195 MB ``` PR: ``` xcl-smoke v1 commit: 739a6c64b1cd8e25824fa35b3c5aaf3fdc04a688 gpu: AMD Radeon RX 9070 XT title: A newer retail game seconds: 60 exit: 0x0 frames shown: 1680 (PresentX 1680) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14836 MB ``` **Not tested** - Physical Xbox Live console services (offline clean-room stub test environment) **AI use** - Antigravity (Gemini 4 Hydrogen, low): static analysis of certificate chain verification, implementation of intermediate issuer pin matching in `networking.rs`, synthetic unit test authoring, and workspace test validation.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:55:50 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 18:53 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 18:53 UTC · [original](https://github.com/xcl-dev/xcl/pull/1503#issuecomment-7141301522) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
Author
Owner

@⁠hajduzsolt on GitHub · 2026-11-24 19:15 UTC · original

Thanks for catching this. Issuer pins now search only certificates between the leaf and root; tests cover root exclusion and short or empty chains. cargo test --workspace -- --test-threads=2 passed (723 library tests passed, 21 ignored).

**@⁠hajduzsolt** on GitHub · 2026-11-24 19:15 UTC · [original](https://github.com/xcl-dev/xcl/pull/1503#issuecomment-7141825324) Thanks for catching this. Issuer pins now search only certificates between the leaf and root; tests cover root exclusion and short or empty chains. `cargo test --workspace -- --test-threads=2` passed (723 library tests passed, 21 ignored).
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 05:26 UTC · original

Empirical test report (739a6c64)

Tested #1503 at commit 739a6c64b1cd8e25824fa35b3c5aaf3fdc04a688 from a clean, detached checkout.

Hardware / environment

  • Windows x64 build 10.0.26200.9974 on an AMD CPU (family 23, model 113, stepping 0, 12 logical processors).
  • rustc 1.100.0 (0ef1bc386 2026-11-09), host x86_64-pc-windows-msvc. DXC reported 1.9.2609.5 (01b62ad47). Cargo used the unoptimized test profile with debug info and incremental compilation disabled.
  • The focused run set XCL_ADAPTER=NONE_CPU_ONLY and RUST_TEST_NOCAPTURE=1. Both commands ran outside Invoke-ArcTest.ps1 without acquiring the Arc GPU mutex.

Commands and results

  • cargo test --workspace --no-run exited 0 and built the workspace test binaries.
  • cargo test -p xcl --lib hle::xgameruntime::networking::tests::issuer_pin_matches_any_intermediate_or_issuing_cert_in_chain -- --nocapture --exact exited 0. The log recorded 1 passed, 0 failed, 0 ignored, 0 skipped, and 743 filtered out.

Observed behavior

The regression test passed with synthetic 20-byte thumbprints in a leaf-to-root chain. An issuer pin matched either of two intermediate certificates. Issuer pins targeting the leaf, root, or an unrelated certificate produced a mismatch. A root thumbprint supplied as an issuer pin also failed to match in a leaf-and-root chain, a one-entry chain, and an empty chain. Leaf and root pins matched their respective endpoints.

Not tested

The full GPU workspace suite, game smoke runs, and live TLS certificate verification were omitted. The focused test covered the in-memory thumbprint matcher.

AI use

Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr1503-focused.log and published.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 05:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/1503#issuecomment-7153770774) ### Empirical test report (739a6c64) Tested #1503 at commit `739a6c64b1cd8e25824fa35b3c5aaf3fdc04a688` from a clean, detached checkout. **Hardware / environment** - Windows x64 build `10.0.26200.9974` on an AMD CPU (family 23, model 113, stepping 0, 12 logical processors). - `rustc 1.100.0 (0ef1bc386 2026-11-09)`, host `x86_64-pc-windows-msvc`. DXC reported `1.9.2609.5 (01b62ad47)`. Cargo used the unoptimized test profile with debug info and incremental compilation disabled. - The focused run set `XCL_ADAPTER=NONE_CPU_ONLY` and `RUST_TEST_NOCAPTURE=1`. Both commands ran outside `Invoke-ArcTest.ps1` without acquiring the Arc GPU mutex. **Commands and results** - `cargo test --workspace --no-run` exited 0 and built the workspace test binaries. - `cargo test -p xcl --lib hle::xgameruntime::networking::tests::issuer_pin_matches_any_intermediate_or_issuing_cert_in_chain -- --nocapture --exact` exited 0. The log recorded **1 passed, 0 failed, 0 ignored, 0 skipped**, and 743 filtered out. **Observed behavior** The regression test passed with synthetic 20-byte thumbprints in a leaf-to-root chain. An issuer pin matched either of two intermediate certificates. Issuer pins targeting the leaf, root, or an unrelated certificate produced a mismatch. A root thumbprint supplied as an issuer pin also failed to match in a leaf-and-root chain, a one-entry chain, and an empty chain. Leaf and root pins matched their respective endpoints. **Not tested** The full GPU workspace suite, game smoke runs, and live TLS certificate verification were omitted. The focused test covered the in-memory thumbprint matcher. **AI use** Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against `pr1503-focused.log` and published.
Author
Owner

@⁠gut0to on GitHub · 2026-11-24 17:16 UTC · original
On crates/xcl/src/hle/xgameruntime/networking.rs line 433 (outdated):

@@ -430,7 +430,7 @@ unsafe fn check_thumbprints(security_info: *const XNetworkingSecurityInformation
         let expected = std::slice::from_raw_parts(tp.thumbprint_buffer, SHA1_LEN);
         let matched = match tp.thumbprint_type {
             0 => chain_sha1s.first().is_some_and(|c| c.as_slice() == expected),
-            1 => chain_sha1s.get(1).is_some_and(|c| c.as_slice() == expected),
+            1 => chain_sha1s.get(1..).is_some_and(|ca_certs| ca_certs.iter().any(|c| c.as_slice() == expected)),

This range includes the terminal root, and the test below accepts that root as an Issuer pin. The API defines Root (type 2) separately from Issuer (type 1), with Issuer covering issuer or intermediate certificates. Please exclude the terminal root from type-1 matching and handle it only through type 2. AI-assisted review: I verified this against the XNetworkingThumbprintType documentation and the new test.

**@⁠gut0to** on GitHub · 2026-11-24 17:16 UTC · [original](https://github.com/xcl-dev/xcl/pull/1503#discussion_r4683789069) On `crates/xcl/src/hle/xgameruntime/networking.rs` line 433 (outdated): ```diff @@ -430,7 +430,7 @@ unsafe fn check_thumbprints(security_info: *const XNetworkingSecurityInformation let expected = std::slice::from_raw_parts(tp.thumbprint_buffer, SHA1_LEN); let matched = match tp.thumbprint_type { 0 => chain_sha1s.first().is_some_and(|c| c.as_slice() == expected), - 1 => chain_sha1s.get(1).is_some_and(|c| c.as_slice() == expected), + 1 => chain_sha1s.get(1..).is_some_and(|ca_certs| ca_certs.iter().any(|c| c.as_slice() == expected)), ``` This range includes the terminal root, and the test below accepts that root as an Issuer pin. The API defines Root (type 2) separately from Issuer (type 1), with Issuer covering issuer or intermediate certificates. Please exclude the terminal root from type-1 matching and handle it only through type 2. AI-assisted review: I verified this against the XNetworkingThumbprintType documentation and the new test.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 05:40 UTC · original

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-26 05:40 UTC · [original](https://github.com/xcl-dev/xcl/pull/1503#issuecomment-7183700607) Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
Author
Owner

@⁠upipibi on GitHub · 2026-11-26 05:42 UTC · original

NVIDIA test report for 739a6c6: RTX 3070 8 GB (Ampere, driver 616.56), Windows 11 26100, Rust 1.100.0, debug.

  • cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4 (the hle::xaudio2 tests hang on this machine, on main too):
  • this PR: 714 passed, 0 failed, 21 ignored; 2 SKIPPED lines (both no wave64). The new issuer_pin_matches_any_intermediate_or_issuing_cert_in_chain passes.

Lib tests only; no title run.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠upipibi** on GitHub · 2026-11-26 05:42 UTC · [original](https://github.com/xcl-dev/xcl/pull/1503#issuecomment-7183731639) NVIDIA test report for `739a6c6`: RTX 3070 8 GB (Ampere, driver 616.56), Windows 11 26100, Rust 1.100.0, debug. - `cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4` (the `hle::xaudio2` tests hang on this machine, on `main` too): - this PR: 714 passed, 0 failed, 21 ignored; 2 SKIPPED lines (both `no wave64`). The new `issuer_pin_matches_any_intermediate_or_issuing_cert_in_chain` passes. Lib tests only; no title run. AI-assisted (Claude Code, Claude Opus 5.5).
Author
Owner

@⁠gut0to on GitHub · 2026-11-24 17:16 UTC · original · reviewed

AI-assisted review (GPT-6): I checked this behavior against the XNetworkingThumbprintType documentation and the new test.

**@⁠gut0to** on GitHub · 2026-11-24 17:16 UTC · [original](https://github.com/xcl-dev/xcl/pull/1503#pullrequestreview-6043999803) · **reviewed** AI-assisted review (GPT-6): I checked this behavior against the XNetworkingThumbprintType documentation and the new test.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1503/head:github-bot/gh-1503'
git switch 'github-bot/gh-1503'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1503'
git switch 'github-bot/gh-1503'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1503'
git switch 'github-bot/gh-1503'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1503'
git switch 'main'
git merge --squash 'github-bot/gh-1503'
git switch 'main'
git merge --ff-only 'github-bot/gh-1503'
git switch 'main'
git merge 'github-bot/gh-1503'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.