diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-10-15 14:24:25 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-10-15 14:24:25 +0200 |
| commit | 5949532e6450d1aebc681caa8db2192a43b11f12 (patch) | |
| tree | e457c84ab3a5e54061d10d2233c61fdb6ff194cd /packaging/build | |
| parent | a86bced1640ac1a695b95ac68b95e3fc581e687d (diff) | |
| download | meshbay-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/build')
| -rwxr-xr-x | packaging/build/build-node.sh | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/packaging/build/build-node.sh b/packaging/build/build-node.sh index b9d542c..c7e7577 100755 --- a/packaging/build/build-node.sh +++ b/packaging/build/build-node.sh @@ -45,18 +45,22 @@ ln -sf /opt/meshbay-common/venv/bin/meshbay-node "$ROOT/usr/bin/meshbay-node" # --- Node-specific assets ------------------------------------------------- mkdir -p "$ROOT/opt/meshbay-node/share" -# default.env: the shared TMDB token, copied as is from QE/default.env (never -# versioned), one line: MESHBAY_TMDB_DEFAULT_TOKEN=eyJ... The daemon reads it -# beneath <config>/node.env and the operator's own token, so it is only the -# fallback. 0644: a per-user node must read it, and it is the same token in -# every copy of the package. No token, no build: an empty one goes unnoticed. +# default.env: the shared TMDB token, 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. The daemon reads it beneath <config>/node.env and +# the operator's own token, so it is only the fallback. 0644: a per-user node +# must read it, and it is the same token in every copy of the package. No +# token, no build: an empty one goes unnoticed. DEFAULT_ENV="$REPO/QE/default.env" -if [ "$(head -c 30 "$DEFAULT_ENV" 2>/dev/null)" != "MESHBAY_TMDB_DEFAULT_TOKEN=eyJ" ]; then - echo "!! $DEFAULT_ENV missing, or not starting with MESHBAY_TMDB_DEFAULT_TOKEN=eyJ... (no BOM)" >&2 +TOKEN_LINE="$(head -n 1 "$DEFAULT_ENV" 2>/dev/null | tr -d '\r')" +if ! [[ "$TOKEN_LINE" =~ ^MESHBAY_TMDB_DEFAULT_TOKEN=eyJ[A-Za-z0-9_.-]+$ ]]; then + echo "!! $DEFAULT_ENV missing, or its first line is not MESHBAY_TMDB_DEFAULT_TOKEN=eyJ... (no BOM)" >&2 exit 1 fi -install -m 644 "$DEFAULT_ENV" "$ROOT/opt/meshbay-node/share/default.env" -echo " default.env copied from QE/" +printf '%s\n' "$TOKEN_LINE" > "$ROOT/opt/meshbay-node/share/default.env" +chmod 644 "$ROOT/opt/meshbay-node/share/default.env" +echo " default.env: token line taken from QE/" # --- Systemd units -------------------------------------------------------- mkdir -p "$ROOT/usr/lib/systemd/system" |