Skip to content

fix(launcher): warn in the log when started elevated (#973) - #1016

Open
asdf80730 wants to merge 1 commit into
EasyIME:masterfrom
asdf80730:pr/launcher-elevation-warn
Open

asdf80730 wants to merge 1 commit into
EasyIME:masterfrom
asdf80730:pr/launcher-elevation-warn

Conversation

@asdf80730

@asdf80730 asdf80730 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #973

Suggestions 1 and 2 of the report (dropping mode=0o700, raising on a NULL
chewing_new2() context) landed in #988. This completes the third: make an
elevated PIMELauncher run visible instead of letting it poison
%APPDATA%\PIME silently.

  • New PIMELauncher/src/elevation.rs: is_process_elevated() reads
    TokenElevation from the process token — a UAC-filtered token of an
    Administrators member reports 0, so the check follows real privilege, not
    group membership; should_warn() gates the warning to the watchdog; and
    elevation_advice() carries the text: the folder the run poisons plus the
    two icacls repair commands from the report.
  • The watchdog calls elevation::warn_if_elevated() right after
    setup_logging() and before the backend manager starts, so /console and
    /log-file both capture it while the user can still avoid the damage. The
    worker child inherits the same token and stays silent, so the log carries
    one warning, not two.
  • The warning is a tracing::warn! with no dialog: an elevated launcher is
    always a deliberate launch, and its debug log — the artifact people attach
    when reporting "keys do nothing" — is where the diagnosis belongs.

Validation:

  • cargo test --target x86_64-pc-windows-gnu: 17 lib + 2 integration tests
    pass, including 3 new elevation::tests (watchdog-only gating, advice
    names the icacls repair, TokenElevation query succeeds on the live
    process token).
  • cargo clippy --target x86_64-pc-windows-gnu --all-targets: no new
    warnings; rustfmt --check clean on the new module.
  • Upstream CI on the pushed SHA: ci / build-and-sign and AppVeyor both
    pass.
  • Smoke: the built binary run with /log-file completes full startup
    (watchdog → worker → backend registry) and its log carries no elevation
    warning while the process is not elevated.

Architecture and design by asdf80730. Implementation generated with AI
assistance from omp (Qwen3.8-Flash-Next).

An elevated PIMELauncher makes the Python backend create %APPDATA%\\PIME
owned by BUILTIN\\Administrators, which the normal sign-in session cannot
read; input methods then silently swallow keys with no error anywhere.
The folder-creation and NULL-context fixes from the report landed in
EasyIME#988; this completes the remaining suggestion: the watchdog now logs a
warning naming the cause and the two icacls repair commands right after
logging is set up, before any backend can create those folders. The
worker child inherits the same token and stays silent, so the log
carries one warning.

Architecture and design by asdf80730. Implementation generated with AI
assistance from omp (Qwen3.8-Flash-Next).
@asdf80730

Copy link
Copy Markdown
Contributor Author

Could a maintainer approve the first workflow run for this fork PR? Local evidence is in the Validation list; the CI run is the remaining check.

(Comment generated with assistance from omp + Qwen3.8-Flash-Next)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chewing silently stops working (keys swallowed) if the user config folder was created by an elevated PIMELauncher

1 participant