Repository navigation
fix(mitm): keep Windows DNS elevation off the POSIX sudo path (#11430) - #11542
Merged
diegosouzapw merged 1 commit intoAug 26, 2026
Conversation
diegosouzapw
merged commit Aug 26, 2026
4914954
into
cheaper-inference:release/v3.8.51
3 checks passed
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…r-inference#11430) (cheaper-inference#11542) Merged via /merge-batch (lote 2026-08-26, v3.8.51). Boarded no worktree combinado junto com outras ~30 PRs; validação única: typecheck/complexity/cognitive-complexity/changelog-integrity verdes, file-size rebaseado onde necessário (crescimento legítimo), lint com os mesmos 228 achados pré-existentes confirmados via sonda contra o tip puro (não introduzidos por este lote), e ~370 testes focados (unit + vitest) passando. Obrigado pela contribuição.
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.
Summary
sudo -Spath on a Linux-built artifact.os.platform()at call time, matching fix(startup): preserve Windows Tailscale Funnel code paths in published builds #10293 / Windows: cliproxy always fetches Linux binary + missing .exe on install/spawn; combos PATCH endpoint broken (405 + missing {id}); oauth status --output table crashes #11236, so Turbopack cannot foldprocess.platformto the build host and prune the PowerShell branch.Related Issues
Changelog
On Windows 11 with native
sudo.exeenabled, Agent Bridge MITM start and Repair loggedunexpected argument '-S'and never wrote hosts entries. The published bundle is built on Linux; a module-loadconst IS_WIN = process.platform === "win32"was folded tofalse, soaddDNSEntries/removeDNSEntriesspawned POSIXsudo -S. Windows 11's sudo CLI rejects that flag.This routes Windows through elevated PowerShell again, keeps POSIX
sudo -Son Linux/macOS, and stops the sudo-availability probe from treating Windowssudo.exeas Unix sudo.Description
src/mitm/dns/dnsConfig.tshad the same foldable pattern already fixed for Tailscale and cliproxy:After a Linux
next build, the Windows hosts-file branch is dead code indist.provisionDnsEntries()andrepairMitm()then callsudo -S tee -a /etc/hosts. On Windows 11 that binary is Microsoft sudo, which errors on-S.Changes:
dnsConfig.ts:isWin32()/hostsFilePath()viaos.platform()at call time.systemCommands.ts:isSudoAvailable()returns false on win32 viaos.platform(), soexecFileWithPasswordcannot spawn nativesudo.exewith POSIX-S.sudoGate.ts: skip the sudo-password gate on win32 via the same runtime read (UAC still handles elevation).POSIX behavior is unchanged:
sudo -S tee/sudo -S node -estill write/etc/hostswhen not on Windows.Validation
Result: 34/34 pass (8 new in
mitm-dns-win32-sudo-fold-11430.test.ts).Fail-then-pass: the new source guard fails if
const IS_WIN = process.platform === "win32"is restored; withos.platform()it passes. The behavioral test mocksos.platform()towin32and assertsrunElevatedPowerShell(Add-Content) with zero POSIXsudospawns.Also ran locally: prettier on the touched files, eslint on the touched files (clean),
check-docs-sync,check:any-budget:t11,check-tracked-artifacts.Tests Added Or Updated
tests/unit/mitm-dns-win32-sudo-fold-11430.test.ts(new)tests/unit/dns-config-generic.test.ts(Hard Rule deps: bump qs from 6.14.1 to 6.14.2 #13 source assertions followhostsFilePath())Coverage Notes
src/mitm/dns/dnsConfig.ts,src/mitm/systemCommands.ts, andsrc/mitm/sudoGate.tsare covered by the new fold guard and the win32os.platform()mocks above. Existing sudo-strip and sudo-gate tests still pass.Reviewer Notes
Same class of bug as #10293 / #11236 (Linux-build fold of
process.platform). I did not changesrc/mitm/cert/install.ts; it still has module-loadIS_WIN/IS_MACand can fold the same way for cert trust. Happy to follow up if you want that in this PR.Local husky
lint-stagedESLint reports unused bulk suppressions when linting only the staged files (base-red #11449). CI already uses--pass-on-unpruned-suppressionsfor that. This diff does not toucheslint-suppressions.json.