Skip to content

Commit ed9dcf6

Browse files
authored
chore(deps): bump electron 41.5.0 -> 42.1.0 and pin packaged version (#9959)
Bumps the desktop runtime to electron 42 (dependabot PR #9945) and closes a supply-chain gap in the Linux/Mac packaging scripts that predated this bump. Why the bump is safe: - macOS UNNotification API change — pgAdmin's runtime does not use Electron's Notification API (only a UI toast comment in src/js/pgadmin.js:211; no `new Notification(...)` anywhere). - postinstall no longer downloads electron — production packaging fetches the binary directly via wget from GitHub releases, never via electron's postinstall script. - Offscreen rendering scale-factor change — no OSR usage anywhere in runtime/src/js/. While verifying, found that pkg/linux/build-functions.sh and pkg/mac/build-functions.sh resolve the packaged electron version via: ELECTRON_VERSION="$(npm info electron version)" This pulls whatever currently carries the `latest` dist-tag on the npm registry. Any newly published electron release — including a hypothetical malicious one — would land in shipped binaries without review, regardless of what runtime/package.json pins. Replace with sed-based extraction from runtime/package.json and fail loudly if extraction returns empty. The Windows installer (pkg/win32/installer.iss.in) does not have this issue (it bundles a pre-built tree, no electron download step). Net change in runtime/yarn.lock is mostly deletions — electron 42 ships with @electron/get 5.x, which dropped a large transitive dependency tree associated with the old postinstall download path. Verified: - eslint (runtime): clean (silent) - yarn install (runtime): resolved to electron 42.2.0 within ^42.1.0 range - sed extraction smoke-tested: returns 42.1.0 from current runtime/package.json
1 parent 1487059 commit ed9dcf6

4 files changed

Lines changed: 50 additions & 399 deletions

File tree

pkg/linux/build-functions.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,16 @@ _build_runtime() {
145145
ELECTRON_ARCH="arm64"
146146
fi
147147

148-
ELECTRON_VERSION="$(npm info electron version)"
148+
# Resolve the electron version from runtime/package.json, NOT from
149+
# `npm info electron version`. The latter fetches whatever currently
150+
# carries the `latest` dist-tag on the npm registry, which means any
151+
# newly published electron release lands in shipped binaries without
152+
# review. Keep the build deterministic and pinned.
153+
ELECTRON_VERSION=$(sed -nE 's/.*"electron":[[:space:]]*"\^?([0-9.]+)".*/\1/p' "${SOURCEDIR}/runtime/package.json" | head -1)
154+
if [ -z "${ELECTRON_VERSION}" ]; then
155+
echo "ERROR: could not resolve electron version from runtime/package.json" >&2
156+
exit 1
157+
fi
149158

150159
pushd "${BUILDROOT}" > /dev/null || exit
151160
while true;do

pkg/mac/build-functions.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,16 @@ _build_runtime() {
3333

3434
test -d "${BUILD_ROOT}" || mkdir "${BUILD_ROOT}"
3535
# Get a fresh copy of electron
36-
ELECTRON_VERSION="$(npm info electron version)"
36+
# Resolve the electron version from runtime/package.json, NOT from
37+
# `npm info electron version`. The latter fetches whatever currently
38+
# carries the `latest` dist-tag on the npm registry, which means any
39+
# newly published electron release lands in shipped binaries without
40+
# review. Keep the build deterministic and pinned.
41+
ELECTRON_VERSION=$(sed -nE 's/.*"electron":[[:space:]]*"\^?([0-9.]+)".*/\1/p' "${SOURCE_DIR}/runtime/package.json" | head -1)
42+
if [ -z "${ELECTRON_VERSION}" ]; then
43+
echo "ERROR: could not resolve electron version from runtime/package.json" >&2
44+
exit 1
45+
fi
3746

3847
pushd "${BUILD_ROOT}" > /dev/null || exit
3948
while true;do

runtime/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"packageManager": "yarn@4.9.2",
1414
"devDependencies": {
1515
"@eslint/js": "^10.0.1",
16-
"electron": "^41.5.0",
16+
"electron": "^42.1.0",
1717
"eslint": "^10.4.0",
1818
"eslint-plugin-unused-imports": "^4.4.1",
1919
"globals": "^17.6.0"

0 commit comments

Comments
 (0)