Skip to content

Commit aacf96a

Browse files
committed
fix(install): stop naming TLS 1.3 where schannel cannot negotiate it
install.ps1 set its protocol bitmask to Tls12 -bor Tls13 unconditionally. Windows 10's schannel has no TLS 1.3 -- it arrives with Windows 11 and Server 2022 (build 20348) -- but .NET Framework 4.8 still DEFINES the enum value, so the assignment succeeds and nothing warns. The first HTTPS request then dies with "The request was aborted: Could not create SSL/TLS secure channel", because an unsupported flag in this bitmask is a hard failure rather than a downgrade. Every Windows 10 user was blocked before a single byte downloaded, on the documented `irm ... | iex` path, with an error that points at the network rather than at the installer. Compute the set instead: start at Tls12 and add Tls13 only on build 20348+. The enum-name probe alongside the build gate keeps the script parsing on .NET Framework 4.7, where the member does not exist at all. Verified on the Windows VM (build 26200) with the shipped parser: PARSE_OK, pure ASCII preserved, the guard computes and assigns "Tls12, Tls13" there, forcing build 19045 through the same expression yields "Tls12" alone, and an HTTPS HEAD to github.com under the assigned set returns 200. The contract test fails on the previous installer with all four assertions -- unconditional bit, missing build gate, missing enum probe, literal bitmask -- and passes with this change. Reported with a full ProcMon trace and a decoded SID by zaferavci1. Refs DeusData#1856 Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent dd454b2 commit aacf96a

2 files changed

Lines changed: 48 additions & 2 deletions

File tree

‎install.ps1‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,22 @@
77

88
$ErrorActionPreference = "Stop"
99

10-
# Enforce TLS 1.2+ (older PowerShell defaults to TLS 1.0 which GitHub rejects)
11-
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls13
10+
# Enforce TLS 1.2+ (older PowerShell defaults to TLS 1.0 which GitHub rejects).
11+
#
12+
# TLS 1.3 is added ONLY where schannel can actually negotiate it: Windows 11 and
13+
# Server 2022 (build 20348+). On Windows 10 the enum value still exists from
14+
# .NET Framework 4.8 onward, so the assignment succeeds and nothing warns -- but
15+
# the handshake then fails outright with "The request was aborted: Could not
16+
# create SSL/TLS secure channel". An unsupported protocol flag in this bitmask
17+
# is a hard failure, not a graceful downgrade, so every Windows 10 user was
18+
# blocked at the first download (#1856). The enum-name probe additionally keeps
19+
# the script parsing on .NET Framework 4.7, where Tls13 is not defined at all.
20+
$CbmProtocols = [Net.SecurityProtocolType]::Tls12
21+
if ([Environment]::OSVersion.Version.Build -ge 20348 -and
22+
([enum]::GetNames([Net.SecurityProtocolType]) -contains 'Tls13')) {
23+
$CbmProtocols = $CbmProtocols -bor [Net.SecurityProtocolType]::Tls13
24+
}
25+
[Net.ServicePointManager]::SecurityProtocol = $CbmProtocols
1226
Add-Type -AssemblyName System.Net.Http
1327

1428
$Repo = "DeusData/codebase-memory-mcp"

‎tests/test_windows_bundle_contract.sh‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,38 @@ require(
242242
"install.ps1 version probes must relax EAP with restore and pre-seed LASTEXITCODE (#1255)",
243243
)
244244
245+
# ── 3c. The TLS bitmask must not name a protocol schannel cannot negotiate ───
246+
# Windows 10's schannel has no TLS 1.3 (it arrives with Windows 11 / Server
247+
# 2022, build 20348). .NET Framework 4.8 still DEFINES SecurityProtocolType
248+
# .Tls13, so setting the bit succeeds silently and nothing warns -- then the
249+
# first HTTPS request dies with "Could not create SSL/TLS secure channel",
250+
# because an unsupported flag in this bitmask is a hard failure rather than a
251+
# downgrade. That blocked the installer on every Windows 10 machine before it
252+
# downloaded a single byte (#1856). Pin both halves of the guard: the build
253+
# gate, and the enum-name probe that keeps the script parsing on 4.7, where
254+
# Tls13 does not exist.
255+
require(
256+
"[Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls13" not in installer,
257+
"install.ps1 must not set the TLS 1.3 bit unconditionally -- it hard-fails "
258+
"the handshake on Windows 10, whose schannel cannot negotiate it (#1856)",
259+
)
260+
require(
261+
re.search(r"\[Environment\]::OSVersion\.Version\.Build\s+-ge\s+20348", installer) is not None,
262+
"install.ps1 must gate TLS 1.3 on build 20348+ (Windows 11 / Server 2022) (#1856)",
263+
)
264+
require(
265+
re.search(
266+
r"\[enum\]::GetNames\(\[Net\.SecurityProtocolType\]\)\s+-contains\s+'Tls13'", installer
267+
)
268+
is not None,
269+
"install.ps1 must probe the enum before naming Tls13, so it still parses on "
270+
".NET Framework 4.7 where the member is undefined (#1856)",
271+
)
272+
require(
273+
"[Net.ServicePointManager]::SecurityProtocol = $CbmProtocols" in installer,
274+
"install.ps1 must assign the computed protocol set, not a literal bitmask (#1856)",
275+
)
276+
245277
# ── 4. Package-manager shims resolve the single Windows binary ───────────────
246278
single_binary_contracts = {
247279
"pkg/npm/install.js": (

0 commit comments

Comments
 (0)