XGameRuntime: keep embedded URLs in XSTS canonical query paths #1676
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!1676
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@eizispark on GitHub · 2026-11-24 19:12 UTC · original
eizispark:fix/xsign-canonical-url→main· +105 −11 · 1 files · 1 commits · openxsign::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.`xsign::canonical_path_and_query` previously called `url.split_once("://")` across the entire URL before stripping `#fragment` and without checking that a RFC 3986 `scheme://` prefix precedes any `/` or `?`. Relative paths with callback/redirect URLs in query parameters (for example `/oauth/authorize?redirect_uri=https://title.example/cb`) or fragments with `://` were split inside the query/fragment, signing `/cb` instead 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 track `ecdsa_alg` alongside its child `ecdsa_key` (per Windows CNG rules, `BCRYPT_KEY_HANDLE` must be destroyed before closing its parent `BCRYPT_ALG_HANDLE`). Strip `#fragment` first, strip only a leading `//` or RFC 3986 `scheme://` authority prefix, and release CNG key and algorithm handles in reverse order on initialization errors and drop. Assisted-by: Antigravity (Google DeepMind, Gemini 4 Carbon)@DavidM1911 on GitHub · 2026-11-24 21:37 UTC · original
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!
@JJAutoCompare on GitHub · 2026-11-25 03:55 UTC · original
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.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.