fix(service): retry Windows background install with UAC elevation#408
fix(service): retry Windows background install with UAC elevation#408Wibias wants to merge 13 commits into
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
Reviewed — three blocking findings before this can merge:
Also: Per MAINTAINERS.md this is a security-boundary change requiring explicit security review. Happy to re-review after fixes. |
|
Ready |
Narrow UAC retry to the machine-readable create-access-denied marker, verify a conflict-free scheduler install before writing state, and fix elevated spawn exit/cancel/timeout handling.
a816f6f to
45f66d8
Compare
Preserve create-denial markers across combined CLI streams, fail closed on missing elevated ExitCode, treat unknown WinSW status as unverified without false conflict rollback, and stop swallowing /run timeout failures.
Run elevated schtasks create and run inside a single privileged PowerShell process, treat any /run failure as install failure with rollback, and keep the create-denial marker on a structured CLI failure path.
Remove the privileged write into the unelevated TEMP directory. Carry create/run/rollback outcomes through reserved elevated exit codes inside one UAC process, and reconcile unknown codes against actual task state.
A request-level timeout must not kill the unelevated launcher or clear the install lock while the elevated Task Scheduler transaction may still mutate the same task. Keep observing completion, reconcile late protocol results, and block overlapping installs until ownership settles.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Separate PowerShell Handle/ExitCode statements so join(") cannot form Handleif, gate UAC-cancel text on non-zero exits, fail closed when reconciliation rejects, and surface leftover-task guidance after signal termination.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
독립 리뷰어가 FAIL과 함께 낸 12개 blocker를 전부 반영했다. - WP1(#433): 카나리 설계를 probe lease로 전면 교체. 조회는 무상태로 두고 auth 단계에서만 lease를 획득한다. 기존 테스트 codex-routing:312/:806이 '2xx는 hard cooldown을 보존한다'를 명시적으로 고정하고 있어, lease 소지 요청의 성공만 cooldown을 해제하도록 했다. transient 경로의 probe 상태 소실도 함께 막는다. - WP3(#422): non-stream 경로가 parseResponse 부재로 core.ts:1828에서 400을 내는 문제를 확인하고 해당 diff를 추가했다. - WP4(#373): rootPromptMessages()는 serialized를 반환하지 않으므로 반환 타입 확장 diff를 명시했다. 공유 token-estimate.ts 변경은 kiro와 두 서버 경로에 영향을 주므로 철회하고 Cursor 국소 helper로 가뒀다. - WP5(#404): resolveAdapter가 cursor/kiro 등 provider 전용 어댑터를 포함하므로 override 허용 목록을 openai-chat/openai-responses로 제한했다. - WP2(#432): 두 판정을 한 parser로 묶어 반쪽 수정이 테스트를 통과하지 못하게 했다. PR #408 최신 head 대조 절차를 추가했다. - 문서: 001로 연구 자료를 분리하고(LEXICO-SPLIT-01) 060 WP6 문서를 작성했다(DIFFLEVEL-ROADMAP-01). 000의 의존성 맵을 실제 공유 지점으로 정정했다.
🔒 Under maintainer review — detailed feedback incoming@lidge-jun (maintainer) has this PR in an active review pass. Please do not merge or close This PR is not part of the current integration batch. It is held back deliberately — Heads-up on rebasing: No action needed from you until then. Thanks for the contribution and for your patience. Review tracker: |
|
Thank you for working through the Windows service-install recovery path. I found a security-blocking executable-resolution issue that needs to be fixed before this can merge.
Please resolve the real Windows system directory through a trusted OS mechanism rather than inherited environment state, construct both PowerShell and Because this code selects binaries for UAC elevation, it is an explicit security boundary under Reviewed as part of a maintainer integration pass. |
Stop deriving UAC PowerShell and schtasks paths from caller-controlled SystemRoot. Resolve the trusted system directory through kernel32 GetSystemDirectoryW, fail closed if verification fails, and add a hostile-SystemRoot regression test.
|
Addressed the executable-provenance block:
Commit: c55db9d — still needs maintainer security review per MAINTAINERS.md. |
Linux CI fakes win32 without kernel32/System32. Add a test-only executable override seam so spawn/finalize suites can keep production-shaped paths while production resolution stays GetSystemDirectoryW-only.
|
Ready for merge. @lidge-jun |
|
Follow-up review at head One blocker remains, and it undermines the install lock rather than the elevation itself.
try {
return querySchtasks(["/query", "/tn", taskName]).includes(taskName);
} catch {
return false;
}A permission failure and a genuinely missing task are indistinguishable here. That boolean feeds unknown-protocol and late-timeout reconciliation, so A tri-state probe fixes this. Query the specific task; on failure, fall back to a CSV listing before concluding absence; if both fail, return export type WindowsSchedulerTaskProbe =
| { status: "present" }
| { status: "absent" }
| { status: "unknown"; detail: string };Keep The regression to add: inject a Status: held for explicit security review under Thank you for the iterations on this one; narrowing the elevated target was the right call and it made the remaining issue much easier to see. Reviewed as part of a maintainer PABCD pass. Adds a finding not present in the earlier pass. |
통합(dev push 완료): #437 803807a, #460 74ddd96, #431 82a47db, #405 be16c1d, #468 후속 테스트 bcaf029. close: 통합 4건 + 통합 없이 1건(#459, 설계 충돌). #457은 OPEN 유지. 이슈 close 0건 — dev에서 고쳐졌는데 안 닫힌 이슈가 없었다. 무효화: WP4(#466)와 WP6(#467)은 동료가 직접 머지했고, 우리 분석이 지적한 결함을 동료 커밋이 같은 방향으로 해소했다. 보안 보류 5건에 신규 발견 게시: #429 재분류, #355 OAuth 토큰 목적지, #424 유료 브리지 기본 ON, #408 설치 락 해제, #403 4분할 요청. A-gate는 사이클마다 3~5라운드를 돌았다. 반복된 원인은 계획서에 테스트나 코드를 적으면서 실물 소스를 확인하지 않은 것이었다.
Query failures must not collapse to absent and release the install lock while an elevated task may still be present.
Export trusted-path containment and schtasks query test seams, remove dead elevated-result branches, and harden probe/elevation regression coverage across platforms.
Replace the literal backslash prefix check so host-native temp paths on Linux/macOS CI are accepted as children of the trusted system directory.
|
Ready for merge. @lidge-jun |
Ingwannu
left a comment
There was a problem hiding this comment.
Explicit maintainer review completed at exact head b711ddf4aabd45f4913f2b2a78add4aa751d9645. The elevated path remains restricted to trusted system PowerShell and schtasks.exe resolved through GetSystemDirectoryW, preserves argument boundaries, and does not elevate Bun or repository code. The remaining install-lock blocker from the prior review is fixed with a tri-state scheduler probe: query failures fall back to an exact CSV lookup, unverifiable state remains unknown, late protocol reconciliation becomes blocked-partial, and the lock clears only on proven absence. Verified 121 focused service/elevation/reconciliation tests plus typecheck; all current cross-platform and dedicated Windows service checks are green.
|
Maintainer approval is complete at |
Summary
Fixes the Windows dashboard background service install failure when
schtasks /createreturns access denied (Zugriff verweigert).Changes
schtaskserror messages with actionable guidance.install-servicethrough an elevated CLI run when access is denied, then verify the scheduler task exists.Verification
bun test tests/service.test.ts tests/startup-action-control.test.ts tests/windows-elevation.test.tsbun run typecheckSummary by CodeRabbit