Repository navigation
Launcher: the elevated step verifies its job files - #86
Draft
phantoslayer21 wants to merge 6 commits into
Draft
phantoslayer21 wants to merge 6 commits into
phantoslayer21 wants to merge 6 commits into
Conversation
phantoslayer21
marked this pull request as ready for review
November 13, 2026 21:20
phantoslayer21
marked this pull request as draft
November 13, 2026 21:25
The launcher binds the job and batch files of an elevated step to its own request by SHA-256, and the elevated step works out its result paths itself. - The elevation command line carries the SHA-256 of the file it names (apply --job=<file> --sha256=<hex>, or apply --batch=<file> --sha256=<hex>); the batch lists each job file with its SHA-256 (job= / sha256= lines). - The elevated step reads each file once into memory, checks its SHA-256 and parses those same bytes. A request whose job files do not match is not run, with a clear message that the launcher shows. - Result paths are derived from the file given on the command line: result-<name>.txt for job-<name>.txt, result-<stamp>-<n>.txt for the n-th job of batch-<stamp>.txt. A batch with a result= line is refused. Results are written to a new file and moved into place. - log= must be a plain file in the player's data folders (the job's localappdata folder or <data>\logs). - Log paths and their allowed folders are compared in their long form (8.3 short names expanded). - New: src/wg_core/elevated_job.cpp / .h (RunWorkerFiles); the apply verb and the launcher's RunElevated / RunElevatedBatch use it. The installer README and the Python suites follow the new form. Tests (launcher-core, CPU, in-process without elevation): the launcher's batch runs every job with its results at the derived paths; a batch with a result= line is refused; a batch or single job whose SHA-256 differs is refused; a job whose SHA-256 does not match the batch is not run; log and folder paths the step does not accept are refused; a result is not written through an existing name. Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
phantoslayer21
force-pushed
the
launcher-elevated-job-check
branch
from
November 13, 2026 21:35
921daac to
d8cc03f
Compare
… checked first The elevated worker now writes no log or result file of its own, checks every job of a batch before the first one runs, and installs the player's OptiScaler package only from its own checked copy. - Reply pipe: the launcher makes a pipe with a random name that only this account and administrators can open (one instance, local only) before the permission prompt and names it on the command line: apply --batch=<file> --sha256=<hex> --pipe=<name>. The worker sends its log lines and each job's result over it and runs nothing without it. The launcher writes the lines to its own log, takes the reply only from the worker process it started (process id and start time) and only from this run; a game without a result there is shown as not reported. No result file is read. - One form: a single game is a batch of one (apply --job= is gone). - Every job is read once, checked against the batch's SHA-256 and parsed before any job runs; a batch with one job that fails a check runs no job. - OptiScaler package: the launcher puts the package's digest in the job (optisha256=: the SHA-256 of a manifest of every file and its SHA-256; an archive is its one file). The worker copies the package into a new folder that only administrators can write, checks the copy's digest against the job's and installs from that copy; its temporary files go there too, and the folder is removed afterwards. Operations that take no package get none. - Every path in a job must be absolute: opti= and model= are now checked as well, and \\?\ and \\.\ forms are refused. - The job file has no log= line any more; the worker ignores --log and --out. - New: src/wg_core/package_snapshot.cpp / .h; tests/elevated_worker.py (the Python suites' side of the pipe). Test builds can put the worker's private folder elsewhere (WRONGGPU_TEST_PRIVATE_DIR). Tests (launcher-core, CPU, the worker in-process with the real pipe): the normal flow (results and log lines over the pipe, the jobs folder empty afterwards, the install from the worker's copy, the private folder removed); a job with a changed operation, target, package path or package digest is refused and no job runs; a changed package content or another folder at the package path is refused; a package without its digest is refused; a bad or changed second job leaves the first not run; result files on disk are ignored and an unreported job is a failure that says so; a reply from another process is not taken; the worker without the reply pipe runs and writes nothing; permission not given; job path checks; the package digest and private folders. The launcher and coexist suites use the new form, with repair through the worker using a checked package copy and a changed package refused. Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
Each job's folders (the game's, the player's local app data and Documents folders, the worker's private folder) are opened before any job runs, from the volume root one component at a time without following a link, checked against their final path and held without delete sharing until the job ends. Every path below them is opened relative to the held handle the same way; a junction, symbolic link or other redirecting reparse point on any component is refused with the path named. Files are written under a new name and renamed over their target through the handle, renames and deletes go through the file's handle, and nothing outside the job's folders is written. The converter reads private copies and writes into the private folder; its output is copied into place through the handles. The launcher binds each job path to the path Windows reports for it before the prompt. Tests: a junction swapped into an ancestor after validation, a link at the leaf, a final path that differs from the path named, a held folder that cannot be renamed, and writes outside the job's folders, each refused with the reason. Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
… folders; a missing job folder fails when the job runs In the elevated worker the HIP runtime is looked for only in System32 and Program Files (never in a PATH or HIP_PATH folder the player may write), and a candidate the guard refuses is skipped. A job folder that does not exist is not opened as a root: the job then fails when it runs, as before. Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
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.
Draft: this waits on a new independent review and on a recorded real elevated (UAC) run.
The launcher's elevated step (used when a game folder is not writable by the player) checks its whole request before it runs anything, reports back over a reply pipe instead of files, and now acts on every file and folder through held handles.
apply --batch=<file> --sha256=<hex> --pipe=<name>. A single game is a batch of one.File operations through held handles (new in this revision,
src/wg_core/secure_fs.h)FILE_FLAG_OPEN_REPARSE_POINT(and the folder form ofFILE_FLAG_BACKUP_SEMANTICS). Every component stays open without delete sharing until the job ends, so none of them can be renamed, replaced or deleted meanwhile.GetFinalPathNameByHandlemust give the path the job named (normalised); otherwise the operation is refused, with both paths.NtCreateFilewith a root directory). Files are created under a new name next to their target and renamed over it through the handle (NtSetInformationFilerename with a root directory:SetFileInformationByHandle(FileRenameInfo)refuses a root directory handle); deletes go through the file's handle (SetFileInformationByHandle, POSIX delete where the volume has it); folders are listed through their handle. Nothing outside the job's folders is written; reads outside them are opened the same way from the volume root.What stays path-based, and why
\??\C:\): the drive letter is resolved by Windows in the worker's own session. The final-path check still compares the whole path.tar.exeunpacks an OptiScaler archive inside the worker's private folder (administrators only; what it unpacks is then read through the handles, links refused), and the HIP probe child loads its DLL by path from System32 or Program Files only.Status against the independent review of the earlier head ("addressed" is this PR's claim, not yet re-reviewed)
Tested
source-size,wording,wg-core87 checks,launcher-core343 checks,coexist-core187 checks,convert-ignore219 checks): 6 of 6 passed.launcher-corecases: a junction swapped into an ancestor of a job folder after the request was written (refused, naming the link; no job runs; nothing reaches the junction's target); the same below an already held folder (refused at the next write and read); a link at the leaf (query, write through it, removal, rename onto it: refused; removing a folder never follows a link in it; a symbolic link to a file is neither written through nor read, where the account may make one); a final path that differs from the path named (a drive letter mapped onto the folder: refused with both paths); a held folder cannot be renamed while a job runs and its writes land in the folder opened; a write outside the job's folders is refused and becomes the job's result.Not tested