serve, single-file and readability-extractor install from a committed lockfile (#912)

They were installed with `npm i -g`, which pinned only the three top-level versions and
resolved their 156 dependencies fresh from the registry, so a forged TLS certificate (as
the eMudhra key compromise allowed) could change code WROLPi runs on every archive.
npm-tools/package-lock.json pins every package with its sha512, and install_npm_tools.sh
runs `npm ci` and links the commands into /usr/local/bin for every install path, upgrades,
both images and the archive container.  The app container's unpinned, unused global serve
is removed.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
lrnselfreliance 2026-10-31 10:38:53 -06:00 • committed by Roland
parent ecdad6c3e0
commit d69f8317aa
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
12 changed files with 1838 additions and 32 deletions

View file

@ -216,20 +216,9 @@ upgrade_deno() {
upgrade_deno || echo "Deno upgrade failed, continuing..."
# Upgrade single-file to the pinned version; old versions (1.x) create compressed Archives without
# the SingleFile comment header in the prelude, which WROLPi cannot validate.
# readability-extractor is pinned alongside it to match the install scripts.
upgrade_singlefile() {
SINGLE_FILE_VERSION="2.0.73"
if [ "$(single-file --version 2>/dev/null)" != "${SINGLE_FILE_VERSION}" ]; then
echo "Upgrading single-file-cli to ${SINGLE_FILE_VERSION}..."
npm i -g single-file-cli@${SINGLE_FILE_VERSION} readability-extractor@0.0.6
else
echo "single-file-cli ${SINGLE_FILE_VERSION} already installed"
fi
}
upgrade_singlefile || echo "single-file upgrade failed, continuing..."
# Install serve and the archiving tools at the versions in the committed lockfile; old single-file versions (1.x)
# create compressed Archives without the SingleFile comment header in the prelude, which WROLPi cannot validate.
/opt/wrolpi/scripts/install_npm_tools.sh || echo "npm tools install failed, continuing..."
# Clear Python bytecode cache before upgrading packages.
echo "Clearing Python bytecode cache..."