xnetworking: fail closed on cert verification errors and malformed pin metadata #77
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!77
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/77/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@certified-retart on GitHub · 2026-11-23 01:22 UTC · original
certified-retart:fix/xnetworking-cert-verify→main· +198 −32 · 1 files · 1 commits · merged 2026-11-23 10:29 UTCSummary
Hardens
XNetworkingVerifyServerCertificateandverify_thumbprintsincrates/xcl/src/hle/xgameruntime/networking.rsto fail closed on missing URLs/hostnames, zeroGetLastError()codes, plain-HTTP loopback with pins, and malformed pin metadata (addressing the certificate verification items indocs/xnetworking-rust-review.md).What changed
WINHTTP_OPTION_URLfailure, odd/empty/oversized byte counts, or empty extracted host now fail closed instead of proceeding with a nullserver_name(which disabled SSL hostname verification).CertGetCertificateChain(or null chain) and failedCertVerifyCertificateChainPolicynow mapGetLastError() == 0toE_FAILviawin32_failure_hrrather than turninghresult_from_win32(0)intoS_OK.status.errorvalues fromCertVerifyCertificateChainPolicyare converted viapolicy_status_hrso they never become positiveHRESULTs.validate_thumbprint_metadata/check_thumbprints):thumbprint_count > 0with nullthumbprintspointer (previously returnedtrue).thumbprint_count * size_of::<XNetworkingThumbprint>() > isize::MAX.XNetworkingThumbprintTypevalues (> 2) instead of falling back to matching any cert in the chain.CERT_E_UNTRUSTEDROOTon plain-HTTP loopback if the caller requires certificate pinning (pin_count > 0). (Unpinned plain-HTTP loopback andIssuerchain-index matching are left unchanged in this focused PR.)userinfo@hostand unclosed[IPv6 literals cleanly.Verification
rustc 1.100.0(x86_64-pc-windows-msvc), Windows 10 Pro10.0.19045.cargo test -p xcl --lib hle::xgameruntime::networking: 6 passed, 0 failed.thumbprint_count, non-20-byte SHA-1 length validation, and odd/oversizedWINHTTP_OPTION_URLbyte counts before opening.github-bot referenced this pull request2026-11-26 05:10:49 +00:00
@ivall on GitHub · 2026-11-23 10:29 UTC · original
Merged. Tested on Windows 11 with an RX 9070 (RDNA4):
cargo test --workspacegreen with the retail samples (shader pack, console DLLs, texture archive), also withXCL_SPLIT_WAVE64=1(the 32-lane split path forced on RDNA). Unicorn Overlord and XDefiant run with this round merged. Thanks!