aboutsummaryrefslogtreecommitdiffstats
path: root/packaging/win
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-10-15 14:24:25 +0200
committerChristophe Besson <cbesson@gmail.com>2026-10-15 14:24:25 +0200
commit5949532e6450d1aebc681caa8db2192a43b11f12 (patch)
treee457c84ab3a5e54061d10d2233c61fdb6ff194cd /packaging/win
parenta86bced1640ac1a695b95ac68b95e3fc581e687d (diff)
downloadmeshbay-5949532e6450d1aebc681caa8db2192a43b11f12.tar.gz
fix(packaging): ship only the TMDB token line of QE/default.env
build-node.sh and build-node-runtime.ps1 copied QE/default.env whole into every deb, rpm and Windows build after checking only its first 30 bytes. The file is unversioned and sits beside other QE notes, so any line added to it later would have gone out publicly. Only its first line ships now, and only once it is exactly MESHBAY_TMDB_DEFAULT_TOKEN=<JWT>; a missing file, a BOM, a token not on the first line or an empty one still stop the build. The Linux step is run by a test against a scratch repo; the PowerShell one has the same rule and was not run here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packaging/win')
-rw-r--r--packaging/win/build-node-runtime.ps115
1 files changed, 9 insertions, 6 deletions
diff --git a/packaging/win/build-node-runtime.ps1 b/packaging/win/build-node-runtime.ps1
index 28b96e8..3d26ec2 100644
--- a/packaging/win/build-node-runtime.ps1
+++ b/packaging/win/build-node-runtime.ps1
@@ -140,8 +140,9 @@ else {
}
# --- 5. default.env (shared TMDB token) ------------------------------
-# Copied as is from QE\default.env (never versioned), one line:
-# MESHBAY_TMDB_DEFAULT_TOKEN=eyJ... Beside the exe, where
+# Taken from QE\default.env (never versioned). Only its first line ships, and
+# only once it is exactly MESHBAY_TMDB_DEFAULT_TOKEN=<JWT>: anything else
+# written in that file stays out of a public package. Beside the exe, where
# platform.packaged_default_env() looks for it. The daemon reads it beneath
# %LOCALAPPDATA%\meshbay\node.env and the operator's own token, so it is only
# the fallback. No token, no build: an empty one goes unnoticed. The check is
@@ -150,11 +151,13 @@ $defaultEnv = Join-Path $Repo "QE\default.env"
$text = if (Test-Path -LiteralPath $defaultEnv) {
[System.Text.Encoding]::ASCII.GetString([System.IO.File]::ReadAllBytes($defaultEnv))
} else { "" }
-if (-not $text.StartsWith("MESHBAY_TMDB_DEFAULT_TOKEN=eyJ")) {
- throw "$defaultEnv missing, or not starting with MESHBAY_TMDB_DEFAULT_TOKEN=eyJ... (no BOM)"
+$tokenLine = ($text -split "`n", 2)[0].TrimEnd("`r")
+if ($tokenLine -cnotmatch '^MESHBAY_TMDB_DEFAULT_TOKEN=eyJ[A-Za-z0-9_.-]+$') {
+ throw "$defaultEnv missing, or its first line is not MESHBAY_TMDB_DEFAULT_TOKEN=eyJ... (no BOM)"
}
-Copy-Item -LiteralPath $defaultEnv (Join-Path $frozen "default.env")
-Step "default.env copied from QE\"
+[System.IO.File]::WriteAllText((Join-Path $frozen "default.env"), "$tokenLine`n",
+ (New-Object System.Text.UTF8Encoding $false))
+Step "default.env: token line taken from QE\"
# --- 6. publish ----------------------------------------------------
Move-Item $frozen $OutDir