Skip to content

Verify the Electron zips the release build packages against the lockfile-pinned checksums.json #363

Closed

Description

@shariqh

Found in the review of #360. This predates that PR.

Today: all three thin-app builders call @electron/packager without a download or electronZipDir option:

  • scripts/build-thin-app.mjs (around :212);
  • scripts/build-linux-thin-app.mjs (around :133);
  • scripts/build-windows-thin-app.mjs (around :169).

Packager 20.3.0 therefore calls @electron/get 5.0.0 with no checksums. Its validateArtifact then downloads the release's live SHASUMS256.txt (bypassing the cache) and checks the zip against that.

The lockfile-pinned electron npm package ships a checksums.json, but no build step uses it. Electron 43's package has no install script, and install.js runs only when something does require('electron'), which no build step does.

Consequence: each shipped Electron zip is checked only against a hash list fetched from the same GitHub release.

  • That catches corruption, but if a release's zip and its SHASUMS256.txt were both replaced, the build would accept them.
  • Nothing ties the bytes we ship to what was reviewed when we bumped the version. The CI identity probes check version strings, not bytes.
  • At each bump we compare checksums.json with the official SHASUMS256.txt by hand (all 75 entries matched for Update Electron to 43.8.3 for the eMudhra certificate fix and upstream cherry-picks #360), but no later build re-checks.

Fix:

  • Read node_modules/electron/checksums.json (its bytes are pinned by the lockfile's npm integrity).
  • Assert that package's version equals inputs.electron.version.
  • Pass it as download: { checksums } to packager() in all three builders, so a zip that doesn't match the reviewed hash is refused.
  • Add a source-pin test so a builder can't drop the option.
  • Alternative: pin the packaged zips' SHA-256 in the release inputs, as the Node archives are. That adds a pin for every Electron bump to maintain.

While there: package.json allowScripts lists [email protected], which matches nothing in the lockfile. Remove the stale entry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions