XGameRuntime: keep embedded URLs in XSTS canonical query paths #1666
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1676"
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?
Imported from ivall/xcl. Originally posted by eizispark on 2026-11-24T19:12:18Z.
xsign::canonical_path_and_querypreviously ranurl.split_once("://")across the entire URL before stripping#fragmentand without checking that a RFC 3986scheme://prefix precedes any/or?. As a result, relative paths with callback/redirect URLs in query parameters (e.g./oauth/authorize?redirect_uri=https://title.example/cb) or fragments containing://were split inside the query or fragment, signing/cbinstead of the actual request path and query, and scheme-relative//authority/...URLs kept the host inside the path.In addition,
signer()leaked CNG handles on initialization failure and did not trackecdsa_algalongside its childecdsa_key(per Windows CNG rules, aBCRYPT_KEY_HANDLEmust be destroyed viaBCryptDestroyKeybefore closing its parentBCRYPT_ALG_HANDLEviaBCryptCloseAlgorithmProvider).What is in it
crates/xcl/src/hle/xgameruntime/xsign.rs: strip#fragmentfirst incanonical_path_and_query, strip only a leading//or RFC 3986scheme://authority prefix before normalizing the path-and-query, clean up CNG key/algorithm handles in reverse order on initialization failure and inDrop for EphemeralSigner, and addcanonical_url_preserves_embedded_query_urls_and_strips_fragments_firstcovering embedded query/fragment URLs, scheme-relative URLs, and end-to-endsign_request_at+BCryptVerifySignatureverification.Tested
32.0.32015.16001), AMD Ryzen 7 9800X3D, Windows 11 x64,rustc 1.100.0 (0ef1bc386 2026-11-09)(stable-x86_64-pc-windows-msvc), debug (unit + workspace tests) and release (60 s title smoke).cargo test -p xcl --lib xsign: 5 passed, 0 failed, 0 ignored (canonical_url_preserves_embedded_query_urls_and_strips_fragments_firstverified failing with"/cb"before the fix).cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 777 passed, 0 failed, 41 ignored (SKIPPED GPU/SDK tests: 3 —test_title_draws_with_a_root_signature_under_the_debug_layer: nod3d12SDKLayers.dll;heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows;uploads_start_from_each_subresources_state: no D3D12 debug layer).Regression run
main(9e3831e1f570d3646e53ab753b19ec07eb8f1485):PR (
3c13a5a8de3c10a59527f8d875518fe259935fdf):Not tested
XUserGetTokenAndSignature*with embedded redirect URLs in query strings; Linux / Wine (bcrypt.dll).d3d12SDKLayers.dllnot installed on this machine).AI use
xsign.rs, wrote the regression test and fix, ran the workspace test suite andscripts/smoke.ps1runs, and drafted this PR description.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T21:37:41Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T03:55:23Z.
PR #1676 — STOR-WINLAB verification
Tested
3c13a5a8de3c10a59527f8d875518fe259935fdfat detached HEAD, matching the fetched PR head.Environment
STOR-WINLAB, Windows 11 Enterprise Evaluation build 26200.9974, Ryzen 7 3800X, Intel Arc A770 16 GiB (driver 32.0.101.9175,
DoublePrecisionFloatShaderOps=0, wave range 8–32). DXC/DXIL 1.9.2609.5. Rust 1.100.0 (0ef1bc386, 2026-11-09). Unoptimized build and test profiles with debug info disabled.Tested
cargo build --workspaceandcargo test --workspace --no-runcompleted successfully. Every Cargo test invocation used the shared Arc lock.cargo test -p xcl xgameruntime -- --nocaptureexited 0. Libtest reported 74 unit tests passed, 0 failed, 0 ignored. One sample-dependent integration test also reported a pass with its sample unset. All fivexsigntests passed. The new regression test checks that canonicalization keeps embedded query URLs, strips fragments, handles relative and scheme-relative inputs, and produces equivalent signing payloads for relative and absolute URLs. BCrypt verified the ephemeral P-256 signature.cargo test --workspace --no-fail-fast -- --test-threads=4exited 101. The 20 summaries inpr1676-suite.logreport 761 passed, 16 failed, 41 ignored. The signing regression test passed again.Workspace failures and skips
CreateComputePipelineStateerror0x80070057. Four assertions failed in FMA overflow, implicit mip LOD sampling, FP16 high-half preservation, and pixel-shader wave reduction.RSSetDepthBiasXcheck read a blue pixel where it expected green.SKIPPEDlines in the suite log, two forno wave64and one forno heap windows. These paths contribute no coverage.Not tested
Live XSTS service acceptance, retail-title smoke tests, a
mainbaseline, and other GPUs. Optional game-data paths had noXCL_SAMPLE_*inputs. The D3D12 debug layer, system Gaming Services paths, and audio endpoint paths were unavailable.AI use
T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against
pr1676-suite.logand published.Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T08:02:09Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:28:47Z.
Triage (#1607) – head
3c13a5aNo open or merged PR makes the same change. Main's
canonical_path_and_query(xsign.rs) still splits at the first://, so/oauth/authorize?redirect_uri=https://title.example/cbsigns as/cb; this PR fixes that and tests it.Two remarks on the diff: the
Drop for EphemeralSignernever runs (the signer lives in astatic OnceLock), and the BCrypt cleanup is unrelated to the title, so it belongs in its own PR. A scheme-lesshost/path(e.g.social.xboxlive.com/users/me) now signs as/social.xboxlive.com/users/mewhere main gave/users/me. Say whether any caller passes that form.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.