Skip to content

fix(startup): read the install-dir package ACL as SDDL so a repaired folder reads clean on Chinese/Japanese/Korean Windows - #22490

Merged
OrcaWin merged 5 commits into
mainfrom
fix/scan21-win-gpu-startup
Sep 26, 2026
Merged

OrcaWin merged 5 commits into
mainfrom
fix/scan21-win-gpu-startup

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​122 $\color{#cf222e}{\Huge{\mathbf{−}}}$​93 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​29
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​118 $\color{#cf222e}{\Huge{\mathbf{−}}}$​122 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4

ELI5

On Chinese, Japanese or Korean Windows, Orca could keep saying its installation permissions were broken after it had repaired them. The check now reads language-independent permission IDs.

What Changed

Read the DACL saved by icacls /save instead of parsing translated account names from its display output. Recognize package grants by SID, excluding deny and inherit-only entries. Delete the temporary UTF-16 save file after reading it. Require successful process exit before reading the saved output. Reject incomplete or unsupported DACLs as unreadable instead of treating a partial parse as proof that the installation is broken.

Before, a repaired folder could trigger repeated repair attempts, administrator instructions and suppression of the graphics fallback. After, a readable repaired folder is recognized correctly in every locale.

Why

Adding translated names is incomplete and fragile. SDDL provides stable identifiers with the existing Windows tool, without another interpreter or native dependency. The regression proves incorrect permission detection; it does not prove that every reported Windows graphics crash has this cause.

Linked Issue

Crash Scan 21 and attached field evidence; related upstream issue: electron/electron#51761.

Visual Proof

N/A — startup permission detection only; no new UI.

Testing

  • September 25: two new tests fail before the parser guard and pass after. A conditional ACE can no longer hide a later valid package grant, and malformed nonempty output is unreadable.
  • Probe, recovery, repair and GPU-lifecycle coverage: 91 passing tests; two Windows-only cases skipped on macOS.
  • Integrated main 6fc3cdc. Final probe/recovery/repair/GPU and hook-parity check: 93 passing tests, including nonzero and signal-terminated export regressions. Node typecheck, changed-code quality, focused lint, formatting and whitespace checks passed with ORCA_BACKGROUND_LAUNCH=1.
  • Fresh manual CJK Windows run. The real locale failure was diagnosed from the field report; this refresh used permission-output fixtures.

Review

The original partial DACL parser could produce a false alarm when a conditional ACE preceded a valid grant. The follow-up fixes this by refusing unsupported DACLs. The final review also caught failed exports leaving apparently valid output; nonzero/signal exits now discard that output. Previous CI passed except main’s stale terminal hook snapshot, fixed by #23090 and passing locally after refresh. Full CI reruns on the final head.

Agent skill upstream boundary

  • Not applicable.

Notes

Windows-only behind existing runtime checks. Other platforms, SSH execution, Git/folder workspace handling and remote protocols are unchanged. An unreadable DACL cannot authorize repair; existing failure handling remains in place.

Checklist

  • Focused fix with user impact, mechanism and alternatives explained.
  • Self-reviewed; platform and process-execution boundaries preserved.
  • Targeted tests, types and quality passed; full checks run in CI.

…tree reads clean on every Windows language

The Windows install-dir permission probe parsed icacls's display output and
recognized the well-known package grants by their English names. On
Chinese/Japanese/Korean Windows icacls keeps 'NT AUTHORITY' in English but
translates the package names, so a tree the repair had just fixed read as
poisoned AND reliable: the pre-window repair re-armed every launch, the dialog
blamed the install, and the safe-graphics fallback was withheld.

Read the DACL with 'icacls <target> /save <tmpfile>' instead, which writes
SDDL (SIDs, AC alias) on every locale, and drop the English-name heuristic and
its wellKnownNameCheckReliable flag.
@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

📝 Walkthrough

Walkthrough

The Windows install-directory ACL probe now reads ACL data from a temporary file created with icacls /save and parses its SDDL ACEs. The probe identifies orphan package SIDs and well-known package grants from those ACEs. The poison verdict now uses matchesPoisonSignature without a name-check reliability field. Probe fixtures and tests now cover saved ACL data and translated display output.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to e720a

An interrupted ACL read can incorrectly trigger install-directory repair. Require a complete saved record before classifying it; the risk is narrow but worth fixing.

Security Architecture Review

Security architecture risk: 🔵 Low · up to e720a

The change is confined to Windows install-folder permission detection and its existing repair path. No newly introduced security issue was established, but incomplete permission readings can still affect recovery decisions.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The affected authority is the local Windows process reading its install-folder ACL and invoking the existing repair operation. The reviewed changes do not establish a new remotely reachable or cross-service path.

Security Findings and Attack Paths

  • inferred — If one required target is unreadable while another appears clean, the probe can emit a clean verdict that clears the recovery marker. The base probe also accepted mixed readable and unreadable targets, so this is a residual failure-containment gap rather than an established PR-introduced attack path.

Trust Boundaries and Controls

  • observed — Saved ACL text crosses from the icacls child process into the startup verdict. The parser rejects output without a parseable DACL, and an all-unreadable result does not retire the poison marker. Child exit status is not checked before reading the saved file.

Resilience and Maintainability Implications

  • observed — Recovery keeps a poisoned reading obtained during repair and can re-arm the marker when a later reading disproves a repair claim; the repair path has a bounded attempt count.

Hardening Proposals

  • proposed — As follow-up hardening for the pre-existing mixed-target gap, require successful, complete readings for every selected target before clearing poison evidence; also distinguish an unsuccessful icacls exit from a completed save.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 58.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 7 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main change: reading the Windows install-directory package ACL as SDDL to support non-English Windows locales and correctly recognize repaired folders.
Description check ✅ Passed The description is mostly complete. It explains the user impact, mechanism, rationale, testing, scope, and platform considerations. The linked issue section uses field evidence and an upstream issue i…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one parsing edge worth a look.

Reviewed changes

  • SDDL-based ACL probe — windows-install-dir-acl-probe.ts now runs icacls <target> /save <tmpfile>, reads it as UTF-16LE, and matches package ACEs by SID / the AC alias instead of localized display names.
  • Verdict trust widened — isInstallDirAclPoisonVerdict drops the wellKnownNameCheckReliable guard (and the probe stops emitting it), so a positive reading is trusted on every Windows display language.
  • Fixtures and tests rewritten — the shared fixture emits SDDL /save files, with verbatim real-Windows capture tests; the probe, recovery, repair, and gpu-lifecycle guard suites are updated.

The core fix is sound: icacls /save genuinely prints locale-independent SDDL, AC is confirmed as SDDL_ALL_APP_PACKAGES (S-1-15-2-1), deny and inherit-only ACEs are correctly excluded from grants, and readFileSync(..., 'utf16le') fails safe (no D: → unreadable → no repair and no blame). All 86 tests in the four changed suites pass locally.

ℹ️ Nitpicks

  • The zhDisplay argument in the CJK test (windows-install-dir-acl-probe.test.ts:117-136) is never consumed: the probe always invokes /save, and fakeIcaclsSpawn only emits display for non-/save verbs. The test therefore pins "an SDDL tree with the restricted grant reads clean", not the translated-name display it is named for. Worth dropping the dead argument or renaming the case so the comment matches what it actually exercises.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@OrcaWin

OrcaWin commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator Author

Crash scan 22 data point (v1.4.209, Windows 11 22000, Intel UHD 27.20.100.9664): on the first launch after the auto-update to 1.4.209, GPU and renderer both exited -2147483645 within 500 ms of start (main_window_load_failed ERR_FAILED). The next launch, 4 s later, logged windows_install_dir_acl matchesPoisonSignature=true orphanPackageSidCount=2 wellKnownNameCheckReliable=false and no repair crumb. It rendered normally with gpu_fallback_safe_graphics_kept (crashesInWindow=3). So the app recovered on its own after one failed launch, but the poison-shaped ACL is still on the folder. Slack: https://stablygroup.slack.com/archives/C0B4PDCMPPT/p1790209281942619

@OrcaWin

OrcaWin commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator Author

Another field case on v1.4.205 (Slack report, Windows):

  • 14:09:13 the GPU crashed with -2147483645 at startup, then the renderer crashed the same way. The first probe returned status=failed, reason=all-targets-unreadable. GPU fallback engaged and renderer recovery ran out of retries.
  • On the relaunch at 14:09:31 the probe returned matchesPoisonSignature=true (1 orphan package SID, hasWellKnownPackageGrant=false, wellKnownNameCheckReliable=true). windows_install_dir_acl_repair status=ok finished at 14:09:46, and the app rendered.
  • At 14:13 it auto-updated to 1.4.210. The post-update launch at 14:14:56 still reported matchesPoisonSignature=true with wellKnownNameCheckReliable=true, the same orphan SID and no well-known grant, yet it rendered fine.

The repair worked, but afterwards the probe kept reporting the folder as poisoned and called that reading reliable. That is the false positive this PR fixes. The bundle has no locale data, so I can't confirm this is the translated-icacls case. If the machine isn't CJK, the reading-as-SDDL change should still cover it, because it no longer depends on account names.

@OrcaWin

OrcaWin commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator Author

Scan-24 field repeat on v1.4.211: report cbf496d6 (Windows 10 19045). matchesPoisonSignature=true with 2 orphan package SIDs and no well-known grant, so GPU and renderer died at init with 0x80000003. The shipped repair fixed it on the next launch (status ok, 0 failed files). Separately, 6a77940c (same exit code, on non-English Windows) had orphanPackageSidCount=0, so it is not this signature; it was a transient first launch after the update.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: e7e8c146-ea32-450c-ba3f-c0c25a5bae99

📥 Commits

Reviewing files that changed from the base of the PR and between 6363eda and e720ad3.

📒 Files selected for processing (2)
  • src/main/startup/windows-install-dir-acl-probe.test.ts
  • src/main/startup/windows-install-dir-acl-probe.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Partial DACLs now rejected instead of truncated — collectAclFacts returns null when the anchored /^D:[A-Z]*((?:\([^()]*\))*)(?:S:.*)?$/im capture cannot consume the whole D: line, so a conditional XA/XD or resource-attribute RA ACE no longer silently drops every following ACE.
  • Unreadable probe result derived from parsed facts — runProbe filters out null facts and reports status: 'failed', reason: 'all-targets-unreadable' only when no target parses, replacing the previous outputs.every((out) => out === '') check that treated nonempty-but-malformed output as a clean DACL.
  • Two regression tests added — one pins that a conditional ACE keeps the DACL unreadable rather than hiding a later S-1-15-2-2 grant (the prior false-poison path), the other pins that a bare leaf-name header is not reported as clean.

The prior inline concern about the unanchored DACL capture is resolved by this delta: a partial parse can no longer produce a verdict, so the false-alarm path that the removed wellKnownNameCheckReliable guard used to suppress is closed at the source. All 88 tests in the four changed suites pass locally.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@OrcaWin
OrcaWin merged commit 80ff6c4 into main Sep 26, 2026
2 checks passed
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.

1 participant